Fixed Github issue #10. History list updated after modification

This commit is contained in:
Ilogeek 2017-09-13 15:22:56 +02:00
parent efe0d79065
commit 7f5d6e6858
4 changed files with 28 additions and 20 deletions

View File

@ -76,7 +76,7 @@ if($('#DueDateInput').length > 0) {
htmlCopy);
}
$('body').on('click', '.btn.close', function(e){
$('body.controller-issues.action-show').on('click', '.btn.close', function(e){
e.preventDefault();
$(e.target).closest('.value').removeClass('edited');
return false;
@ -127,16 +127,23 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
xhr.setRequestHeader("authenticity_token", token);
},
success: function(msg) {
// get result page content (updated issue detail page with new status)
/* get result page content (updated issue detail page with new status) */
var parsed = $.parseHTML(msg);
var statusListDropdown = $(parsed).find("#statusListDropdown select");
var prioritiesListDropdown = $(parsed).find('#prioritiesListDropdown select');
// we update dropdown status with new one from updated page
/* we update dropdown status with new one from updated page */
$('#statusListDropdown select').html(statusListDropdown.html());
$('#issue_status_id').html(statusListDropdown.html());
$('#prioritiesListDropdown select').html(prioritiesListDropdown.html());
$('#issue_priority_id').html(prioritiesListDropdown.html());
/* we update issue properties edit block */
$('#all_attributes').html($(parsed).find('#all_attributes').html());
/* we update the history list */
$('#history').append($(parsed).find('#history .journal.has-details:last-child'));
/* data updated, remove spin and add success icon for 2sec */
setTimeout(function(){
$('.details .attributes .' + cssClass + '.attribute i.fa-spin').removeClass('fa-refresh fa-spin').addClass('fa-check statusOk');

View File

@ -1,35 +1,37 @@
div.issue .attribute .value, div.issue .splitcontent {
/* prefix selector with body.controller-issues.action-show to avoid unwanted style on other page ? */
body.controller-issues.action-show div.issue .attribute .value, body.controller-issues.action-show div.issue .splitcontent {
overflow: visible;
position: relative;
}
div.issue .attribute .value .percent {
body.controller-issues.action-show div.issue .attribute .value .percent {
display: inline-block;
}
/* Progress bar fix */
table.progress {
body.controller-issues.action-show table.progress {
margin-right: 10px;
}
.attribute .error {
body.controller-issues.action-show .attribute .error {
color: #e74c3c;
margin-left: 3px;
}
.value .fa-pencil {
body.controller-issues.action-show .value .fa-pencil {
opacity: 0;
}
.issue.details .showValue {
body.controller-issues.action-show .issue.details .showValue {
cursor: pointer;
}
.issue.details:hover .fa-pencil {
body.controller-issues.action-show .issue.details:hover .fa-pencil {
opacity: 1;
}
.dynamicEdit {
body.controller-issues.action-show .dynamicEdit {
display: inline-block;
position:absolute;
opacity: 0;
@ -45,30 +47,30 @@ table.progress {
width: max-content;
}
.edited .dynamicEdit {
body.controller-issues.action-show .edited .dynamicEdit {
pointer-events: auto;
}
div.issue .attribute .value.edited .dynamicEdit {
body.controller-issues.action-show div.issue .attribute .value.edited .dynamicEdit {
opacity: 1;
}
.attribute .btn-primary {
body.controller-issues.action-show .attribute .btn-primary {
padding: 4px;
color: white;
border-radius: 3px;
padding: 3px;
}
.attribute .btn-primary.close {
body.controller-issues.action-show .attribute .btn-primary.close {
background: #c0392b;
}
.attribute .btn-primary.validate {
body.controller-issues.action-show .attribute .btn-primary.validate {
background: #27ae60;
}
.dynamicEdit select {
body.controller-issues.action-show .dynamicEdit select {
border:none;
background-image:none;
background-color:transparent;
@ -81,7 +83,7 @@ div.issue .attribute .value.edited .dynamicEdit {
border-radius: 3px;
}
.dynamicEdit select option[disabled="disabled"]
body.controller-issues.action-show .dynamicEdit select option[disabled="disabled"]
{
display:none;
}

View File

@ -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'
version '0.4.0'
version '0.4.2'
url 'https://github.com/ilogeek/redmine_issue_dynamic_edit'
author_url 'https://hzilliox.fr'
end

View File

@ -44,7 +44,6 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener
end
# Users dropdown
# userCanChangeAssignee = User.current.allowed_to?(:edit_assigned_to, @project, :global => true)
assignables = project.assignable_users
o << assignables.to_json
if (!assignables.empty?)