merge wyszukiwania.
authorMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Wed, 28 Dec 2011 09:14:23 +0000 (10:14 +0100)
committerMarcin Koziej <marcin.koziej@nowoczesnapolska.org.pl>
Wed, 28 Dec 2011 09:14:23 +0000 (10:14 +0100)
Merge branch 'pretty' of github.com:fnp/wolnelektury into pretty

Conflicts:
lib/librarian
wolnelektury/templates/base.html

1  2 
apps/catalogue/models.py
apps/catalogue/urls.py
wolnelektury/settings.py
wolnelektury/static/js/search.js
wolnelektury/templates/base.html
wolnelektury/urls.py

Simple merge
Simple merge
@@@ -206,10 -201,9 +207,11 @@@ COMPRESS_JS = 
              'js/locale.js',
              'js/dialogs.js',
              'js/sponsors.js',
+             'js/base.js',
              'js/pdcounter.js',
  
 +            'js/search.js',
 +
              #~ 'js/jquery.autocomplete.js',
              #~ 'js/jquery.labelify.js', 'js/catalogue.js',
              ),
index e58d372,0000000..c41a672
mode 100644,000000..100644
--- /dev/null
@@@ -1,49 -1,0 +1,49 @@@
-       $("#search input[name=q]").search();
 +
 +var __bind = function (self, fn) {
 +    return function() { fn.apply(self, arguments); };
 +};
 +
 +(function($){
 +    $.widget("wl.search", {
 +      options: {
 +          minLength: 0,
 +        },
 +
 +      _create: function() {
 +          var opts = { 
 +              minLength: this.options.minLength,
 +              select: __bind(this, this.enter),
 +              focus: function() { return false; },
 +              source: this.element.data('source'),
 +          };
 +          this.element.autocomplete(opts).data("autocomplete")._renderItem = __bind(this, this.render_item);
 +      },
 +
 +      enter: function(event, ui) {
 +          if (ui.item.url != undefined) {
 +              location.href = ui.item.url;
 +          } else {
 +              this.element.closest('form').submit();
 +          }
 +      },
 +   
 +      render_item: function (ul, item) {
 +          return $("<li></li>").data('item.autocomplete', item)
 +              .append('<a href="'+item.url+'">'+item.label+ ' ('+item.category+')</a>')
 +              .appendTo(ul);
 +      },
 +
 +      destroy: function() {
 +
 +      },
 +      
 +
 +
 +      });
 +
 +    $(function() {
++      $("#search-area input[name=q]").search();
 +      
 +    });
 +
 +})(jQuery);
  
  
  
-             <form id="search" action="/fullsearch/">
 -            <form id="search-area">
++            <form id="search-area" action="/fullsearch/">
                  
 -                <span id="search-field">
 -                    <input title="np. Leśmian" name="q" autocomplete="off">
 +                <span id="search-field" class="grid-line">
 +                    <input title="np. Leśmian" name="q" autocomplete="off" data-source="/fullsearch/hint/">
                  </span><span id="search-button">
                      <button type='submit'><span class="mono">{% trans "Search" %}</span></button>
                  </span>
Simple merge