Poprawienie urli w JS.
[redakcja.git] / platforma / templates / explorer / file_list.html
index f44a105..abd9612 100644 (file)
@@ -2,54 +2,22 @@
 
 {% block extrahead %}
 <link rel="stylesheet" href="{{ STATIC_URL }}css/filelist.css" type="text/css" />
-    <script src="{{STATIC_URL}}js/jquery.json.js" type="text/javascript" charset="utf-8"></script>
-    <script src="{{STATIC_URL}}js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
+<script src="{{ STATIC_URL }}js/slugify.js" type="text/javascript" charset="utf-8"></script>
 <script type="text/javascript" charset="utf-8">
 $(function() {
        function search(event) {
-        var expr = new RegExp($('#file-list-filter').val(), 'i');
+        event.preventDefault();
+        
+        var expr = new RegExp(slugify($('#file-list-filter').val()), 'i');
        
         $('#file-list p').hide().filter(function(index) {
-            return expr.test($(this).attr('title'));
+            console.log(expr.test($(this).attr('title')))
+            return expr.test(slugify($('a', this).html()));
         }).show();
-    
-        event.preventDefault();
     }
        
-    $('#file-list-find-button').click(search);
+    $('#file-list-find-button').click(search).hide();
        $('#file-list-filter').bind('keyup change DOMAttrModified', search);
-               
-    var defaultOptions = {
-        panels: [
-        {
-            name: 'htmleditor',
-            ratio: 0.5
-        },
-
-        {
-            name: 'gallery',
-            ratio: 0.5
-        }
-        ],
-        recentFiles: [],
-        lastUpdate: 0
-    };
-    
-       var options = null;
-    try {
-        var cookie = $.cookie('options');
-        options = $.secureEvalJSON(cookie);
-        if (!options) {
-            options = defaultOptions;
-        }
-    } catch (e) {    
-        options = defaultOptions;
-    };
-       
-       $.each(options.recentFiles, function(index) {
-               var fileId = options.recentFiles[index].fileId;
-               $('#recent-file-list ul').append('<li><a href="{% url editor_base %}'+fileId+'">' + fileId + '</a></li>');
-       });
 });
 </script>
 {% endblock extrahead %}
@@ -59,17 +27,16 @@ $(function() {
 
 <div class="file-list-widget">
     <form action="#" method="GET">
-    <p><input name="filter" id="file-list-filter" type="text" size="60" />
+    <p><input autocomplete="off" name="filter" id="file-list-filter" type="text" size="60" />
         <input type="submit" value="Znajdź" id="file-list-find-button"/>
         <input type="reset" value="Wyczyść" id="file-list-reset-button"/>
     </p>
-    </form>
-    {% load explorer_tags %}
-    <ul class="file-tree-part file-tree-top">
-    {% for file in filetree %}    
-        {% tree_part file %}            
+    </form> 
+    <div id="file-list">
+    {% for file in document_list %}
+        <p><a href="/{{ file|urlencode }}">{{ file }}</a></p>
     {% endfor %}
-    </ul>
+    </div>
 </div>
 
 <div id="recent-file-list">