Fixed Redmine root url issue (#2) thanks to TrumanRu. Minor fixes

This commit is contained in:
Hugo 2017-08-19 08:57:45 +02:00
parent 4c76d18182
commit be22d52467
6 changed files with 12 additions and 5 deletions

View File

@ -92,7 +92,7 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
var token = $("meta[name=csrf-token]").attr('content'); var token = $("meta[name=csrf-token]").attr('content');
jQuery.ajax({ jQuery.ajax({
type: 'POST', type: 'POST',
url: '/issues/bulk_update?back_url=%2F&ids%5B%5D=' + _ISSUE_ID + '&issue%5B' + field_name + '%5D=' + field_value, url: _BASE_REDMINE_PATH + '/issues/bulk_update?back_url=%2F&ids%5B%5D=' + _ISSUE_ID + '&issue%5B' + field_name + '%5D=' + field_value,
data: { "authenticity_token" : token }, data: { "authenticity_token" : token },
crossDomain: true, crossDomain: true,
async: false, async: false,
@ -146,7 +146,7 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
console.log('%c error data: ', 'background: black; color: white;');; console.log('%c error data: ', 'background: black; color: white;');;
console.log(error); console.log(error);
console.log('%c ---------------------------------------------------------- ', 'background: #ff0000; color: white; font-weight:900'); console.log('%c ---------------------------------------------------------- ', 'background: #ff0000; color: white; font-weight:900');
$('.details .attributes .' + cssClass + '.attribute i.fa-spin').removeClass('fa-refresh fa-spin').addClass('fa-times').html(" Error (check console)"); $('.details .attributes .' + cssClass + '.attribute i.fa-spin').removeClass('fa-refresh fa-spin').addClass('fa-times').html(" " + _TXT_ERROR_AJAX_CALL);
setTimeout(function(){ setTimeout(function(){
$('.details .attributes .' + cssClass + '.attribute i.fa-times').remove(); $('.details .attributes .' + cssClass + '.attribute i.fa-times').remove();
}, 2000); }, 2000);

View File

@ -10,6 +10,7 @@ table.progress {
/* If you want to hide edit (pencil) icon, set opacity to 0 below : */ /* If you want to hide edit (pencil) icon, set opacity to 0 below : */
.selectedValue { .selectedValue {
position: absolute; position: absolute;
white-space: nowrap;
top: 2px; top: 2px;
right: 0; right: 0;
left: 5px; left: 5px;

View File

@ -2,4 +2,5 @@ en:
ide_txt_validation_btn : 'Validate the modification' ide_txt_validation_btn : 'Validate the modification'
ide_txt_error_positive_number : 'It must be a positive number' ide_txt_error_positive_number : 'It must be a positive number'
ide_txt_error_start_date : 'Start date must be anterior to due date' ide_txt_error_start_date : 'Start date must be anterior to due date'
ide_txt_error_due_date : 'Due date must be posterior to start date' ide_txt_error_due_date : 'Due date must be posterior to start date'
ide_txt_error_ajax_call : 'Error (check your JS console)'

View File

@ -2,4 +2,5 @@ fr:
ide_txt_validation_btn : 'Valider la modification' ide_txt_validation_btn : 'Valider la modification'
ide_txt_error_positive_number : 'Le nombre doit être positif' ide_txt_error_positive_number : 'Le nombre doit être positif'
ide_txt_error_start_date : "La date de début doit être antérieure à la date d'échéance" ide_txt_error_start_date : "La date de début doit être antérieure à la date d'échéance"
ide_txt_error_due_date : "La date d'échéance doit être postérieure à la date de début" ide_txt_error_due_date : "La date d'échéance doit être postérieure à la date de début"
ide_txt_error_ajax_call : 'Erreur (logs dans la console JS)'

View File

@ -6,7 +6,7 @@ Redmine::Plugin.register :redmine_issue_dynamic_edit do
name 'Redmine Dynamic edit Issue plugin' name 'Redmine Dynamic edit Issue plugin'
author 'Hugo Zilliox' author 'Hugo Zilliox'
description 'Allows users to dynamically update issue attributes in detailed view' description 'Allows users to dynamically update issue attributes in detailed view'
version '0.3.0' version '0.3.1'
url 'https://github.com/ilogeek/redmine_issue_dynamic_edit' url 'https://github.com/ilogeek/redmine_issue_dynamic_edit'
author_url 'https://hzilliox.fr' author_url 'https://hzilliox.fr'
end end

View File

@ -130,9 +130,13 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener
o << " var _ISSUE_ID = \"#{issue_id}\";\n" o << " var _ISSUE_ID = \"#{issue_id}\";\n"
o << " var _USER_API_KEY = \"#{User.current.api_key}\";\n" o << " var _USER_API_KEY = \"#{User.current.api_key}\";\n"
o << " var _BASE_REDMINE_PATH = \"#{Redmine::Utils.relative_url_root}\";\n"
# Translations text
o << " var _TXT_ERROR_POSITIVE_NUMBER = \"" + l(:ide_txt_error_positive_number) + "\";\n" o << " var _TXT_ERROR_POSITIVE_NUMBER = \"" + l(:ide_txt_error_positive_number) + "\";\n"
o << " var _TXT_ERROR_START_DATE = \"" + l(:ide_txt_error_start_date) + "\";\n" o << " var _TXT_ERROR_START_DATE = \"" + l(:ide_txt_error_start_date) + "\";\n"
o << " var _TXT_ERROR_DUE_DATE = \"" + l(:ide_txt_error_due_date) + "\";\n" o << " var _TXT_ERROR_DUE_DATE = \"" + l(:ide_txt_error_due_date) + "\";\n"
o << " var _TXT_ERROR_AJAX_CALL = \"" + l(:ide_txt_error_ajax_call) + "\";\n"
o << "</script>" o << "</script>"
return o return o