if error on dynamic update, show message and put back old values in details block
This commit is contained in:
parent
fa1b7058df
commit
ea2b6e62ac
@ -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
|
||||
|
||||
@ -179,11 +179,28 @@ 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());
|
||||
$('body').find('.details .' + cssClass + ' .value').append(' <i class="fa fa-refresh fa-spin fa-fw"></i>');
|
||||
@ -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 */
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
2
init.rb
2
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user