Zapisywanie i odczytywanie ustawień paneli z cookie. Potrzebne jest jeszcze ustawiani...
authorzuber <marek@stepniowski.com>
Fri, 28 Aug 2009 08:45:52 +0000 (10:45 +0200)
committerzuber <marek@stepniowski.com>
Fri, 28 Aug 2009 08:45:52 +0000 (10:45 +0200)
project/static/js/editor.js
project/templates/explorer/editor.html

index 23fab85..8d75525 100644 (file)
@@ -123,7 +123,9 @@ Editor.prototype.setupUI = function() {
                 });
                 totalWidth += panelWidth;               
             }
-            $('.panel-toolbar select', this).val(self.options.panels[index].url);
+            $('.panel-toolbar select', this).val(
+                $('.panel-toolbar option[name=' + self.options.panels[index].name + ']', this).attr('value')
+            )
         });
     }
     
@@ -143,7 +145,7 @@ Editor.prototype.setupUI = function() {
                        var panels = [];
                        $('.panel-wrap', panelRoot).not('.panel-content-overlay').each(function(index) {
                 panels.push({
-                    url: $('.panel-toolbar select', this).val(),
+                    name: $('.panel-toolbar option:selected', this).attr('name'),
                     ratio: $(this).width() / panelRoot.width()
                 })
                        });
@@ -153,15 +155,13 @@ Editor.prototype.setupUI = function() {
            });
        });     
     
-    $('.panel-toolbar').val()
        $('#toolbar-button-save').click( function (event, data) { self.saveToBranch(); } );
     
     panelRoot.bind('stopResize', function() {
         var panels = [];
         $('.panel-wrap', panelRoot).not('.panel-content-overlay').each(function() {
-            console.log($(this), $(this).data('ctrl'));
             panels.push({
-                url: $('.panel-toolbar select', this).val(),
+                name: $('.panel-toolbar option:selected', this).attr('name'),
                 ratio: $(this).width() / panelRoot.width()
             })
         });
@@ -179,8 +179,8 @@ Editor.prototype.loadConfig = function() {
     } catch (e) {        
         this.options = {
             panels: [
-                {url: '/editor/panel/htmleditor/', ratio: 0.5},
-                {url: '/editor/panel/gallery/', ratio: 0.5}
+                {name: 'htmleditor', ratio: 0.5},
+                {name: 'gallery', ratio: 0.5}
             ]
         }
     }
index 1e0cf30..dd5c736 100644 (file)
                <div id="left-panel-toolbar" class="panel-toolbar">
                     <label for="select-left-panel">Lewy panel:</label>
                     <select name="select-left-panel" id="select-left-panel">
-                        <option value="{% url xmleditor_panel hash %}">Edytor XML</option>
-                        <option value="{% url htmleditor_panel hash %}">Edytor HTML</option>
-                        <option value="{% url gallery_panel hash %}">Galeria skanów</option>
-                        <option value="{% url dceditor_panel hash %}">Edytor DublinCore</option>
+                        <option value="{% url xmleditor_panel hash %}" name="xmleditor">Edytor XML</option>
+                        <option value="{% url htmleditor_panel hash %}" name="htmleditor">Edytor HTML</option>
+                        <option value="{% url gallery_panel hash %}" name="gallery">Galeria skanów</option>
+                        <option value="{% url dceditor_panel hash %}" name="dceditor">Edytor DublinCore</option>
                     </select>
                     <strong class="change-notification" style="display: none">Widok nieaktualny!</strong>
                </div>
                 <div id="right-panel-toolbar" class="panel-toolbar">
                     <label for="select-right-panel">Prawy panel:</label>
                     <select name="select-right-panel" id="select-right-panel">
-                        <option value="{% url xmleditor_panel hash %}">Edytor XML</option>
-                        <option value="{% url htmleditor_panel hash %}">Edytor HTML</option>
-                        <option value="{% url gallery_panel hash %}">Galeria skanów</option>
-                        <option value="{% url dceditor_panel hash %}">Edytor DublinCore</option>
+                        <option value="{% url xmleditor_panel hash %}" name="xmleditor">Edytor XML</option>
+                        <option value="{% url htmleditor_panel hash %}" name="htmleditor">Edytor HTML</option>
+                        <option value="{% url gallery_panel hash %}" name="gallery">Galeria skanów</option>
+                        <option value="{% url dceditor_panel hash %}" name="dceditor">Edytor DublinCore</option>
                     </select>
                     <strong class="change-notification" style="display: none">Widok nieaktualny!</strong>
                  </div>