Checkboxes custom fields fixed (#53)
This commit is contained in:
parent
06fe6256c2
commit
925895b514
@ -35,6 +35,7 @@ This plugin uses [FontAwesome icons](http://fontawesome.io/)
|
||||
|
||||
### 🆕 Changelog
|
||||
|
||||
* **v 0.6.8** : Checkboxes custom fields fixed (#53)
|
||||
* **v 0.6.7** : fixed Github issue #46 : text field focus issue
|
||||
* **v 0.6.6** : New configuration file + Multiple fixes (#30 #31 #35 #36 #37 #38 #41)
|
||||
* **v 0.6.5** : Checklists plugin support (and all other plugins that compute fields when there's an issue update) (Github requests #26 and #28) + custom url support (Github request #29)
|
||||
|
||||
@ -183,11 +183,16 @@ function initEditFields() {
|
||||
if (info.visible && info.editable && !isExcluded("issue_custom_field_values_" + info.id)) {
|
||||
if (
|
||||
$('.details .attributes .cf_' + info.id + '.attribute .value').length &&
|
||||
$('#issue_custom_field_values_' + info.id).length
|
||||
(
|
||||
$('#issue_custom_field_values_' + info.id).length ||
|
||||
$('input[name=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();
|
||||
// if single input first case, else checkboxes second case
|
||||
if($('#issue_custom_field_values_' + info.id).length) {
|
||||
var htmlCopy = $('#issue_custom_field_values_' + info.id).get(0).outerHTML;
|
||||
} else {
|
||||
var htmlCopy = $('input[name=issue\\[custom_field_values\\]\\[' + info.id + '\\]\\[\\]]').parents('.check_box_group').get(0).outerHTML;
|
||||
}
|
||||
|
||||
// 2 technics with simple or double quote (safety first)
|
||||
@ -309,7 +314,18 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass) {
|
||||
// avoid conflict revision
|
||||
var lastLockVersion = getLastLockVersion();
|
||||
$('#issue_lock_version').val(lastLockVersion);
|
||||
var formData = $('#issue-form').serialize();
|
||||
var formData = "";
|
||||
|
||||
// If checkbox we have to uncheck everything in the issue-form and get data from dynamic edit
|
||||
if(type == "checkbox"){
|
||||
formData = field_value + "&";
|
||||
var cf_id = field_name.replace(/\D/g,'');
|
||||
$('input[name=issue\\[custom_field_values\\]\\[' + cf_id + '\\]\\[\\]]').each(function(){
|
||||
$(this).prop('checked', false);
|
||||
});
|
||||
}
|
||||
|
||||
formData += $('#issue-form').serialize();
|
||||
|
||||
|
||||
jQuery.ajax({
|
||||
@ -597,18 +613,20 @@ 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();
|
||||
});
|
||||
if(info.format_store.edit_tag_style == "check_box"){
|
||||
inputType = "checkbox";
|
||||
}
|
||||
|
||||
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) {
|
||||
var new_value = domInputField.val();
|
||||
|
||||
// Specific case with checkboxes
|
||||
if(typeof new_value === 'undefined'){
|
||||
var new_value = $('body').find('#dynamic_edit_cf_' + info.id + " :input").serialize();
|
||||
console.log(new_value);
|
||||
}
|
||||
|
||||
issueDynamicUpdate('custom_field_values_' + info.id , new_value, inputType, 'cf_' + info.id);
|
||||
|
||||
return false;
|
||||
|
||||
@ -109,4 +109,9 @@ div.issue div.subject h3 {
|
||||
|
||||
body.controller-issues.action-show .dynamicEdit input[type="text"] {
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
body.controller-issues.action-show .dynamicEdit .check_box_group {
|
||||
border: 0px !important;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
2
init.rb
2
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.7'
|
||||
version '0.6.8'
|
||||
url 'https://github.com/ilogeek/redmine_issue_dynamic_edit'
|
||||
author_url 'https://hzilliox.fr'
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user