Uproszczenie implementacji wzorca observer.
[redakcja.git] / project / templates / explorer / panels / dceditor.html
index ee5146c..215f54f 100644 (file)
@@ -1,21 +1,28 @@
 <div class="panel-dceditor">
 <div class="panel-dceditor">
-    <form action="{{ request.get_full_path }}" method="post" accept-charset="utf-8">
-        {{ form }}
-        <p><input type="submit" value="Continue &rarr;"/></p>
+    <form action="{% url file_dc fileid %}" method="post" accept-charset="utf-8">
+        {{ form.as_p }}
+<!--    <p><input type="submit" value="Continue &rarr;"/></p> -->
     </form>
 </div>
 <script type="text/javascript" charset="utf-8">
     </form>
 </div>
 <script type="text/javascript" charset="utf-8">
-    (function() {
-        var id = Math.ceil(Math.random() * 1000000000);
-        
-        panel(function(event, me) {
-            // $(document).bind('panel:contentChanged.' + id, function(event, p) {
-            //     $('.change-notification', $(me).parent()).fadeIn();
-            // });
-            $(me).addClass('panel-htmleditor');
-        }, function(event, me) {
-            $(me).removeClass('panel-htmleditor');
-            // $(document).unbind('panel:contentChanged.' + id);
-        });
-    })()
+panel_hooks = { 
+
+       load: function() {
+               var self = this;
+               self.form = $('form', self.contentDiv);
+               $("input[type='text'], textarea", self.form).each(function() {
+                       $(this).change(function(event) {
+                               self.contentDiv.trigger('panel:contentChanged', self);
+                       });
+               });
+                self._endload();       
+       },
+       saveInfo: function(saveInfo) {
+               var myInfo = {
+                       url: "{% url file_dc fileid %}",
+                       postData: $('form', this.contentDiv).serialize() 
+               };
+               $.extend(saveInfo, myInfo);
+       }
+};
 </script>
 </script>