diff --git a/README.md b/README.md
index d233a00..2b9ff54 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# redmine_issue_dynamic_edit
-Add new dropdown elements on detailed issue page to dynamically update issue's status, assignee, priority, start and due dates, ratio and estimated time fields, directly in the details block of the issue without any page refresh (JIRA style).
+Add new elements on detailed issue page to dynamically update issue's title, status, assignee, priority, start and due dates, ratio and estimated time fields, directly in the details block of the issue without any page refresh (JIRA style).
### Example
@@ -19,6 +19,7 @@ This plugin uses [FontAwesome icons](http://fontawesome.io/)
### Changelog
+* **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
* **v 0.4.2** : fixed Github issue #10 : History list updated after modification
diff --git a/assets/javascripts/issue_dynamic_edit.js b/assets/javascripts/issue_dynamic_edit.js
index 076207a..10b4a0f 100644
--- a/assets/javascripts/issue_dynamic_edit.js
+++ b/assets/javascripts/issue_dynamic_edit.js
@@ -77,6 +77,13 @@ function initEditFields()
$('.details .attributes .due-date.attribute .value').html() + ' ' +
htmlCopy);
}
+
+ if($('#TitleInput').length > 0) {
+ var htmlCopy = $('#TitleInput').get(0).outerHTML;
+ $('#TitleInput').remove();
+ $('.subject h3').html('' + $('.subject h3').html() + ' ' +
+ htmlCopy).addClass('value');
+ }
}
initEditFields();
@@ -102,23 +109,19 @@ $('body.controller-issues.action-show').on('click', '.btn.close', function(e){
function issueDynamicUpdate(field_name, field_value, type, cssClass){
/* hide edit field */
- $('.details .attributes .' + cssClass + '.attribute .value').removeClass('edited');
+ $('.details .' + cssClass + ' .value').removeClass('edited');
/* add spin notification */
- if(type == "progress") { // specific case for progress bar
- $('.details .attributes .' + cssClass + '.attribute .value').append(' ');
- } else {
- $('.details .attributes .' + cssClass + '.attribute .value').append(' ');
- }
+ $('.details .' + cssClass + ' .value').append(' ');
/* update value displayed */
- $('.details .attributes .' + cssClass + '.attribute .showValue').html(function(){
+ $('.details .' + cssClass + ' .showValue').html(function(){
if(type == "select")
{
- return $('.details .attributes .' + cssClass + '.attribute .value select option:selected').html()
+ return $('.details .' + cssClass + ' .value select option:selected').html()
} else if (type == "input")
{
- return $('.details .attributes .' + cssClass + '.attribute .value input').val()
+ return $('.details .' + cssClass + ' .value input').val()
} else if(type == "date")
{
return "XXXX/XX/XX";
@@ -128,7 +131,7 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
/* lost focus on element */
if( type != "select")
{
- $('.details .attributes .' + cssClass + '.attribute .value input').blur();
+ $('.details .' + cssClass + ' .value input').blur();
}
var token = $("meta[name=csrf-token]").attr('content');
@@ -161,9 +164,9 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
}
/* 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-times statusKo');
+ $('.details .' + cssClass + ' i.fa-spin').removeClass('fa-refresh fa-spin').addClass('fa-times statusKo');
setTimeout(function(){
- $('.details .attributes .' + cssClass + '.attribute i.fa-times.statusKo').remove();
+ $('.details .' + cssClass + ' i.fa-times.statusKo').remove();
}, 2000);
}, 500);
} else {
@@ -173,11 +176,8 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
/* we update the details block */
$('div.issue.details').html($(parsed).find('div.issue.details').html());
- if(type == "progress") { // specific case for progress bar
- $('body').find('.details .attributes .' + cssClass + '.attribute .value').append(' ');
- } else {
- $('body').find('.details .attributes .' + cssClass + '.attribute .value').append(' ');
- }
+ $('body').find('.details .' + cssClass + ' .value').append(' ');
+
/* we init edit fields */
initEditFields();
initEditFieldListeners();
@@ -192,9 +192,9 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
/* 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');
+ $('.details .' + cssClass + ' i.fa-spin').removeClass('fa-refresh fa-spin').addClass('fa-check statusOk');
setTimeout(function(){
- $('.details .attributes .' + cssClass + '.attribute i.fa-check.statusOk').remove();
+ $('.details .' + cssClass + ' i.fa-check.statusOk').remove();
}, 2000);
}, 500);
@@ -213,9 +213,9 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
console.log('%c error data: ', 'background: black; color: white;');;
console.log(error);
console.log('%c ---------------------------------------------------------- ', 'background: #ff0000; color: white; font-weight:900');
- $('.details .attributes .' + cssClass + '.attribute i.fa-spin').removeClass('fa-refresh fa-spin').addClass('fa-times').html(" " + _TXT_ERROR_AJAX_CALL);
+ $('.details .' + cssClass + ' i.fa-spin').removeClass('fa-refresh fa-spin').addClass('fa-times').html(" " + _TXT_ERROR_AJAX_CALL);
setTimeout(function(){
- $('.details .attributes .' + cssClass + '.attribute i.fa-times').remove();
+ $('.details .' + cssClass + ' i.fa-times').remove();
}, 2000);
}
});
@@ -320,6 +320,21 @@ function initEditFieldListeners()
$('#DueDateInput a.btn.validate').click();
}
});/* end StartDate */
+
+ var domInputTitle = $('body').find('#TitleInput input');
+ $('#TitleInput a.btn.validate').on('click', function(e)
+ {
+ e.preventDefault();
+ issueDynamicUpdate('subject', domInputTitle.val(), 'input', 'subject');
+
+ return false;
+ });
+
+ domInputTitle.on('keyup', function(e){
+ if (e.keyCode == 13) {
+ $('#TitleInput a.btn.validate').click();
+ }
+ });/* end StartDate */
}
initEditFieldListeners();
\ No newline at end of file
diff --git a/assets/stylesheets/issue_dynamic_edit.css b/assets/stylesheets/issue_dynamic_edit.css
index a1d26ff..00ba8dc 100644
--- a/assets/stylesheets/issue_dynamic_edit.css
+++ b/assets/stylesheets/issue_dynamic_edit.css
@@ -1,6 +1,6 @@
/* 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 {
+body.controller-issues.action-show div.issue.details .value, body.controller-issues.action-show div.issue.details .splitcontent {
overflow: visible;
position: relative;
}
@@ -19,7 +19,7 @@ body.controller-issues.action-show .attribute .error {
margin-left: 3px;
}
-body.controller-issues.action-show .value .fa-pencil {
+body.controller-issues.action-show .fa-pencil {
opacity: 0;
}
@@ -51,22 +51,22 @@ body.controller-issues.action-show .edited .dynamicEdit {
pointer-events: auto;
}
-body.controller-issues.action-show div.issue .attribute .value.edited .dynamicEdit {
+body.controller-issues.action-show div.issue.details .value.edited .dynamicEdit {
opacity: 1;
}
-body.controller-issues.action-show .attribute .btn-primary {
+body.controller-issues.action-show div.issue.details .btn-primary {
padding: 4px;
color: white;
border-radius: 3px;
padding: 3px;
}
-body.controller-issues.action-show .attribute .btn-primary.close {
+body.controller-issues.action-show div.issue.details .btn-primary.close {
background: #c0392b;
}
-body.controller-issues.action-show .attribute .btn-primary.validate {
+body.controller-issues.action-show div.issue.details .btn-primary.validate {
background: #27ae60;
}
@@ -88,11 +88,15 @@ body.controller-issues.action-show .dynamicEdit select option[disabled="disabled
display:none;
}
-body.controller-issues.action-show div.issue .attributes {
+body.controller-issues.action-show div.issue.details .attributes {
display: table;
width: 100%;
}
-body.controller-issues.action-show div.issue .splitcontent {
+body.controller-issues.action-show div.issue.details .splitcontent {
display: table-row;
+}
+
+div.issue div.subject h3 {
+ position:relative;
}
\ No newline at end of file
diff --git a/init.rb b/init.rb
index 61b724c..be4e240 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.4'
+ version '0.4.5'
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 5bc9941..2420420 100644
--- a/lib/details_issue_hooks.rb
+++ b/lib/details_issue_hooks.rb
@@ -140,6 +140,13 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener
o << "//]]>\n"
o << ""
end
+
+ # Title
+ o << ""
+ o << " "
+ o << " "
+ o << " "
+ o << ""
end
end