From be22d524675d40147576d4ad07cebf2efdb8bda0 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 19 Aug 2017 08:57:45 +0200 Subject: [PATCH] Fixed Redmine root url issue (#2) thanks to TrumanRu. Minor fixes --- assets/javascripts/issue_dynamic_edit.js | 4 ++-- assets/stylesheets/issue_dynamic_edit.css | 1 + config/locales/en.yml | 3 ++- config/locales/fr.yml | 3 ++- init.rb | 2 +- lib/details_issue_hooks.rb | 4 ++++ 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/assets/javascripts/issue_dynamic_edit.js b/assets/javascripts/issue_dynamic_edit.js index b41b654..2325da6 100644 --- a/assets/javascripts/issue_dynamic_edit.js +++ b/assets/javascripts/issue_dynamic_edit.js @@ -92,7 +92,7 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){ var token = $("meta[name=csrf-token]").attr('content'); jQuery.ajax({ 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 }, crossDomain: true, 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(error); 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(){ $('.details .attributes .' + cssClass + '.attribute i.fa-times').remove(); }, 2000); diff --git a/assets/stylesheets/issue_dynamic_edit.css b/assets/stylesheets/issue_dynamic_edit.css index 59ac680..79ccce8 100644 --- a/assets/stylesheets/issue_dynamic_edit.css +++ b/assets/stylesheets/issue_dynamic_edit.css @@ -10,6 +10,7 @@ table.progress { /* If you want to hide edit (pencil) icon, set opacity to 0 below : */ .selectedValue { position: absolute; + white-space: nowrap; top: 2px; right: 0; left: 5px; diff --git a/config/locales/en.yml b/config/locales/en.yml index 95aeab2..61b16c4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2,4 +2,5 @@ en: ide_txt_validation_btn : 'Validate the modification' 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_due_date : 'Due date must be posterior to start date' \ No newline at end of file + ide_txt_error_due_date : 'Due date must be posterior to start date' + ide_txt_error_ajax_call : 'Error (check your JS console)' \ No newline at end of file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 333dc65..8926aa0 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -2,4 +2,5 @@ fr: ide_txt_validation_btn : 'Valider la modification' 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_due_date : "La date d'échéance doit être postérieure à la date de début" \ No newline at end of file + 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)' \ No newline at end of file diff --git a/init.rb b/init.rb index 43cc11a..89641e7 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' - version '0.3.0' + version '0.3.1' url 'https://github.com/ilogeek/redmine_issue_dynamic_edit' author_url 'https://hzilliox.fr' end diff --git a/lib/details_issue_hooks.rb b/lib/details_issue_hooks.rb index 0c4c96c..a64548d 100644 --- a/lib/details_issue_hooks.rb +++ b/lib/details_issue_hooks.rb @@ -130,9 +130,13 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener o << " var _ISSUE_ID = \"#{issue_id}\";\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_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_AJAX_CALL = \"" + l(:ide_txt_error_ajax_call) + "\";\n" o << "" return o