Anonymous avatar Anonymous committed e7f5d1b

More extending

Comments (0)

Files changed (6)

  
 Also it provides register_url decorator for ModelAdmin or Inline methods. It turns method to view, which returns HttpResponse object.
 To use it you should add next line to yours urls.py
-  url(r'^admin/', include('ruadmin.urls')),
+  url(r'^admin/', include('admin_extended.urls')),
 IMPORTANT: it should be placed BEFORE including admin.site.urls, but AFTER admin.autodiscover()
 
 After then you may deco yours methods like that:

admin_extended/__init__.py

-__version__ = '1.0.4'
+__version__ = '1.0.5'

admin_extended/static/css/admin/autoinlines.css

 
 .auto-module tr.add-row, .auto-module .inline-deletelink,
 .auto-module table th:last-child, .auto-module table td.delete,
-.auto-controller .help, .auto-controller label, .auto-controller a.add-another,
-.auto-field a.add-another, .auto-row .original p
+.auto-field a.add-another, .auto-row .original p,
+.list .help, .list label, .list a.add-another
 {display: none;}
 
-.auto-controller ul {margin-left: 0px !important; padding-left: 0px !important;}
-.auto-controller ul li {list-style: none;}
+.list ul {margin-left: 0px !important; padding-left: 0px !important;}
+.list ul li {list-style: none;}

admin_extended/static/js/admin/autoinlines.js

             $(this.sRow).addClass("auto-row");
             
             $.each(this.controllers, function() {
-                $("fieldset .field-{0}".format(this.toString())).addClass("auto-controller");
+                $("fieldset .field-{0}".format(this.toString())).addClass("list");
             })
 
             $.each(this.fields, function() {

admin_extended/static/js/admin/searchline.js

             label: "Search",
             notFound: "No match found",
             matchCase: false,
+	    attachMethod: "prependTo",
+	    attachSelector: null
         }, options)
         this.controller = controller;
 	this.init();
     FilteredCheckboxes.prototype.init = function() {
         var self = this;
 
-        var div = $("<div/>", {class: "searchContainer"}).prependTo(this.controller);
+	var place = this.attachSelector ? this.controller.find(this.attachSelector) : this.controller;
+        var div = $("<div/>", {class: "searchContainer"})[this.attachMethod](place);
         var choices = this.controller.find("ul li label");
         var input = $("<input/>", {class: "search-line vTextField"}).appendTo(div);
 
             }
         })
 
-        $("<span/>", {text: "Поиск: ", class: "search-label"}).prependTo(div);
+        $("<span/>", {text: self.label + " ", class: "search-label"}).prependTo(div);
         $("<span/>", {class: "deletelink"}).appendTo(div).click(function() {
             input.val("");
             input.trigger("keyup");
         })
         $("<div/>", {text: this.notFound, class: "not-found"}).appendTo(div).hide();
     }
-})(jQuery || django.jQuery)
+})(jQuery || django.jQuery)

admin_extended/templates/admin/base_site.html

 {% extends "admin:admin/base_site.html" %}
+{% load staticfiles %}
 
 {% block extrahead %}
     {% if SETTING_FAVICON_PREFIX %}
         <link rel="icon" href="{{ SETTING_FAVICON_PREFIX }}favicon.ico" type="image/x-icon">
     {% endif %}
 
-    <script type="text/javascript" src="{{ SETTING_STATIC_URL }}js/string.js"></script>
     {% if SETTING_ADMIN_JQUERY_ADDITIONAL_VERSION %}
         <script type="text/javascript"
             src="https://ajax.googleapis.com/ajax/libs/jquery/{{ SETTING_ADMIN_JQUERY_ADDITIONAL_VERSION }}/jquery.min.js">
         </script>
     {% endif %}
+
+    <link rel="stylesheet" href="{% static 'css/admin/autoinlines.css' %}">
+    <link rel="stylesheet" href="{% static 'css/admin/searchline.css' %}">
+
+    <script type="text/javascript" src="{{ SETTING_STATIC_URL }}js/string.js"></script>
+    <script src="{% static 'js/admin/autoinlines.js' %}"></script>
+    <script src="{% static 'js/admin/searchline.js' %}"></script>
+   
+    {% block extrahead_extended %}
+    {% endblock %}
 {% endblock %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.