OSDN Git Service

fix: show's destroy button
[pettanr/pettanr.git] / app / assets / javascripts / locmare / form.js.coffee
index 90a6958..4e55865 100644 (file)
@@ -59,11 +59,7 @@ class Locmare.Form extends Locmare.FormBase
     @init_fields()\r
   \r
   render: () ->\r
-    @attr = {\r
-      method: @method_type(),\r
-      action: @action_url()\r
-    }\r
-    this.$el.attr(@attr)\r
+    this.$el.attr(@form_attr())\r
     this.$el.html('')\r
     @error_explanation = null\r
     @div_fields = new Locmare.FormModule.Fields({\r
@@ -79,6 +75,12 @@ class Locmare.Form extends Locmare.FormBase
       @delegateEvents({'submit': @method_type()})\r
     this\r
   \r
+  form_attr: () ->\r
+    {\r
+      method: @method_type(),\r
+      action: @action_url()\r
+    }\r
+  \r
   refresh: () ->\r
     _.each @fields, (field) =>\r
       field.refresh()\r
@@ -187,6 +189,7 @@ class Locmare.Form extends Locmare.FormBase
   success: (model, response) ->\r
     if !Pettanr.cache.restore(model.cache_key())\r
       # item is new\r
+      model.url = model.default_url()\r
       Pettanr.cache.store(model)\r
     else\r
       @item.fix()\r