jquery-editable: Automatically call backend if route and id attributes are present
authorJoey Schulze <joey@infodrom.org>
Mon, 17 Jul 2017 21:06:49 +0000 (23:06 +0200)
committerJoey Schulze <joey@infodrom.org>
Mon, 17 Jul 2017 21:06:49 +0000 (23:06 +0200)
src/jquery.editable.js

index 406b3db..d091608 100644 (file)
                                 $el : $el
                             });
                         }
                                 $el : $el
                             });
                         }
+                       else {
+                           var route = $($el).attr('route');
+                           var name = $($el).attr('name');
+                           var item_id = $($el).attr('item_id');
+                           if (typeof(route) == 'string' && typeof(item_id) == 'string')
+                               $.invoke(route,
+                                        {id: item_id,
+                                         name: name,
+                                         content: newText == defaultText ? false : newText});
+                       }
                     };
 
                     // Blur editor when user clicks outside the editor
                     };
 
                     // Blur editor when user clicks outside the editor
                             $el : $el
                         });
                     }
                             $el : $el
                         });
                     }
+                   else {
+                       var route = $($el).attr('route');
+                       var name = $($el).attr('name');
+                       var item_id = $($el).attr('item_id');
+                       if (typeof(route) == 'string' && typeof(item_id) == 'string')
+                           $.invoke(route,
+                                    {id: item_id,
+                                     name: name,
+                                     content: newText == defaultText ? false : newText});
+                   }
                 })
                 .attr('style', textareaStyle)
                 .appendTo($el)
                 })
                 .attr('style', textareaStyle)
                 .appendTo($el)