diff --git a/README.md b/README.md index 2b9ff54..6e7f025 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This plugin uses [FontAwesome icons](http://fontawesome.io/) ### Changelog +* **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) * **v 0.4.4** : fixed Github issues #6, #12 : User can't update status until all required field are filled for this step of the issue * **v 0.4.3** : partially fixed Github issue #12 : Read only attributes can't be edited anymore. Dynamic refresh for read only attributes when status changes diff --git a/assets/javascripts/issue_dynamic_edit.js b/assets/javascripts/issue_dynamic_edit.js index 10b4a0f..c4ad24e 100644 --- a/assets/javascripts/issue_dynamic_edit.js +++ b/assets/javascripts/issue_dynamic_edit.js @@ -84,6 +84,13 @@ function initEditFields() $('.subject h3').html('' + $('.subject h3').html() + ' ' + htmlCopy).addClass('value'); } + + if($('#DescriptionInput').length > 0) { + var htmlCopy = $('#DescriptionInput').get(0).outerHTML; + $('#DescriptionInput').remove(); + $('div.description .wiki').html(' ' + $('div.description .wiki').html() + '' + + htmlCopy).addClass('value'); + } } initEditFields(); @@ -122,6 +129,9 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){ } else if (type == "input") { return $('.details .' + cssClass + ' .value input').val() + } else if(type == "textarea") + { + return $('.details .' + cssClass + ' .value textarea').val() } else if(type == "date") { return "XXXX/XX/XX"; @@ -334,7 +344,20 @@ function initEditFieldListeners() if (e.keyCode == 13) { $('#TitleInput a.btn.validate').click(); } - });/* end StartDate */ + });/* end Title */ + + var domInputDescription = $('body').find('#DescriptionInput textarea'); + $('#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 */ } initEditFieldListeners(); \ No newline at end of file diff --git a/doc/edit.gif b/doc/edit.gif index 6a03cf7..5e29c3a 100644 Binary files a/doc/edit.gif and b/doc/edit.gif differ diff --git a/init.rb b/init.rb index be4e240..b8a9521 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.5' + version '0.4.6' url 'https://github.com/ilogeek/redmine_issue_dynamic_edit' author_url 'https://hzilliox.fr' end diff --git a/lib/details_issue_hooks.rb b/lib/details_issue_hooks.rb index 2420420..8f93573 100644 --- a/lib/details_issue_hooks.rb +++ b/lib/details_issue_hooks.rb @@ -147,6 +147,13 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener o << " " o << " " o << "" + + # Description + o << "" + o << " " + o << "
" + o << "
" + o << "
" end end