From e6cedf59653b3e4200f8bcfafe0059cc81b91203 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 13 Jul 2018 23:39:17 +0200 Subject: [PATCH] version field with checkbox display support added (#24) --- README.md | 7 ++++--- README.rdoc | 2 +- assets/javascripts/issue_dynamic_edit.js | 19 ++++++++++++++++--- assets/stylesheets/issue_dynamic_edit.css | 4 ++++ init.rb | 2 +- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 48ccca3..101bf35 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ Add new elements on detailed issue page to **dynamically update issue's attribut ### 🔴 What info you should provide when opening an issue ->This plugin use JS a lot. Could you then please check your JS console from your web browser ( [HowTo](https://webmasters.stackexchange.com/a/77337) ) and try again your issue. You'll see some information about what goes wrong. +>This plugin use JS a lot. Check your JS console from your web browser ( [HowTo](https://webmasters.stackexchange.com/a/77337) ) and try again to reproduce your issue. You'll see some information about what goes wrong. > ->Could you copy / paste it in your issue and expand all possible object (error data for example) so we can look if there's a problem with the ajax call the plugin performs to update the issue or if there's any JS error. +>Copy and paste the result that appears in your console in the Github issue and expand all possible object (error data for example). With this data, we can look if there's a problem with the ajax call the plugin performs to update the issue or if there's any JS error. ### Example @@ -25,10 +25,11 @@ This plugin uses [FontAwesome icons](http://fontawesome.io/) ### Changelog +* **v.0.6.4** : version field with checkbox display is now supported (Github request #24) * **v 0.6.3** : fixed Github issue #22 : DatepickerFallback raised an error * **v 0.6.2** : fixed Github issue #22 : long description is now supported (no more 414 errors) * **v 0.6.1** : fixed Github issue #20 -* **v 0.6.0** : NOW WITH CUSTOM FIELDS SUPPORT ! (Github #19) +* **v 0.6.0** : **NOW WITH CUSTOM FIELDS SUPPORT** ! (Github #19) * **v 0.5.0** : fixed Github issue #18 : textarea fixed (jstoolbar or ckeditor) * **v 0.4.9** : fixed Github issue #17 : Datepicker fallback added for date fields * **v 0.4.8** : fixed Github issues #15 and #16 diff --git a/README.rdoc b/README.rdoc index 2b8aaaa..590f573 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,3 +1,3 @@ = 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. +Add new dropdown elements on detailed issue page to dynamically update issue's status, assignee, priority, start and due dates, ratio, estimated time and custom fields, directly in the details block of the issue without any page refresh. diff --git a/assets/javascripts/issue_dynamic_edit.js b/assets/javascripts/issue_dynamic_edit.js index 676dd95..4030ad3 100644 --- a/assets/javascripts/issue_dynamic_edit.js +++ b/assets/javascripts/issue_dynamic_edit.js @@ -102,11 +102,15 @@ function initEditFields() && $('#issue_custom_field_values_' + info.id).length ) { var htmlCopy = $('#issue_custom_field_values_' + info.id).get(0).outerHTML; + if(info.field_format == "version" && info.format_store.edit_tag_style == "check_box") + { + htmlCopy = $('#issue_custom_field_values_' + info.id).parents('span').html(); + } // 2 technics with simple or double quote (safety first) - htmlCopy = htmlCopy.replace('id="', 'id="dynamic_').replace("id='", "id='dynamic_"); - htmlCopy = htmlCopy.replace('class="', 'class="cf_' + info.id + ' ').replace("class='", "class='cf_" + info.id + " "); + htmlCopy = htmlCopy.replace(/id="/g, 'id="dynamic_').replace(/id='/g, "id='dynamic_"); + htmlCopy = htmlCopy.replace(/class="/g, 'class="cf_' + info.id + ' ').replace(/class='/g, "class='cf_" + info.id + " "); - var editHTML = ""; + var editHTML = ""; editHTML += htmlCopy; editHTML += " "; editHTML += " "; @@ -457,6 +461,15 @@ function initEditFieldListeners() break; } + + // Specific case : version field with checkboxes + if(info.field_format == "version" && info.format_store.edit_tag_style == "check_box") + { + inputType = "version"; + $('body').find('#dynamic_edit_cf_' + info.id + ' input').on('click', function(e){ + $('label[for=issue_custom_field_values_' + info.id + ']').next().find('input[value=' + $(this).val() + ']').click(); + }); + } var domInputField = $('body').find('#dynamic_issue_custom_field_values_' + info.id); $('body').find('#dynamic_edit_cf_' + info.id + ' a.btn.validate').on('click', function(e) diff --git a/assets/stylesheets/issue_dynamic_edit.css b/assets/stylesheets/issue_dynamic_edit.css index 9ef5286..b796f6f 100644 --- a/assets/stylesheets/issue_dynamic_edit.css +++ b/assets/stylesheets/issue_dynamic_edit.css @@ -47,6 +47,10 @@ body.controller-issues.action-show .dynamicEdit { width: max-content; } +body.controller-issues.action-show .dynamicEdit.version { + max-width: 100%; +} + body.controller-issues.action-show .edited .dynamicEdit { pointer-events: auto; } diff --git a/init.rb b/init.rb index 6f90a0e..d6dfa93 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.6.3' + version '0.6.4' url 'https://github.com/ilogeek/redmine_issue_dynamic_edit' author_url 'https://hzilliox.fr' end