From 4d15ab57978e7c2c65ea436099bcaf4810936da8 Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 14 Dec 2017 23:20:20 +0100 Subject: [PATCH] Fixed JS error when no description (Github issue #16) --- README.md | 1 + assets/javascripts/issue_dynamic_edit.js | 20 ++++++++++++-------- init.rb | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index bd1a66f..8103f27 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This plugin uses [FontAwesome icons](http://fontawesome.io/) ### Changelog +* **v 0.4.8** : fixed Github issues #15 and #16 * **v 0.4.7** : if error on dynamic update, put back old values in details block (fixed Github issue #8) * **v 0.4.6** : description is now dynamically editable (edit field appears if there's already a description written) (Github request #14) * **v 0.4.5** : fixed Github issue #13 : CSS display for custom attributes, added Title dynamic edition (Github request #14) diff --git a/assets/javascripts/issue_dynamic_edit.js b/assets/javascripts/issue_dynamic_edit.js index 5bbb8ad..6575ba5 100644 --- a/assets/javascripts/issue_dynamic_edit.js +++ b/assets/javascripts/issue_dynamic_edit.js @@ -364,15 +364,19 @@ function initEditFieldListeners() });/* end Title */ var domInputDescription = $('body').find('#DescriptionInput textarea'); - $('#DescriptionInput a.btn.validate').on('click', function(e) + + if(domInputDescription.length) { - e.preventDefault(); - issueDynamicUpdate('description', domInputDescription.serialize().split('description=')[1], 'textarea', 'description'); - - return false; - }); - - var wikiToolbar = new jsToolBar(document.getElementById('description_textarea')); wikiToolbar.setHelpLink('/help/fr/wiki_syntax_textile.html'); wikiToolbar.draw(); + $('#DescriptionInput a.btn.validate').on('click', function(e) + { + e.preventDefault(); + issueDynamicUpdate('description', domInputDescription.serialize().split('description=')[1], 'textarea', 'description'); + + return false; + }); + + var wikiToolbar = new jsToolBar(document.getElementById('description_textarea')); wikiToolbar.setHelpLink('/help/fr/wiki_syntax_textile.html'); wikiToolbar.draw(); + } /* end Description */ } diff --git a/init.rb b/init.rb index 7b266bc..07f6456 100644 --- a/init.rb +++ b/init.rb @@ -6,7 +6,7 @@ Redmine::Plugin.register :redmine_issue_dynamic_edit do name 'Redmine Dynamic edit Issue plugin' author 'Hugo Zilliox' description 'Allows users to dynamically update issue attributes in detailed view without refreshing the page (JIRA style)' - version '0.4.7' + version '0.4.8' url 'https://github.com/ilogeek/redmine_issue_dynamic_edit' author_url 'https://hzilliox.fr' end