version field with checkbox display support added (#24)

This commit is contained in:
Hugo 2018-07-13 23:39:17 +02:00
parent 9b22ff1a3b
commit e6cedf5965
5 changed files with 26 additions and 8 deletions

View File

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

View File

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

View File

@ -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 = "<span class='dynamicEdit' id='dynamic_edit_cf_" + info.id + "'>";
var editHTML = "<span class='dynamicEdit " + info.field_format + "' id='dynamic_edit_cf_" + info.id + "'>";
editHTML += htmlCopy;
editHTML += " <a href='#' class='btn btn-primary validate' aria-label='" + _TXT_VALIDATION_BTN + "'><i class='fa fa-check fa-fw' aria-hidden='true'></i></a>";
editHTML += " <a href='#' class='btn btn-primary close' aria-label='" + _TXT_CANCEL_BTN + "'><i class='fa fa-times fa-fw' aria-hidden='true'></i></a>";
@ -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)

View File

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

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