description is now dynamically editable (edit field appears if there's already a description written) (Github request #14)

This commit is contained in:
Hugo 2017-11-25 02:00:20 +01:00
parent 22b299665a
commit fa1b7058df
5 changed files with 33 additions and 2 deletions

View File

@ -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

View File

@ -84,6 +84,13 @@ function initEditFields()
$('.subject h3').html('<span class="showValue">' + $('.subject h3').html() + '</span> <i class="fa fa-pencil fa-fw" aria-hidden="true"></i>' +
htmlCopy).addClass('value');
}
if($('#DescriptionInput').length > 0) {
var htmlCopy = $('#DescriptionInput').get(0).outerHTML;
$('#DescriptionInput').remove();
$('div.description .wiki').html(' <i class="fa fa-pencil fa-fw" aria-hidden="true" style="float:right;"></i><span class="showValue">' + $('div.description .wiki').html() + '</span>' +
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();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 1.5 MiB

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 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

View File

@ -147,6 +147,13 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener
o << " <a href='#' class='btn btn-primary validate' aria-label='" + l(:ide_txt_validation_btn) + "'><i class='fa fa-check fa-fw' aria-hidden='true'></i></a>"
o << " <a href='#' class='btn btn-primary close' aria-label='" + l(:ide_txt_cancel_btn) + "'><i class='fa fa-times fa-fw' aria-hidden='true'></i></a>"
o << "</span>"
# Description
o << "<span class='dynamicEdit' id='DescriptionInput'>"
o << " <textarea name='description' id='description_textarea' cols='60' rows='10' style='width:calc(100\% - 10px)'>#{issue.description}</textarea>"
o << " <div style='display:block; text-align:right; margin-top:10px;'><a href='#' class='btn btn-primary validate' aria-label='" + l(:ide_txt_validation_btn) + "'><i class='fa fa-check fa-fw' aria-hidden='true'></i></a>"
o << " <a href='#' class='btn btn-primary close' aria-label='" + l(:ide_txt_cancel_btn) + "'><i class='fa fa-times fa-fw' aria-hidden='true'></i></a></div>"
o << "</span>"
end
end