diff --git a/README.md b/README.md index 6e7f025..bd1a66f 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This plugin uses [FontAwesome icons](http://fontawesome.io/) ### Changelog +* **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) * **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 diff --git a/assets/javascripts/issue_dynamic_edit.js b/assets/javascripts/issue_dynamic_edit.js index c4ad24e..5bbb8ad 100644 --- a/assets/javascripts/issue_dynamic_edit.js +++ b/assets/javascripts/issue_dynamic_edit.js @@ -179,10 +179,27 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){ $('.details .' + cssClass + ' i.fa-times.statusKo').remove(); }, 2000); }, 500); + + jQuery.ajax({ + type: 'GET', + url: window.location.href, + data: { "authenticity_token" : token }, + crossDomain: true, + async: false, + beforeSend: function(xhr) { + xhr.setRequestHeader("authenticity_token", token); + }, + success: function(msg) { + parsed = $.parseHTML(msg); + } + }); + } else { /* removing error div if exists */ $('html').find("#errorExplanation").remove(); + + } /* we update the details block */ $('div.issue.details').html($(parsed).find('div.issue.details').html()); @@ -211,7 +228,7 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){ // update other fields to avoid conflict $('#issue_lock_version').val(parseInt($('#issue_lock_version').val()) + 1 ); $('#last_journal_id').val(parseInt($('#last_journal_id').val()) + 1 ); - } + }, error: function(xhr, msg, error) { /* error and no update, info logged into console */ diff --git a/assets/stylesheets/issue_dynamic_edit.css b/assets/stylesheets/issue_dynamic_edit.css index 00ba8dc..232a20c 100644 --- a/assets/stylesheets/issue_dynamic_edit.css +++ b/assets/stylesheets/issue_dynamic_edit.css @@ -57,7 +57,7 @@ body.controller-issues.action-show div.issue.details .value.edited .dynamicEdit body.controller-issues.action-show div.issue.details .btn-primary { padding: 4px; - color: white; + color: white !important; border-radius: 3px; padding: 3px; } diff --git a/init.rb b/init.rb index b8a9521..7b266bc 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.6' + version '0.4.7' url 'https://github.com/ilogeek/redmine_issue_dynamic_edit' author_url 'https://hzilliox.fr' end