From: Joey Schulze Date: Mon, 17 Jul 2017 21:06:49 +0000 (+0200) Subject: jquery-editable: Automatically call backend if route and id attributes are present X-Git-Url: https://git.infodrom.org/?p=infodrom.org%2Fservice.infodrom.org;a=commitdiff_plain;h=b5680adb0e486d8899440d9c4d900308367325fe;hp=31791899b51bd44827539b1107d01366002325c7 jquery-editable: Automatically call backend if route and id attributes are present --- diff --git a/src/jquery.editable.js b/src/jquery.editable.js index 406b3db..d091608 100644 --- a/src/jquery.editable.js +++ b/src/jquery.editable.js @@ -173,6 +173,16 @@ $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 @@ -237,6 +247,16 @@ $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)