From c08cd4a8f8b24573305c7f2a6fba25db9f2e1a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Fri, 19 Apr 2024 09:49:54 +0200 Subject: [PATCH] Nova verze checklistu --- .gitlab-ci.yml | 2 +- plugins/redmine_checklists/Gemfile | 2 +- .../app/controllers/checklists_controller.rb | 3 +- .../app/helpers/checklists_helper.rb | 4 +- .../app/models/checklist.rb | 30 +- .../app/models/journal_checklist_history.rb | 2 +- .../views/checklists/_checklist_item.html.erb | 2 +- .../app/views/checklists/index.api.rsb | 1 + .../app/views/checklists/show.api.rsb | 1 + .../app/views/issues/_checklist.html.erb | 1 - .../views/issues/_checklist_fields.html.erb | 2 +- .../app/views/issues/_checklist_form.html.erb | 4 +- .../assets/javascripts/checklists.js | 4 +- .../assets/stylesheets/checklists.css | 1 + .../redmine_checklists/config/locales/de.yml | 83 +++--- .../redmine_checklists/config/locales/fr.yml | 53 +++- .../redmine_checklists/config/locales/hu.yml | 47 +++ .../redmine_checklists/config/locales/ko.yml | 20 +- .../redmine_checklists/config/locales/nl.yml | 44 +++ .../redmine_checklists/config/locales/tr.yml | 44 +++ .../config/locales/zh-TW.yml | 32 +- plugins/redmine_checklists/config/routes.rb | 2 +- .../db/migrate/001_create_checklists.rb | 4 +- .../002_add_time_stamps_to_checklists.rb | 4 +- .../003_create_checklist_template_category.rb | 4 +- .../migrate/004_create_checklist_templates.rb | 4 +- .../005_modify_checklist_subject_length.rb | 4 +- .../006_add_fields_to_checklist_template.rb | 4 +- .../007_add_is_section_to_checklists.rb | 2 +- plugins/redmine_checklists/doc/CHANGELOG | 28 +- plugins/redmine_checklists/init.rb | 16 +- .../redmine_checklists.rb | 35 ++- .../hooks/controller_issues_hook.rb | 2 +- .../hooks/views_issues_hook.rb | 2 +- .../hooks/views_layouts_hook.rb | 2 +- .../2.1/redmine_api_test_patch.rb | 275 ------------------ .../compatibility/application_helper_patch.rb | 4 +- .../patches/compatibility/journal_patch.rb | 74 ----- .../compatibility/open_struct_patch.rb | 2 +- .../patches/compatibility_patch.rb | 22 -- ...atch.rb => helper_for_checklists_patch.rb} | 7 +- .../redmine_checklists/patches/issue_patch.rb | 21 +- .../patches/issue_query_patch.rb | 2 +- .../patches/issues_controller_patch.rb | 5 +- .../patches/issues_helper_patch.rb | 4 +- .../patches/notifiable_patch.rb | 2 +- .../patches/project_patch.rb | 3 +- .../functional/checklists_controller_test.rb | 2 +- .../test/functional/issues_controller_test.rb | 24 +- .../integration/api_test/checklists_test.rb | 34 ++- .../test/integration/common_issue_test.rb | 2 +- .../redmine_checklists/test/test_helper.rb | 14 +- .../test/unit/checklist_test.rb | 2 +- .../test/unit/issue_test.rb | 2 +- .../test/unit/project_test.rb | 2 +- 55 files changed, 427 insertions(+), 571 deletions(-) mode change 100644 => 100755 plugins/redmine_checklists/config/locales/fr.yml create mode 100644 plugins/redmine_checklists/config/locales/hu.yml create mode 100644 plugins/redmine_checklists/config/locales/nl.yml create mode 100644 plugins/redmine_checklists/config/locales/tr.yml rename plugins/redmine_checklists/lib/{redmine_checklists => }/redmine_checklists.rb (57%) delete mode 100644 plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/2.1/redmine_api_test_patch.rb delete mode 100644 plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/journal_patch.rb delete mode 100644 plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility_patch.rb rename plugins/redmine_checklists/lib/redmine_checklists/patches/{add_helpers_for_checklists_patch.rb => helper_for_checklists_patch.rb} (86%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0b97cb9..422d2fe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ image: docker:stable variables: DOCKER_TLS_CERTDIR: "/certs" - IMAGE_VER: 4.2.10-passenger-1 + IMAGE_VER: 4.2.10-passenger-2 services: - docker:dind diff --git a/plugins/redmine_checklists/Gemfile b/plugins/redmine_checklists/Gemfile index c6b5df6..ffc40a3 100644 --- a/plugins/redmine_checklists/Gemfile +++ b/plugins/redmine_checklists/Gemfile @@ -1 +1 @@ -gem 'redmine_crm' +gem 'redmineup' diff --git a/plugins/redmine_checklists/app/controllers/checklists_controller.rb b/plugins/redmine_checklists/app/controllers/checklists_controller.rb index e760c09..fc65f24 100644 --- a/plugins/redmine_checklists/app/controllers/checklists_controller.rb +++ b/plugins/redmine_checklists/app/controllers/checklists_controller.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -18,7 +18,6 @@ # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. class ChecklistsController < ApplicationController - unloadable before_action :find_checklist_item, :except => [:index, :create] before_action :find_issue_by_id, :only => [:index, :create] diff --git a/plugins/redmine_checklists/app/helpers/checklists_helper.rb b/plugins/redmine_checklists/app/helpers/checklists_helper.rb index 16c73cb..cb5dfe7 100644 --- a/plugins/redmine_checklists/app/helpers/checklists_helper.rb +++ b/plugins/redmine_checklists/app/helpers/checklists_helper.rb @@ -3,7 +3,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -29,7 +29,7 @@ module ChecklistsHelper @new_object ||= f.object.class.reflect_on_association(association).klass.new end - def fields(f, association) + def checklist_fields(f, association) @fields ||= f.fields_for(association, new_object(f, association), :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end diff --git a/plugins/redmine_checklists/app/models/checklist.rb b/plugins/redmine_checklists/app/models/checklist.rb index 97b964a..3c61da9 100644 --- a/plugins/redmine_checklists/app/models/checklist.rb +++ b/plugins/redmine_checklists/app/models/checklist.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -18,13 +18,11 @@ # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. class Checklist < ActiveRecord::Base - unloadable + include Redmine::SafeAttributes belongs_to :issue belongs_to :author, :class_name => "User", :foreign_key => "author_id" - attr_protected :id if ActiveRecord::VERSION::MAJOR <= 4 - acts_as_event :datetime => :created_at, :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue_id}}, :type => 'issue issue-closed', @@ -32,25 +30,15 @@ class Checklist < ActiveRecord::Base :description => Proc.new {|o| "#{l(:field_issue)}: #{o.issue.subject}" } - if ActiveRecord::VERSION::MAJOR >= 4 - acts_as_activity_provider :type => "checklists", - :permission => :view_checklists, - :scope => preload({:issue => :project}) - acts_as_searchable :columns => ["#{table_name}.subject"], - :scope => lambda { includes([:issue => :project]).order("#{table_name}.id") }, - :project_key => "#{Issue.table_name}.project_id" + acts_as_activity_provider :type => "checklists", + :permission => :view_checklists, + :scope => preload({:issue => :project}) + acts_as_searchable :columns => ["#{table_name}.subject"], + :scope => lambda { includes([:issue => :project]).order("#{table_name}.id") }, + :project_key => "#{Issue.table_name}.project_id" - else - acts_as_activity_provider :type => "checklists", - :permission => :view_checklists, - :find_options => {:issue => :project} - acts_as_searchable :columns => ["#{table_name}.subject"], - :include => [:issue => :project], - :project_key => "#{Issue.table_name}.project_id", - :order_column => "#{table_name}.id" - end - rcrm_acts_as_list + up_acts_as_list scope: :issue validates_presence_of :subject validates_length_of :subject, maximum: 512 diff --git a/plugins/redmine_checklists/app/models/journal_checklist_history.rb b/plugins/redmine_checklists/app/models/journal_checklist_history.rb index 76278ff..a82d84d 100644 --- a/plugins/redmine_checklists/app/models/journal_checklist_history.rb +++ b/plugins/redmine_checklists/app/models/journal_checklist_history.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/app/views/checklists/_checklist_item.html.erb b/plugins/redmine_checklists/app/views/checklists/_checklist_item.html.erb index 0855cdb..186d6bd 100644 --- a/plugins/redmine_checklists/app/views/checklists/_checklist_item.html.erb +++ b/plugins/redmine_checklists/app/views/checklists/_checklist_item.html.erb @@ -7,5 +7,5 @@ id: "checklist-checkbox-#{checklist_item.id}" %> <% end %> - <%= textilizable(checklist_item, :subject).gsub(/<\/?(p|h\d+|li|ul)>/, '').strip.html_safe %> + <%= textilizable(checklist_item, :subject).gsub(/<\/?(p|h\d+|li|ul|hr \/)>/, '').strip.html_safe %> </li> diff --git a/plugins/redmine_checklists/app/views/checklists/index.api.rsb b/plugins/redmine_checklists/app/views/checklists/index.api.rsb index 4d1411a..4dff4f0 100644 --- a/plugins/redmine_checklists/app/views/checklists/index.api.rsb +++ b/plugins/redmine_checklists/app/views/checklists/index.api.rsb @@ -6,6 +6,7 @@ api.array :checklists, api_meta(:total_count => @checklists.size) do api.subject checklist.subject api.is_done checklist.is_done api.position checklist.position + api.is_section checklist.is_section api.created_at checklist.created_at api.updated_at checklist.updated_at diff --git a/plugins/redmine_checklists/app/views/checklists/show.api.rsb b/plugins/redmine_checklists/app/views/checklists/show.api.rsb index 083b463..37987b2 100644 --- a/plugins/redmine_checklists/app/views/checklists/show.api.rsb +++ b/plugins/redmine_checklists/app/views/checklists/show.api.rsb @@ -4,6 +4,7 @@ api.checklist do api.subject @checklist_item.subject api.is_done @checklist_item.is_done api.position @checklist_item.position + api.is_section @checklist_item.is_section api.created_at @checklist_item.created_at api.updated_at @checklist_item.updated_at diff --git a/plugins/redmine_checklists/app/views/issues/_checklist.html.erb b/plugins/redmine_checklists/app/views/issues/_checklist.html.erb index 9ef810f..8205892 100644 --- a/plugins/redmine_checklists/app/views/issues/_checklist.html.erb +++ b/plugins/redmine_checklists/app/views/issues/_checklist.html.erb @@ -9,7 +9,6 @@ <ul id="checklist_items"> <% @issue.checklists.each do |checklist_item| %> <%= render :partial => 'checklists/checklist_item', :object => checklist_item %> - <% end %> </ul> </div> diff --git a/plugins/redmine_checklists/app/views/issues/_checklist_fields.html.erb b/plugins/redmine_checklists/app/views/issues/_checklist_fields.html.erb index f0daba9..ec1a0d4 100644 --- a/plugins/redmine_checklists/app/views/issues/_checklist_fields.html.erb +++ b/plugins/redmine_checklists/app/views/issues/_checklist_fields.html.erb @@ -4,7 +4,7 @@ <% end %> <span class="checklist-show checklist-subject <%= done_css(f) %>"> - <%= textilizable(f.object, :subject).gsub(/<\/?(p|h\d+|li|ul)>/, '').strip.html_safe %> + <%= f.object.subject.to_s.strip.html_safe %> </span> <span class="checklist-edit checklist-new checklist-edit-box"> diff --git a/plugins/redmine_checklists/app/views/issues/_checklist_form.html.erb b/plugins/redmine_checklists/app/views/issues/_checklist_form.html.erb index 0b5ab22..de1c0b2 100644 --- a/plugins/redmine_checklists/app/views/issues/_checklist_form.html.erb +++ b/plugins/redmine_checklists/app/views/issues/_checklist_form.html.erb @@ -3,8 +3,8 @@ <p id="checklist_form"> <label><%=l(:label_checklist_plural)%></label> <% @issue.checklists.build if @issue.checklists.blank? || @issue.checklists.last.subject.present? %> - <%= fields_for :issue, issue do |f| -%> - <span id="checklist_form_items" data-checklist-fields='<%= fields(f, :checklists) %>'> + <%= fields_for @issue do |f| -%> + <span id="checklist_form_items" data-checklist-fields='<%= checklist_fields(f, :checklists) %>'> <%= f.fields_for :checklists do |builder| %> <%= render :partial => 'checklist_fields', :locals => {:f => builder, :checklist => @checklist} %> <% end %> diff --git a/plugins/redmine_checklists/assets/javascripts/checklists.js b/plugins/redmine_checklists/assets/javascripts/checklists.js index 828ac52..84ad103 100644 --- a/plugins/redmine_checklists/assets/javascripts/checklists.js +++ b/plugins/redmine_checklists/assets/javascripts/checklists.js @@ -357,11 +357,11 @@ Redmine.Checklist = $.klass({ }, enableUniquenessValidation: function() { - this.root.on('keyup', 'input.edit-box', $.proxy(function(event) { + this.root.on('input', 'input.edit-box', $.proxy(function(event) { value = $(event.target).val() span = this.findSpan(event) span.removeClass('invalid') - $('.checklist-item').each(function(i, elem) { + $('.checklist-item.existing').each(function(i, elem) { e = $(elem) if (!e.is('.edit') && !e.is('.new')) { diff --git a/plugins/redmine_checklists/assets/stylesheets/checklists.css b/plugins/redmine_checklists/assets/stylesheets/checklists.css index a254bda..649a8f9 100644 --- a/plugins/redmine_checklists/assets/stylesheets/checklists.css +++ b/plugins/redmine_checklists/assets/stylesheets/checklists.css @@ -127,6 +127,7 @@ table.list td.checklist_relations { text-align: left } list-style: none; padding: 2px; border-radius: 2px; + z-index: 10; } #checklist-menu li { diff --git a/plugins/redmine_checklists/config/locales/de.yml b/plugins/redmine_checklists/config/locales/de.yml index ac85201..6216dd9 100644 --- a/plugins/redmine_checklists/config/locales/de.yml +++ b/plugins/redmine_checklists/config/locales/de.yml @@ -1,39 +1,44 @@ -# encoding: utf-8 -# German strings go here for Rails i18n -de: - label_checklist_plural: Checkliste - field_checklist: Checkliste - label_checklist_save_log: "Speichere Änderungen in der Ticket-Historie" - label_checklist_done_ratio: Aktualisiere den Ticket-Fortschritt - permission_view_checklists: Checkliste anzeigen - permission_done_checklists: Checkliste anwenden - permission_edit_checklists: Checkliste bearbeiten - label_checklist_template_category_plural: Kategorien - label_checklist_template_category_new: Neue Kategorie - field_checklist_template_category: Kategorie - label_checklist_templates: Checklisten-Vorlagen - label_checklist_new_checklist_template: Neue Checklisten-Vorlage - field_template_items: "Einträge" - label_checklist_template: Checklisten-Vorlage - label_add_checklists_from_template: "Aus Vorlage wählen" - label_select_template: "-- Vorlage auswählen --" - label_checklist_category_not_specified: "-- Nicht spezifiziert --" - label_checklists_description: 'Mehrere Einträge erlaubt (ein Eintrag pro Zeile)' - label_checklist_item: Checklisten-Eintrag - label_checklist_deleted: gelöscht - label_checklist_changed_from: geändert von - label_checklist_changed_to: zu - label_checklist_added: hinzugefügt - label_checklist_done: als Erledigt markiert - label_checklist_undone: als Nicht erledigt markiert - label_checklist_updated: Checklisten-Eintrag editiert - label_checklist_status: Checklisten-Status - label_checklist_status_done: Erledigt - label_checklist_status_undone: Nicht erledigt - label_checklist_is_default: Standard - field_is_for_tracker: Tracker - label_checklists_must_be_completed: "Alle Checklisten-Einträge eines Tickets müssen vor dem Schließen erledigt werden." - label_checklist_block_issue_closing: "Schließen des Tickets blockieren" - label_checklist_show_closed: Zeige alle - label_checklist_hide_closed: Verberge geschlossene - label_checklist_new_section: Neue Unterteilung +# Deutsche Übersetzungen für Rails i18n +de: + activerecord: + attributes: + checklists: + subject: Checklisten-Thema + label_checklist_plural: Checklist + field_checklist: Checklist + label_checklist_save_log: Änderungen im Problem-Log speichern + label_checklist_done_ratio: Fortschritt des Problems festlegen + permission_view_checklists: Checklist anzeigen + permission_done_checklists: Erledigte Checklistenelemente + permission_edit_checklists: Checklistenelemente bearbeiten + label_checklist_template_category_plural: Vorlagenkategorien + label_checklist_template_category_new: Neue Checklistenvorlage + field_checklist_template_category: Vorlagenelemente + label_checklist_templates: Checklistenvorlagen + label_checklist_new_checklist_template: Neue Checklistenvorlage + field_template_items: Vorlagenelemente + label_checklist_template: Checklistenvorlage + label_add_checklists_from_template: Von Vorlage hinzufügen + label_checklists_from_template: Von Vorlage + label_select_template: "-- Nicht angegeben --" + label_checklist_category_not_specified: "-- Nicht spezifiziert --" + label_checklists_description: Mehrere Werte erlaubt (eine Zeile für jeden Wert) + label_checklist_item: Checklistenelement + label_checklist_section: Checklistensektion + label_checklist_deleted: gelöscht + label_checklist_changed_from: geändert von + label_checklist_changed_to: zu + label_checklist_added: hinzugefügt + label_checklist_done: auf Erledigt gesetzt + label_checklist_undone: auf Nicht erledigt gesetzt + label_checklist_updated: Checklistenelement bearbeitet + label_checklist_status: Checklistestatus + label_checklist_status_done: Erledigt + label_checklist_status_undone: Nicht erledigt + label_checklist_is_default: Standardmäßig + field_is_for_tracker: Tracker + label_checklists_must_be_completed: Alle Checklisten eines Problems müssen erledigt sein, bevor es geschlossen werden kann + label_checklist_block_issue_closing: Problemabschluss blockieren + label_checklist_show_closed: Geschlossene anzeigen + label_checklist_hide_closed: Geschlossene ausblenden + label_checklist_new_section: Neue Sektion diff --git a/plugins/redmine_checklists/config/locales/fr.yml b/plugins/redmine_checklists/config/locales/fr.yml old mode 100644 new mode 100755 index 5c1fe44..339ca02 --- a/plugins/redmine_checklists/config/locales/fr.yml +++ b/plugins/redmine_checklists/config/locales/fr.yml @@ -1,9 +1,44 @@ -# encoding: utf-8 -fr: - label_checklist_plural: Liste de Tâches - field_checklist: Tâche - label_checklist_templates: Template de checklists - label_checklist_new_checklist_template: Ajouter un template - field_is_for_tracker: - label_checklist_is_default: Checklist par d faut - field_template_items: Eléments +# Traductions en français pour Rails i18n +fr: + activerecord: + attributes: + checklists: + subject: Sujet de la checklist + label_checklist_plural: Checklist + field_checklist: Checklist + label_checklist_save_log: Enregistrer les modifications dans le journal des problèmes + label_checklist_done_ratio: Définir le taux d'avancement du problème + permission_view_checklists: Voir la checklist + permission_done_checklists: Éléments de la checklist terminés + permission_edit_checklists: Modifier les éléments de la checklist + label_checklist_template_category_plural: Catégories de modèles + label_checklist_template_category_new: Nouvelle catégorie + field_checklist_template_category: Catégorie + label_checklist_templates: Modèles de checklist + label_checklist_new_checklist_template: Nouveau modèle de checklist + field_template_items: Éléments de modèle + label_checklist_template: Modèle de checklist + label_add_checklists_from_template: Ajouter à partir du modèle + label_checklists_from_template: À partir du modèle + label_select_template: "-- Sélectionner un modèle --" + label_checklist_category_not_specified: "-- Non spécifié --" + label_checklists_description: 'Plusieurs valeurs autorisées (une ligne pour chaque valeur)' + label_checklist_item: Élément de checklist + label_checklist_section: Section de checklist + label_checklist_deleted: supprimé + label_checklist_changed_from: changé de + label_checklist_changed_to: à + label_checklist_added: ajouté + label_checklist_done: défini comme Terminé + label_checklist_undone: défini comme Non terminé + label_checklist_updated: Élément de checklist modifié + label_checklist_status: Statut de la checklist + label_checklist_status_done: Terminé + label_checklist_status_undone: Non terminé + label_checklist_is_default: Par défaut + field_is_for_tracker: Tracker + label_checklists_must_be_completed: Toutes les checklists d'un problème doivent être terminées avant la clôture + label_checklist_block_issue_closing: Bloquer la clôture du problème + label_checklist_show_closed: Afficher les éléments clos + label_checklist_hide_closed: Masquer les éléments clos + label_checklist_new_section: Nouvelle section diff --git a/plugins/redmine_checklists/config/locales/hu.yml b/plugins/redmine_checklists/config/locales/hu.yml new file mode 100644 index 0000000..917ce27 --- /dev/null +++ b/plugins/redmine_checklists/config/locales/hu.yml @@ -0,0 +1,47 @@ +# Hungarian translations for redmine_checklists +# by Lilla Basilides basilides.h.lilla@gmail.com) +# Hungarian strings go here for Rails i18n +hu: + activerecord: + attributes: + checklists: + subject: EllenÅ‘rzÅ‘ lista tárgya + label_checklist_plural: EllenÅ‘rzÅ‘ lista + field_checklist: EllenÅ‘rzÅ‘ lista + label_checklist_save_log: Változások mentése a jegy naplójába + label_checklist_done_ratio: ÃllÃtsa be az elkészült jegyek arányát + permission_view_checklists: EllenÅ‘rzÅ‘ lista megtekintése + permission_done_checklists: Elkészült ellenÅ‘rzÅ‘lista elemek + permission_edit_checklists: EllenÅ‘rzÅ‘lista elemeinek szerkesztése + label_checklist_template_category_plural: Sablon kategóriák + label_checklist_template_category_new: Új kategória + field_checklist_template_category: Kategória + label_checklist_templates: EllenÅ‘rzÅ‘lista sablonok + label_checklist_new_checklist_template: Új ellenÅ‘rzÅ‘lista sablon + field_template_items: Sablon elemek + label_checklist_template: EllenÅ‘rzÅ‘lista sablon + label_add_checklists_from_template: Hozzáadás sablonból + label_checklists_from_template: A sablonból + label_select_template: "-- Sablon kiválasztása --" + label_checklist_category_not_specified: "-- Nincs meghatározva --" + label_checklists_description: 'Több érték megengedett (értékenként egy sor)' + label_checklist_item: EllenÅ‘rzÅ‘lista elem + label_checklist_section: EllenÅ‘rzÅ‘lista szakasz + label_checklist_deleted: törölve + label_checklist_changed_from: változott a következÅ‘bÅ‘l + label_checklist_changed_to: a cÃmre + label_checklist_added: hozzáadva + label_checklist_done: készre állÃtva + label_checklist_undone: Nem készre állÃtva + label_checklist_updated: Szerkesztett ellenÅ‘rzÅ‘lista elem + label_checklist_status: EllenÅ‘rzÅ‘lista állapota + label_checklist_status_done: Elkészült + label_checklist_status_undone: visszavonva + label_checklist_is_default: Alapértelmezett + field_is_for_tracker: NyomkövetÅ‘ + label_checklists_must_be_completed: A jegy összes ellenÅ‘rzÅ‘ listáját el kell végezni a lezárás elÅ‘tt. + label_checklist_block_issue_closing: Blokkjegy zárás + label_checklist_show_closed: Mutasd a zártakat + label_checklist_hide_closed: Rejtsd el zártakat + label_checklist_new_section: Új szakasz + \ No newline at end of file diff --git a/plugins/redmine_checklists/config/locales/ko.yml b/plugins/redmine_checklists/config/locales/ko.yml index 24ede9a..aaa94ab 100644 --- a/plugins/redmine_checklists/config/locales/ko.yml +++ b/plugins/redmine_checklists/config/locales/ko.yml @@ -1,9 +1,11 @@ -# Translation by Ki Won Kim (http://x10.iptime.org/redmine, http://xyz37.blog.me, xyz37@naver.com) -ko: - label_checklist_plural: "ì²´í¬ë¦¬ìŠ¤íŠ¸" - field_checklist: "ì²´í¬ë¦¬ìŠ¤íŠ¸" - label_checklist_save_log: "ì¼ê° ë¡œê·¸ì— ë³€ê²½ì‚¬í•ì„ ì €ìž¥í•©ë‹ˆë‹¤." - label_checklist_done_ratio: "완료 비율 ì¼ê° ì„¤ì •" - permission_view_checklists: "ì²´í¬ë¦¬ìŠ¤íŠ¸ 보기" - permission_done_checklists: "ì²´í¬ë¦¬ìŠ¤íŠ¸ 완료" - permission_edit_checklists: "ì²´í¬ë¦¬ìŠ¤íŠ¸ ìˆ˜ì •" +# Translation by Ki Won Kim (http://x10.iptime.org/redmine, http://xyz37.blog.me, xyz37@naver.com) +ko: + label_checklist_plural: "ì²´í¬ë¦¬ìŠ¤íŠ¸" + field_checklist: "ì²´í¬ë¦¬ìŠ¤íŠ¸" + label_checklist_save_log: "ì¼ê° ë¡œê·¸ì— ë³€ê²½ì‚¬í•ì„ ì €ìž¥í•©ë‹ˆë‹¤." + label_checklist_done_ratio: "완료 비율 ì¼ê° ì„¤ì •" + permission_view_checklists: "ì²´í¬ë¦¬ìŠ¤íŠ¸ 보기" + permission_done_checklists: "ì²´í¬ë¦¬ìŠ¤íŠ¸ 완료" + permission_edit_checklists: "ì²´í¬ë¦¬ìŠ¤íŠ¸ ìˆ˜ì •" + label_checklists_must_be_completed: "ì¼ê°ì„ ì™„ë£Œí•˜ë ¤ë©´ ëª¨ë“ ì²´í¬ë¦¬ìŠ¤íŠ¸ê°€ 완료ë˜ì–´ì•¼ 합니다." + label_checklist_block_issue_closing: "ì¼ê°ì´ 종료ë˜ëŠ” ê²ƒì„ ë°©ì§€í•©ë‹ˆë‹¤." diff --git a/plugins/redmine_checklists/config/locales/nl.yml b/plugins/redmine_checklists/config/locales/nl.yml new file mode 100644 index 0000000..359fb1e --- /dev/null +++ b/plugins/redmine_checklists/config/locales/nl.yml @@ -0,0 +1,44 @@ + +nl: + activerecord: + attributes: + checklists: + subject: Onderwerp van de checklist + label_checklist_plural: Checklists + field_checklist: Checklist + label_checklist_save_log: Wijzigingen in probleemlogboek opslaan + label_checklist_done_ratio: Stel voltooiingspercentage in + permission_view_checklists: View checklist + permission_done_checklists: Voltooide checklistitems + permission_edit_checklists: Bewerk checklistitems + label_checklist_template_category_plural: Sjabloonscategorieën + label_checklist_template_category_new: Nieuwe categorie + field_checklist_template_category: Categorie + label_checklist_templates: Checklistsjablonen + label_checklist_new_checklist_template: Nieuw checklistsjabloon + field_template_items: Sjabloonitems + label_checklist_template: Checklistsjabloon + label_add_checklists_from_template: Toevoegen vanuit sjabloon + label_checklists_from_template: Van sjabloon + label_select_template: -- Selecteer sjabloon -- + label_checklist_category_not_specified: -- Niet gespecificeerd -- + label_checklists_description: Meerdere waarden toegestaan (één regel voor elke waarde) + label_checklist_item: Checklistitem + label_checklist_section: Checklistsectie + label_checklist_deleted: verwijderd + label_checklist_changed_from: veranderd van + label_checklist_changed_to: naar + label_checklist_added: toegevoegd + label_checklist_done: ingesteld op Voltooid + label_checklist_undone: ingesteld op Niet voltooid + label_checklist_updated: Checklistitem bewerkt + label_checklist_status: Checkliststatus + label_checklist_status_done: Voltooid + label_checklist_status_undone: Niet voltooid + label_checklist_is_default: Standaard + field_is_for_tracker: Tracker + label_checklists_must_be_completed: Alle checklists van een probleem moeten voltooid zijn voordat het gesloten wordt + label_checklist_block_issue_closing: Blokkeer het sluiten van het probleem + label_checklist_show_closed: Gesloten weergeven + label_checklist_hide_closed: Gesloten verbergen + label_checklist_new_section: Nieuwe sectie diff --git a/plugins/redmine_checklists/config/locales/tr.yml b/plugins/redmine_checklists/config/locales/tr.yml new file mode 100644 index 0000000..9c56228 --- /dev/null +++ b/plugins/redmine_checklists/config/locales/tr.yml @@ -0,0 +1,44 @@ +# Turkish strings go here for Rails i18n +tr: + activerecord: + attributes: + checklists: + subject: Kontrol Listesi konusu + label_checklist_plural: Kontrol listeleri + field_checklist: Kontrol Listesi + label_checklist_save_log: DeÄŸiÅŸiklikleri iÅŸ geçmiÅŸine kaydet + label_checklist_done_ratio: İş tamamlanma oranını ayarla + permission_view_checklists: Kontrol listesini görüntüle + permission_done_checklists: Kontrol Listesi elemanlarını tamamlandı olarak iÅŸaretle + permission_edit_checklists: Kontrol Listesini düzenle + label_checklist_template_category_plural: Taslak kategorileri + label_checklist_template_category_new: Yeni kategori + field_checklist_template_category: Kategori + label_checklist_templates: Kontrol listesi taslakları + label_checklist_new_checklist_template: Yeni kontrol listesi taslağı + field_template_items: Taslak elemanları + label_checklist_template: Kontrol listesi taslağı + label_add_checklists_from_template: Taslaktan ekle + label_checklists_from_template: Taslaktan + label_select_template: "-- Taslak seç --" + label_checklist_category_not_specified: "-- BelirtilmemiÅŸ --" + label_checklists_description: 'Birden fazla deÄŸer kabul edilir (her deÄŸer için bir satır)' + label_checklist_item: Kontrol listesi elemanı + label_checklist_section: Kontrol listesi kısmı + label_checklist_deleted: silindi + label_checklist_changed_from: '' + label_checklist_changed_to: '>>' + label_checklist_added: eklendi + label_checklist_done: Bitti olarak iÅŸaretlendi + label_checklist_undone: Bitti iÅŸareti kaldırıldı + label_checklist_updated: Kontrol listesi elemanı eklendi + label_checklist_status: Kontrol listesi durumu + label_checklist_status_done: Bitti + label_checklist_status_undone: Bitmedi + label_checklist_is_default: Varsayılan + field_is_for_tracker: İş tipi + label_checklists_must_be_completed: İş kapatılmadan önce tüm kontrol listeleri elemanlarının bitti olarak iÅŸaretlemesi mecburi olsun. + label_checklist_block_issue_closing: Block issue closing + label_checklist_show_closed: Kapalıları göster + label_checklist_hide_closed: Kapalıları gizle + label_checklist_new_section: Yeni kısım diff --git a/plugins/redmine_checklists/config/locales/zh-TW.yml b/plugins/redmine_checklists/config/locales/zh-TW.yml index 2fe53c2..f3f377a 100644 --- a/plugins/redmine_checklists/config/locales/zh-TW.yml +++ b/plugins/redmine_checklists/config/locales/zh-TW.yml @@ -4,29 +4,41 @@ # Based on file: en.yml zh-TW: - label_checklist_plural: Checklist - field_checklist: Checklist - label_checklist_save_log: ä¿å˜æª¢æŸ¥æ¸…單變更到å•題日誌 + label_checklist_plural: 檢查清單 + field_checklist: 檢查清單 + label_checklist_save_log: ä¿å˜æª¢æŸ¥æ¸…單的變更到å•題日誌 label_checklist_done_ratio: è¨ç½®åˆ—è¡¨å®Œæˆæ¯”率 - permission_view_checklists: 查看Checklist - permission_done_checklists: 完æˆChecklist - permission_edit_checklists: 編輯Checklist + permission_view_checklists: 查看檢查清單 + permission_done_checklists: å®Œæˆæª¢æŸ¥æ¸…å–® + permission_edit_checklists: 編輯檢查清單 label_checklist_template_category_plural: 範本類別 label_checklist_template_category_new: 新類別 field_checklist_template_category: 類別 label_checklist_templates: 檢查清單範本 - label_checklist_new_checklist_template: 新檢查清單範本 - field_template_items: ç¯„æœ¬é … + label_checklist_new_checklist_template: 新增檢查清單範本 + field_template_items: ç¯„æœ¬é …ç›® label_checklist_template: 檢查清單範本 label_add_checklists_from_template: 從範本新建 + label_checklists_from_template: å¾žç¯„æœ¬ä¸æ–°å¢ž label_select_template: "-- 鏿“‡ç¯„本 --" label_checklist_category_not_specified: "-- 未指定 --" label_checklists_description: 'å…許多é‡å€¼ (æ¯ä¸€è¡Œçš„值)' - label_checklist_item: Checklist item + label_checklist_item: æª¢æŸ¥æ¸…å–®é …ç›® label_checklist_deleted: 刪除 label_checklist_changed_from: 改變自 label_checklist_changed_to: 到 label_checklist_added: æ·»åŠ label_checklist_done: è¨ç½®å®Œæˆ label_checklist_undone: è¨ç½®æœªå®Œæˆ - label_checklist_updated: Checklist item編輯 \ No newline at end of file + label_checklist_updated: æª¢æŸ¥æ¸…å–®é …ç›®ç·¨è¼¯ + + label_checklist_status: 檢查清單狀態 + label_checklist_status_done: å·²å®Œæˆ + label_checklist_status_undone: æœªå®Œæˆ + label_checklist_is_default: é è¨ + field_is_for_tracker: 追蹤標籤 + label_checklists_must_be_completed: è°é¡Œä¸çš„æ‰€æœ‰æª¢æŸ¥æ¸…å–®å¿…é ˆå…¨éƒ¨å®Œæˆæ‰èƒ½é—œé–‰ + label_checklist_block_issue_closing: 阻擋è°é¡Œé—œé–‰ + label_checklist_show_closed: é¡¯ç¤ºå·²å®Œæˆ + label_checklist_hide_closed: éš±è—å·²å®Œæˆ + label_checklist_new_section: 新增å€å¡Š \ No newline at end of file diff --git a/plugins/redmine_checklists/config/routes.rb b/plugins/redmine_checklists/config/routes.rb index dab2482..26f894f 100644 --- a/plugins/redmine_checklists/config/routes.rb +++ b/plugins/redmine_checklists/config/routes.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/db/migrate/001_create_checklists.rb b/plugins/redmine_checklists/db/migrate/001_create_checklists.rb index 2408934..715f822 100644 --- a/plugins/redmine_checklists/db/migrate/001_create_checklists.rb +++ b/plugins/redmine_checklists/db/migrate/001_create_checklists.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. -class CreateChecklists < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] +class CreateChecklists < ActiveRecord::Migration[4.2] def self.up if ActiveRecord::Base.connection.table_exists? :issue_checklists diff --git a/plugins/redmine_checklists/db/migrate/002_add_time_stamps_to_checklists.rb b/plugins/redmine_checklists/db/migrate/002_add_time_stamps_to_checklists.rb index 03e3c99..fd7e02e 100644 --- a/plugins/redmine_checklists/db/migrate/002_add_time_stamps_to_checklists.rb +++ b/plugins/redmine_checklists/db/migrate/002_add_time_stamps_to_checklists.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. -class AddTimeStampsToChecklists < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] +class AddTimeStampsToChecklists < ActiveRecord::Migration[4.2] def change add_column :checklists, :created_at, :timestamp add_column :checklists, :updated_at, :timestamp diff --git a/plugins/redmine_checklists/db/migrate/003_create_checklist_template_category.rb b/plugins/redmine_checklists/db/migrate/003_create_checklist_template_category.rb index ebb7987..ba26d4e 100644 --- a/plugins/redmine_checklists/db/migrate/003_create_checklist_template_category.rb +++ b/plugins/redmine_checklists/db/migrate/003_create_checklist_template_category.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. -class CreateChecklistTemplateCategory < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] +class CreateChecklistTemplateCategory < ActiveRecord::Migration[4.2] def self.up create_table :checklist_template_categories do |t| diff --git a/plugins/redmine_checklists/db/migrate/004_create_checklist_templates.rb b/plugins/redmine_checklists/db/migrate/004_create_checklist_templates.rb index 8de0692..670f8da 100644 --- a/plugins/redmine_checklists/db/migrate/004_create_checklist_templates.rb +++ b/plugins/redmine_checklists/db/migrate/004_create_checklist_templates.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. -class CreateChecklistTemplates < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] +class CreateChecklistTemplates < ActiveRecord::Migration[4.2] def self.up create_table :checklist_templates do |t| diff --git a/plugins/redmine_checklists/db/migrate/005_modify_checklist_subject_length.rb b/plugins/redmine_checklists/db/migrate/005_modify_checklist_subject_length.rb index 5538b2b..77a6ea5 100644 --- a/plugins/redmine_checklists/db/migrate/005_modify_checklist_subject_length.rb +++ b/plugins/redmine_checklists/db/migrate/005_modify_checklist_subject_length.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. -class ModifyChecklistSubjectLength < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] +class ModifyChecklistSubjectLength < ActiveRecord::Migration[4.2] def self.up change_column :checklists, :subject, :string, :limit => 512 end diff --git a/plugins/redmine_checklists/db/migrate/006_add_fields_to_checklist_template.rb b/plugins/redmine_checklists/db/migrate/006_add_fields_to_checklist_template.rb index ce38cb1..922bda5 100644 --- a/plugins/redmine_checklists/db/migrate/006_add_fields_to_checklist_template.rb +++ b/plugins/redmine_checklists/db/migrate/006_add_fields_to_checklist_template.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. -class AddFieldsToChecklistTemplate < Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRecord::Migration[4.2] +class AddFieldsToChecklistTemplate < ActiveRecord::Migration[4.2] def self.up add_column :checklist_templates, :is_default, :boolean, :default => false add_column :checklist_templates, :tracker_id, :integer diff --git a/plugins/redmine_checklists/db/migrate/007_add_is_section_to_checklists.rb b/plugins/redmine_checklists/db/migrate/007_add_is_section_to_checklists.rb index 23812c5..3113511 100644 --- a/plugins/redmine_checklists/db/migrate/007_add_is_section_to_checklists.rb +++ b/plugins/redmine_checklists/db/migrate/007_add_is_section_to_checklists.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/doc/CHANGELOG b/plugins/redmine_checklists/doc/CHANGELOG index dec076c..6268bcc 100644 --- a/plugins/redmine_checklists/doc/CHANGELOG +++ b/plugins/redmine_checklists/doc/CHANGELOG @@ -1,9 +1,35 @@ == Redmine Checklists plugin changelog Redmine Checklists plugin - managing issue checklists plugin for Redmine -Copyright (C) 2011-2021 RedmineUP +Copyright (C) 2011-2024 Kirill Bezrukov (RedmineUP) http://www.redmineup.com/ +== 2024-02-14 v3.1.23 + +* Dropped Redmine 3 support +* Added Taiwanese(Traditional chinese) translation (Tomy) +* Updated Dutch, French, German locales (Jan Catrysse) +* Fixed notification bug + +== 2023-01-16 v3.1.22 + +* Added is_section API property +* Added Hungarian locale (Krisztian Engi, Lilla Basilides) +* Added Turkish locale (Adnan Topçu) +* Updated Korean locale (Ki Won Kim) +* Updated German locale (Joachim Mathes) +* Fixed name validation for item checkbox +* Fixed items sorting + +== 2022-02-21 v3.1.21 + +* Redmine 5.0 compatibility fixes + +== 2021-10-12 v3.1.20 + +* Fixed subtask checklists copy +* Fixed checklist formating error + == 2021-05-21 v3.1.19 * Added Redmine 4.2 compatibility diff --git a/plugins/redmine_checklists/init.rb b/plugins/redmine_checklists/init.rb index 3250729..dea2522 100644 --- a/plugins/redmine_checklists/init.rb +++ b/plugins/redmine_checklists/init.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -17,10 +17,9 @@ # You should have received a copy of the GNU General Public License # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. -require 'redmine' -require 'redmine_checklists/redmine_checklists' +requires_redmineup version_or_higher: '1.0.5' rescue raise "\n\033[31mRedmine requires newer redmineup gem version.\nPlease update with 'bundle update redmineup'.\033[0m" -CHECKLISTS_VERSION_NUMBER = '3.1.19'.freeze +CHECKLISTS_VERSION_NUMBER = '3.1.23'.freeze CHECKLISTS_VERSION_TYPE = "Light version" Redmine::Plugin.register :redmine_checklists do @@ -31,7 +30,7 @@ Redmine::Plugin.register :redmine_checklists do url 'https://www.redmineup.com/pages/plugins/checklists' author_url 'mailto:support@redmineup.com' - requires_redmine :version_or_higher => '3.0' + requires_redmine :version_or_higher => '4.0' settings :default => { :save_log => true, @@ -45,8 +44,9 @@ Redmine::Plugin.register :redmine_checklists do map.permission :edit_checklists, { :checklists => [:done, :create, :destroy, :update] } end end +end - Redmine::Search.map do |search| - # search.register :checklists - end +if (Rails.configuration.respond_to?(:autoloader) && Rails.configuration.autoloader == :zeitwerk) || Rails.version > '7.0' + Rails.autoloaders.each { |loader| loader.ignore(File.dirname(__FILE__) + '/lib') } end +require File.dirname(__FILE__) + '/lib/redmine_checklists' diff --git a/plugins/redmine_checklists/lib/redmine_checklists/redmine_checklists.rb b/plugins/redmine_checklists/lib/redmine_checklists.rb similarity index 57% rename from plugins/redmine_checklists/lib/redmine_checklists/redmine_checklists.rb rename to plugins/redmine_checklists/lib/redmine_checklists.rb index 6db0db4..88425e9 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/redmine_checklists.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -17,23 +17,6 @@ # You should have received a copy of the GNU General Public License # along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. -Rails.configuration.to_prepare do - require 'redmine_checklists/patches/compatibility/application_helper_patch' - - require 'redmine_checklists/hooks/views_issues_hook' - require 'redmine_checklists/hooks/views_layouts_hook' - require 'redmine_checklists/hooks/controller_issues_hook' - - require 'redmine_checklists/patches/issue_patch' - require 'redmine_checklists/patches/project_patch' - require 'redmine_checklists/patches/issues_controller_patch' - require 'redmine_checklists/patches/add_helpers_for_checklists_patch' - require 'redmine_checklists/patches/compatibility_patch' - require 'redmine_checklists/patches/issues_helper_patch' - require 'redmine_checklists/patches/compatibility/open_struct_patch' - require 'redmine_checklists/patches/compatibility/journal_patch' -end - module RedmineChecklists def self.settings() Setting.plugin_redmine_checklists.blank? ? {} : Setting.plugin_redmine_checklists end @@ -45,3 +28,19 @@ module RedmineChecklists settings['issue_done_ratio'].to_i > 0 end end + +REDMINE_CHECKLISTS_REQUIRED_FILES = [ + 'redmine_checklists/patches/compatibility/application_helper_patch', + 'redmine_checklists/hooks/views_issues_hook', + 'redmine_checklists/hooks/views_layouts_hook', + 'redmine_checklists/hooks/controller_issues_hook', + 'redmine_checklists/patches/issue_patch', + 'redmine_checklists/patches/project_patch', + 'redmine_checklists/patches/issues_controller_patch', + 'redmine_checklists/patches/helper_for_checklists_patch', + 'redmine_checklists/patches/issues_helper_patch', + 'redmine_checklists/patches/compatibility/open_struct_patch', +] + +base_url = File.dirname(__FILE__) +REDMINE_CHECKLISTS_REQUIRED_FILES.each { |file| require(base_url + '/' + file) } diff --git a/plugins/redmine_checklists/lib/redmine_checklists/hooks/controller_issues_hook.rb b/plugins/redmine_checklists/lib/redmine_checklists/hooks/controller_issues_hook.rb index 2a8cde0..fd4d639 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/hooks/controller_issues_hook.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/hooks/controller_issues_hook.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/lib/redmine_checklists/hooks/views_issues_hook.rb b/plugins/redmine_checklists/lib/redmine_checklists/hooks/views_issues_hook.rb index 79c2294..8fc562a 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/hooks/views_issues_hook.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/hooks/views_issues_hook.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/lib/redmine_checklists/hooks/views_layouts_hook.rb b/plugins/redmine_checklists/lib/redmine_checklists/hooks/views_layouts_hook.rb index 852f30a..f54450d 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/hooks/views_layouts_hook.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/hooks/views_layouts_hook.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/2.1/redmine_api_test_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/2.1/redmine_api_test_patch.rb deleted file mode 100644 index d15bcfd..0000000 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/2.1/redmine_api_test_patch.rb +++ /dev/null @@ -1,275 +0,0 @@ -# This file is a part of Redmine Checklists (redmine_checklists) plugin, -# issue checklists management plugin for Redmine -# -# Copyright (C) 2011-2021 RedmineUP -# http://www.redmineup.com/ -# -# redmine_checklists is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# redmine_checklists is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. - -module Redmine - module ApiTest - # Base class for API tests - class Base < ActionDispatch::IntegrationTest - # Test that a request allows the three types of API authentication - # - # * HTTP Basic with username and password - # * HTTP Basic with an api key for the username - # * Key based with the key=X parameter - # - # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) - # @param [String] url the request url - # @param [optional, Hash] parameters additional request parameters - # @param [optional, Hash] options additional options - # @option options [Symbol] :success_code Successful response code (:success) - # @option options [Symbol] :failure_code Failure response code (:unauthorized) - def self.should_allow_api_authentication(http_method, url, parameters={}, options={}) - should_allow_http_basic_auth_with_username_and_password(http_method, url, parameters, options) - should_allow_http_basic_auth_with_key(http_method, url, parameters, options) - should_allow_key_based_auth(http_method, url, parameters, options) - end - - # Test that a request allows the username and password for HTTP BASIC - # - # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) - # @param [String] url the request url - # @param [optional, Hash] parameters additional request parameters - # @param [optional, Hash] options additional options - # @option options [Symbol] :success_code Successful response code (:success) - # @option options [Symbol] :failure_code Failure response code (:unauthorized) - def self.should_allow_http_basic_auth_with_username_and_password(http_method, url, parameters={}, options={}) - success_code = options[:success_code] || :success - failure_code = options[:failure_code] || :unauthorized - - context "should allow http basic auth using a username and password for #{http_method} #{url}" do - context "with a valid HTTP authentication" do - setup do - @user = User.generate! do |user| - user.admin = true - user.password = 'my_password' - end - send(http_method, url, parameters, credentials(@user.login, 'my_password')) - end - - should_respond_with success_code - should_respond_with_content_type_based_on_url(url) - should "login as the user" do - assert_equal @user, User.current - end - end - - context "with an invalid HTTP authentication" do - setup do - @user = User.generate! - send(http_method, url, parameters, credentials(@user.login, 'wrong_password')) - end - - should_respond_with failure_code - should_respond_with_content_type_based_on_url(url) - should "not login as the user" do - assert_equal User.anonymous, User.current - end - end - - context "without credentials" do - setup do - send(http_method, url, parameters) - end - - should_respond_with failure_code - should_respond_with_content_type_based_on_url(url) - should "include_www_authenticate_header" do - assert @controller.response.headers.has_key?('WWW-Authenticate') - end - end - end - end - - # Test that a request allows the API key with HTTP BASIC - # - # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) - # @param [String] url the request url - # @param [optional, Hash] parameters additional request parameters - # @param [optional, Hash] options additional options - # @option options [Symbol] :success_code Successful response code (:success) - # @option options [Symbol] :failure_code Failure response code (:unauthorized) - def self.should_allow_http_basic_auth_with_key(http_method, url, parameters={}, options={}) - success_code = options[:success_code] || :success - failure_code = options[:failure_code] || :unauthorized - - context "should allow http basic auth with a key for #{http_method} #{url}" do - context "with a valid HTTP authentication using the API token" do - setup do - @user = User.generate! do |user| - user.admin = true - end - @token = Token.create!(:user => @user, :action => 'api') - send(http_method, url, parameters, credentials(@token.value, 'X')) - end - should_respond_with success_code - should_respond_with_content_type_based_on_url(url) - should_be_a_valid_response_string_based_on_url(url) - should "login as the user" do - assert_equal @user, User.current - end - end - - context "with an invalid HTTP authentication" do - setup do - @user = User.generate! - @token = Token.create!(:user => @user, :action => 'feeds') - send(http_method, url, parameters, credentials(@token.value, 'X')) - end - should_respond_with failure_code - should_respond_with_content_type_based_on_url(url) - should "not login as the user" do - assert_equal User.anonymous, User.current - end - end - end - end - - # Test that a request allows full key authentication - # - # @param [Symbol] http_method the HTTP method for request (:get, :post, :put, :delete) - # @param [String] url the request url, without the key=ZXY parameter - # @param [optional, Hash] parameters additional request parameters - # @param [optional, Hash] options additional options - # @option options [Symbol] :success_code Successful response code (:success) - # @option options [Symbol] :failure_code Failure response code (:unauthorized) - def self.should_allow_key_based_auth(http_method, url, parameters={}, options={}) - success_code = options[:success_code] || :success - failure_code = options[:failure_code] || :unauthorized - - context "should allow key based auth using key=X for #{http_method} #{url}" do - context "with a valid api token" do - setup do - @user = User.generate! do |user| - user.admin = true - end - @token = Token.create!(:user => @user, :action => 'api') - # Simple url parse to add on ?key= or &key= - request_url = if url.match(/\?/) - url + "&key=#{@token.value}" - else - url + "?key=#{@token.value}" - end - send(http_method, request_url, parameters) - end - should_respond_with success_code - should_respond_with_content_type_based_on_url(url) - should_be_a_valid_response_string_based_on_url(url) - should "login as the user" do - assert_equal @user, User.current - end - end - - context "with an invalid api token" do - setup do - @user = User.generate! do |user| - user.admin = true - end - @token = Token.create!(:user => @user, :action => 'feeds') - # Simple url parse to add on ?key= or &key= - request_url = if url.match(/\?/) - url + "&key=#{@token.value}" - else - url + "?key=#{@token.value}" - end - send(http_method, request_url, parameters) - end - should_respond_with failure_code - should_respond_with_content_type_based_on_url(url) - should "not login as the user" do - assert_equal User.anonymous, User.current - end - end - end - - context "should allow key based auth using X-Redmine-API-Key header for #{http_method} #{url}" do - setup do - @user = User.generate! do |user| - user.admin = true - end - @token = Token.create!(:user => @user, :action => 'api') - send(http_method, url, parameters, {'X-Redmine-API-Key' => @token.value.to_s}) - end - should_respond_with success_code - should_respond_with_content_type_based_on_url(url) - should_be_a_valid_response_string_based_on_url(url) - should "login as the user" do - assert_equal @user, User.current - end - end - end - - # Uses should_respond_with_content_type based on what's in the url: - # - # '/project/issues.xml' => should_respond_with_content_type :xml - # '/project/issues.json' => should_respond_with_content_type :json - # - # @param [String] url Request - def self.should_respond_with_content_type_based_on_url(url) - case - when url.match(/xml/i) - should "respond with XML" do - assert_equal 'application/xml', @response.content_type - end - when url.match(/json/i) - should "respond with JSON" do - assert_equal 'application/json', @response.content_type - end - else - raise "Unknown content type for should_respond_with_content_type_based_on_url: #{url}" - end - end - - # Uses the url to assert which format the response should be in - # - # '/project/issues.xml' => should_be_a_valid_xml_string - # '/project/issues.json' => should_be_a_valid_json_string - # - # @param [String] url Request - def self.should_be_a_valid_response_string_based_on_url(url) - case - when url.match(/xml/i) - should_be_a_valid_xml_string - when url.match(/json/i) - should_be_a_valid_json_string - else - raise "Unknown content type for should_be_a_valid_response_based_on_url: #{url}" - end - end - - # Checks that the response is a valid JSON string - def self.should_be_a_valid_json_string - should "be a valid JSON string (or empty)" do - assert(response.body.blank? || ActiveSupport::JSON.decode(response.body)) - end - end - - # Checks that the response is a valid XML string - def self.should_be_a_valid_xml_string - should "be a valid XML string" do - assert REXML::Document.new(response.body) - end - end - - def self.should_respond_with(status) - should "respond with #{status}" do - assert_response status - end - end - end - end -end diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/application_helper_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/application_helper_patch.rb index 47ed55e..4b43930 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/application_helper_patch.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/application_helper_patch.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -22,8 +22,6 @@ module RedmineChecklists module ApplicationHelperPatch def self.included(base) # :nodoc: base.class_eval do - unloadable # Send unloadable so it will not be unloaded in development - def stocked_reorder_link(object, name = nil, url = {}, method = :post) Redmine::VERSION.to_s > '3.3' ? reorder_handle(object, :param => name) : reorder_links(name, url, method) end diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/journal_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/journal_patch.rb deleted file mode 100644 index 9892dd1..0000000 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/journal_patch.rb +++ /dev/null @@ -1,74 +0,0 @@ -# This file is a part of Redmine Checklists (redmine_checklists) plugin, -# issue checklists management plugin for Redmine -# -# Copyright (C) 2011-2021 RedmineUP -# http://www.redmineup.com/ -# -# redmine_checklists is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# redmine_checklists is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. - -require_dependency 'journal' - -module RedmineChecklists - module Patches - module JournalPatch - def self.included(base) # :nodoc: - base.send(:include, InstanceMethods) - base.class_eval do - end - end - - module InstanceMethods - - if Redmine::VERSION.to_s < '2.6' - def send_notification - if notify? && - (Setting.notified_events.include?('issue_updated') || - (Setting.notified_events.include?('issue_note_added') && notes.present?) || - (Setting.notified_events.include?('issue_status_updated') && new_status.present?) || - (Setting.notified_events.include?('issue_priority_updated') && new_value_for('priority_id').present?) - ) - deliver_checklist_notification - end - end - - def detail_for_attribute(attribute) - details.detect { |detail| detail.prop_key == attribute } - end - end - - def deliver_checklist_notification - if Redmine::VERSION.to_s >= '4.0' - (notified_watchers | notified_users).each do |user| - Mailer.issue_edit(user, self).deliver - end - else - checklist_email_notification(self).deliver - end - end - - def checklist_email_notification(journal) - if Redmine::VERSION.to_s < '2.4' - Mailer.issue_edit(journal) - else - Mailer.issue_edit(journal, journal.notified_users, journal.notified_watchers - journal.notified_users) - end - end - end - end - end -end - -unless Journal.included_modules.include?(RedmineChecklists::Patches::JournalPatch) - Journal.send(:include, RedmineChecklists::Patches::JournalPatch) -end diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/open_struct_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/open_struct_patch.rb index 36c0395..dc9900c 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/open_struct_patch.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility/open_struct_patch.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility_patch.rb deleted file mode 100644 index c347ab2..0000000 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/compatibility_patch.rb +++ /dev/null @@ -1,22 +0,0 @@ -# This file is a part of Redmine Checklists (redmine_checklists) plugin, -# issue checklists management plugin for Redmine -# -# Copyright (C) 2011-2021 RedmineUP -# http://www.redmineup.com/ -# -# redmine_checklists is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# redmine_checklists is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with redmine_checklists. If not, see <http://www.gnu.org/licenses/>. - -if Redmine::VERSION.to_s < '2.3' - Dir[File.dirname(__FILE__) + '/compatibility/2.1/*.rb'].each { |f| require f } -end diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/add_helpers_for_checklists_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/helper_for_checklists_patch.rb similarity index 86% rename from plugins/redmine_checklists/lib/redmine_checklists/patches/add_helpers_for_checklists_patch.rb rename to plugins/redmine_checklists/lib/redmine_checklists/patches/helper_for_checklists_patch.rb index 660da28..c0777ee 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/add_helpers_for_checklists_patch.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/patches/helper_for_checklists_patch.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -19,8 +19,7 @@ module RedmineChecklists module Patches - - module AddHelpersForChecklistPatch + module HelperForChecklistsPatch def self.apply(controller) controller.send(:helper, 'checklists') end @@ -29,5 +28,5 @@ module RedmineChecklists end [IssuesController].each do |controller| - RedmineChecklists::Patches::AddHelpersForChecklistPatch.apply(controller) + RedmineChecklists::Patches::HelperForChecklistsPatch.apply(controller) end diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/issue_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/issue_patch.rb index 8cfc0c6..cf136fd 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/issue_patch.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/patches/issue_patch.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -25,20 +25,16 @@ module RedmineChecklists def self.included(base) # :nodoc: base.send(:include, InstanceMethods) base.class_eval do - unloadable # Send unloadable so it will not be unloaded in development attr_accessor :old_checklists attr_accessor :removed_checklist_ids + attr_accessor :checklists_from_params attr_reader :copied_from alias_method :copy_without_checklist, :copy alias_method :copy, :copy_with_checklist after_save :copy_subtask_checklists - if ActiveRecord::VERSION::MAJOR >= 4 - has_many :checklists, lambda { order("#{Checklist.table_name}.position") }, :class_name => 'Checklist', :dependent => :destroy, :inverse_of => :issue - else - has_many :checklists, :class_name => 'Checklist', :dependent => :destroy, :inverse_of => :issue, :order => 'position' - end + has_many :checklists, lambda { order("#{Checklist.table_name}.position") }, :class_name => 'Checklist', :dependent => :destroy, :inverse_of => :issue accepts_nested_attributes_for :checklists, :allow_destroy => true, :reject_if => proc { |attrs| attrs['subject'].blank? } @@ -52,15 +48,16 @@ module RedmineChecklists module InstanceMethods def copy_checklists(arg) issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg) - if issue - issue.checklists.each do |checklist| - Checklist.create(checklist.attributes.except('id', 'issue_id').merge(issue: self)) - end + return unless issue + + issue.checklists.each do |checklist| + Checklist.create(checklist.attributes.except('id', 'issue_id').merge(issue: self)) end end def copy_subtask_checklists - return if !copy? || parent_id.nil? || checklists.reload.any? + return if checklists_from_params || !copy? || parent_id.nil? || checklists.reload.any? + copy_checklists(@copied_from) end diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/issue_query_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/issue_query_patch.rb index 4e613f9..5a768c0 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/issue_query_patch.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/patches/issue_query_patch.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/issues_controller_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/issues_controller_patch.rb index f927fd4..f007eb7 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/issues_controller_patch.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/patches/issues_controller_patch.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -24,8 +24,6 @@ module RedmineChecklists def self.included(base) # :nodoc: base.send(:include, InstanceMethods) base.class_eval do - unloadable # Send unloadable so it will not be unloaded in development - alias_method :build_new_issue_from_params_without_checklist, :build_new_issue_from_params alias_method :build_new_issue_from_params, :build_new_issue_from_params_with_checklist before_action :save_before_state, :only => [:update] @@ -46,6 +44,7 @@ module RedmineChecklists end end build_new_issue_from_params_without_checklist + @issue.checklists_from_params = true end def save_before_state diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/issues_helper_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/issues_helper_patch.rb index 07333cf..e0e8f9e 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/issues_helper_patch.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/patches/issues_helper_patch.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -24,8 +24,6 @@ module RedmineChecklists base.send(:include, InstanceMethods) base.class_eval do - unloadable - alias_method :details_to_strings_without_checklists, :details_to_strings alias_method :details_to_strings, :details_to_strings_with_checklists end diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/notifiable_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/notifiable_patch.rb index c0fa95b..a6daac4 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/notifiable_patch.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/patches/notifiable_patch.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/lib/redmine_checklists/patches/project_patch.rb b/plugins/redmine_checklists/lib/redmine_checklists/patches/project_patch.rb index d2985db..66636e9 100644 --- a/plugins/redmine_checklists/lib/redmine_checklists/patches/project_patch.rb +++ b/plugins/redmine_checklists/lib/redmine_checklists/patches/project_patch.rb @@ -1,7 +1,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -25,7 +25,6 @@ module RedmineChecklists def self.included(base) # :nodoc: base.send(:include, InstanceMethods) base.class_eval do - unloadable # Send unloadable so it will not be unloaded in development alias_method :copy_issues_without_checklist, :copy_issues alias_method :copy_issues, :copy_issues_with_checklist end diff --git a/plugins/redmine_checklists/test/functional/checklists_controller_test.rb b/plugins/redmine_checklists/test/functional/checklists_controller_test.rb index 29d7a59..855fe3c 100644 --- a/plugins/redmine_checklists/test/functional/checklists_controller_test.rb +++ b/plugins/redmine_checklists/test/functional/checklists_controller_test.rb @@ -3,7 +3,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/test/functional/issues_controller_test.rb b/plugins/redmine_checklists/test/functional/issues_controller_test.rb index ad83748..f36646b 100644 --- a/plugins/redmine_checklists/test/functional/issues_controller_test.rb +++ b/plugins/redmine_checklists/test/functional/issues_controller_test.rb @@ -3,7 +3,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -59,7 +59,7 @@ class IssuesControllerTest < ActionController::TestCase def test_new_issue_without_project compatible_request :get, :new assert_response :success - end if Redmine::VERSION.to_s > '3.0' + end def test_get_show_issue issue = Issue.find(1) @@ -91,11 +91,7 @@ class IssuesControllerTest < ActionController::TestCase @request.session[:user_id] = 1 issue = Issue.find(1) - if Redmine::VERSION.to_s > '2.3' && Redmine::VERSION.to_s < '3.0' - compatible_xhr_request :put, :update_form, :issue => parameters, :project_id => issue.project - else - compatible_xhr_request :put, :new, :issue => parameters, :project_id => issue.project - end + compatible_xhr_request :put, :new, :issue => parameters, :project_id => issue.project assert_response :success assert_match 'text/javascript', response.content_type assert_match 'FirstChecklist', response.body @@ -178,6 +174,20 @@ class IssuesControllerTest < ActionController::TestCase assert_not_nil issue end + def test_delete_issue_with_checklists + @request.session[:user_id] = 1 + other_checklist = Checklist.first + other_checklist.update(position: 2) + + assert_difference('Issue.count', -1) do + assert_difference('Checklist.count', -2) do + compatible_request :post, :destroy, id: '2' + assert_response :redirect + end + end + assert_equal other_checklist.position, other_checklist.reload.position + end + def test_create_issue_using_json old_value = Setting.rest_api_enabled Setting.rest_api_enabled = '1' diff --git a/plugins/redmine_checklists/test/integration/api_test/checklists_test.rb b/plugins/redmine_checklists/test/integration/api_test/checklists_test.rb index 9ad8c35..6d7bc56 100644 --- a/plugins/redmine_checklists/test/integration/api_test/checklists_test.rb +++ b/plugins/redmine_checklists/test/integration/api_test/checklists_test.rb @@ -3,7 +3,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -63,6 +63,18 @@ class Redmine::ApiTest::ChecklistsTest < Redmine::ApiTest::Base end end + def test_get_checklists_with_section_xml + compatible_api_request :get, '/issues/2/checklists.xml', {}, credentials('admin') + + assert_select 'checklists[type=array]' do + assert_select 'checklist' do + assert_select 'id', :text => '4' + assert_select 'subject', :text => 'New section' + assert_select 'is_section', :text => 'true' + end + end + end + def test_get_checklists_1_xml compatible_api_request :get, '/checklists/1.xml', {}, credentials('admin') @@ -72,6 +84,26 @@ class Redmine::ApiTest::ChecklistsTest < Redmine::ApiTest::Base end end + def test_get_checklists_2_with_section_xml + compatible_api_request :get, '/checklists/4.xml', {}, credentials('admin') + + assert_select 'checklist' do + assert_select 'id', :text => '4' + assert_select 'subject', :text => 'New section' + assert_select 'is_section', :text => 'true' + end + end + + def test_checklists_2_should_not_section_xml + compatible_api_request :get, '/checklists/3.xml', {}, credentials('admin') + + assert_select 'checklist' do + assert_select 'id', :text => '3' + assert_select 'subject', :text => 'Third todo' + assert_select 'is_section', :text => 'false' + end + end + def test_post_checklists_xml parameters = { :checklist => { :issue_id => 1, :subject => 'api_test_001', diff --git a/plugins/redmine_checklists/test/integration/common_issue_test.rb b/plugins/redmine_checklists/test/integration/common_issue_test.rb index 47520a1..458c628 100644 --- a/plugins/redmine_checklists/test/integration/common_issue_test.rb +++ b/plugins/redmine_checklists/test/integration/common_issue_test.rb @@ -3,7 +3,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/test/test_helper.rb b/plugins/redmine_checklists/test/test_helper.rb index 0d949e7..39fc8e9 100644 --- a/plugins/redmine_checklists/test/test_helper.rb +++ b/plugins/redmine_checklists/test/test_helper.rb @@ -3,7 +3,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify @@ -55,19 +55,11 @@ end include RedmineChecklists::TestHelper -if ActiveRecord::VERSION::MAJOR >= 4 - class RedmineChecklists::IntegrationTest < Redmine::IntegrationTest; end -else - class RedmineChecklists::IntegrationTest < ActionController::IntegrationTest; end -end +class RedmineChecklists::IntegrationTest < Redmine::IntegrationTest; end class RedmineChecklists::TestCase def self.create_fixtures(fixtures_directory, table_names, class_names = {}) - if ActiveRecord::VERSION::MAJOR >= 4 - ActiveRecord::FixtureSet.create_fixtures(fixtures_directory, table_names, class_names = {}) - else - ActiveRecord::Fixtures.create_fixtures(fixtures_directory, table_names, class_names = {}) - end + ActiveRecord::FixtureSet.create_fixtures(fixtures_directory, table_names, class_names = {}) end def self.prepare diff --git a/plugins/redmine_checklists/test/unit/checklist_test.rb b/plugins/redmine_checklists/test/unit/checklist_test.rb index 63e498f..8034beb 100644 --- a/plugins/redmine_checklists/test/unit/checklist_test.rb +++ b/plugins/redmine_checklists/test/unit/checklist_test.rb @@ -3,7 +3,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/test/unit/issue_test.rb b/plugins/redmine_checklists/test/unit/issue_test.rb index 8ea4c05..87fe01f 100644 --- a/plugins/redmine_checklists/test/unit/issue_test.rb +++ b/plugins/redmine_checklists/test/unit/issue_test.rb @@ -3,7 +3,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify diff --git a/plugins/redmine_checklists/test/unit/project_test.rb b/plugins/redmine_checklists/test/unit/project_test.rb index 5e8775c..d32ff14 100644 --- a/plugins/redmine_checklists/test/unit/project_test.rb +++ b/plugins/redmine_checklists/test/unit/project_test.rb @@ -3,7 +3,7 @@ # This file is a part of Redmine Checklists (redmine_checklists) plugin, # issue checklists management plugin for Redmine # -# Copyright (C) 2011-2021 RedmineUP +# Copyright (C) 2011-2024 RedmineUP # http://www.redmineup.com/ # # redmine_checklists is free software: you can redistribute it and/or modify -- GitLab