diff --git a/README.md b/README.md index 9b2263e..b7910b7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,19 @@ # redmine_issue_dynamic_edit Add new dropdowns elements on detailed issue page to dynamically update issue's status, assignee and priority directly in the details block of the issue -You have to enable Redmine REST API \ No newline at end of file +**You have to enable Redmine REST API** (`Administration` > `Settings` > `API` > check **Enable REST web service**) + +### Example + +![Gif that represents dynamic edition of field from the detailled issue's view](/doc/edit.gif) + +### Installation + +* Enable REST API +* Clone repo into plugins directory : `git clone https://github.com/Ilogeek/redmine_issue_dynamic_edit.git` +* Restart your Redmine instance + +### Customization + +Feel free to edit `assets/stylesheets/issue_dynamic_edit.css` to update the look of your fields depending on your current Redmine Theme +This plugin uses [FontAwesome icons](http://fontawesome.io/) \ No newline at end of file diff --git a/assets/javascripts/issue_dynamic_edit.js b/assets/javascripts/issue_dynamic_edit.js index 3c4ea9a..8eca8e1 100644 --- a/assets/javascripts/issue_dynamic_edit.js +++ b/assets/javascripts/issue_dynamic_edit.js @@ -48,6 +48,9 @@ function updateDataIssue(field_name, field_value, cssClass) { }, success: function(msg) { setTimeout(function(){ + $('.details .attributes .' + cssClass + '.attribute .value .selectedValue span').html( + $('.details .attributes .' + cssClass + '.attribute .value select option:selected').html() + ); $('.details .attributes .' + cssClass + '.attribute .value i.fa-spin').remove(); $('.details .attributes .' + cssClass + '.attribute .value').append(' '); setTimeout(function(){ @@ -72,13 +75,4 @@ function updateDataIssue(field_name, field_value, cssClass) { var domSelectUsers = $('body').find('#usersListDropdown select'); domSelectUsers.on('change', function(e){ updateDataIssue('assigned_to_id', domSelectUsers.val(), 'assigned-to'); - }); /* end on change domSelectUsers */ - - $('.details .attributes .attribute .value').on({ - mouseenter: function () { - $(this).find('.fa-pencil').removeClass('fa-pencil').addClass('fa-angle-down'); - }, - mouseleave: function () { - $(this).find('.fa-angle-down').removeClass('fa-angle-down').addClass('fa-pencil'); - } - }); \ No newline at end of file + }); /* end on change domSelectUsers */ \ No newline at end of file diff --git a/assets/stylesheets/issue_dynamic_edit.css b/assets/stylesheets/issue_dynamic_edit.css index bcfe308..26bf5a6 100644 --- a/assets/stylesheets/issue_dynamic_edit.css +++ b/assets/stylesheets/issue_dynamic_edit.css @@ -1,3 +1,7 @@ +div.issue .attribute .value { + overflow: visible; +} + .value .dynamicEditSelect select { border-color: transparent; border: 0; @@ -10,17 +14,39 @@ font-size: inherit; color: inherit; font-family: inherit; - padding-left: 0; - padding-right: 0; + background: transparent; + padding-left:0; +} + +.value .dynamicEditSelect { + padding-left: 5px; + margin-left: -6px; /* padding + border */ + display: inline-block; + border: 1px solid transparent; + border-radius: 3px; } -.value:hover .dynamicEditSelect select { - border-color: inherit; +.value:hover .dynamicEditSelect { + border-color: #e0e2e3; } - + .value .dynamicEditSelect { position:relative; } + +.value .dynamicEditSelect .selectedValue { + position: absolute; + top: 2px; + right: 0; + left: 5px; + background: white; + pointer-events: none; + opacity: 1; +} + +.value:hover .dynamicEditSelect .selectedValue { + opacity: 0; +} .value .dynamicEditSelect i.dropdown { position:absolute; @@ -28,4 +54,14 @@ top: 50%; transform: translateY(-50%); pointer-events: none; + opacity: 0; +} + +.value:hover .dynamicEditSelect i.dropdown { + opacity: 1; +} + +.value:hover .dynamicEditSelect select option[disabled="disabled"] +{ + display:none; } \ No newline at end of file diff --git a/doc/edit.gif b/doc/edit.gif new file mode 100644 index 0000000..6a03cf7 Binary files /dev/null and b/doc/edit.gif differ diff --git a/lib/details_issue_hooks.rb b/lib/details_issue_hooks.rb index 339c124..9ff593a 100644 --- a/lib/details_issue_hooks.rb +++ b/lib/details_issue_hooks.rb @@ -25,7 +25,9 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener o = '' statuses = issue.new_statuses_allowed_to(User.current) if (!statuses.empty?) - o << "" statuses.each do |s| if (s != issue.status) o << "" @@ -33,11 +35,13 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener o << "" end end - o << "" + o << "" end assignables = project.assignable_users if (!assignables.empty?) - o << "" assignables.each do |u| if (u != issue.assigned_to) o << "" @@ -45,12 +49,14 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener o << "" end end - o << "" + o << "" end priorities = IssuePriority.all if(!priorities.empty?) - o << "" priorities.each do |p| if (p != issue.priority) o << "" @@ -58,7 +64,7 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener o << "" end end - o << "" + o << "" end end end