This commit is contained in:
choibk 2026-01-05 15:24:36 +09:00
commit 0eecec9300
74 changed files with 4544 additions and 0 deletions

41
.gitignore vendored Normal file
View File

@ -0,0 +1,41 @@
# ===== OS =====
.DS_Store
Thumbs.db
# ===== Editor / IDE =====
.vscode/
.idea/
*.swp
*.swo
*.bak
# ===== Ruby / Rails runtime =====
.bundle/
vendor/bundle/
log/
tmp/
coverage/
# ===== Rails / Asset build =====
node_modules/
public/assets/
public/packs/
yarn-error.log
npm-debug.log
# ===== Test artifacts =====
test/tmp/
spec/examples.txt
# ===== Database (local only) =====
*.sqlite3
*.sqlite3-journal
# ===== Environment =====
.env
.env.*
!.env.example
# ===== Distribution files =====
*.zip
*.tar.gz

1
Gemfile Normal file
View File

@ -0,0 +1 @@
gem 'redmineup'

View File

@ -0,0 +1,121 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class ChecklistsController < ApplicationController
before_action :find_checklist_item, :except => [:index, :create, :custom_field_done]
before_action :find_issue_by_id, :only => [:index, :create, :custom_field_done]
before_action :authorize, :except => [:done, :custom_field_done]
helper :issues
accept_api_auth :index, :update, :destroy, :create, :show
def index
@checklists = @issue.checklists
respond_to do |format|
format.api
end
end
def show
respond_to do |format|
format.api
end
end
def destroy
@checklist_item.destroy
respond_to do |format|
format.api { render_api_ok }
end
end
def create
@checklist_item = Checklist.new
@checklist_item.safe_attributes = params[:checklist]
@checklist_item.issue = @issue
respond_to do |format|
format.api {
if @checklist_item.save
recalculate_issue_ratio(@checklist_item)
render :action => 'show', :status => :created, :location => checklist_url(@checklist_item)
else
render_validation_errors(@checklist_item)
end
}
end
end
def update
@checklist_item.safe_attributes = params[:checklist]
respond_to do |format|
format.api {
if with_issue_journal { @checklist_item.save }
recalculate_issue_ratio(@checklist_item)
render_api_ok
else
render_validation_errors(@checklist_item)
end
}
end
end
def done
(render_403; return false) unless User.current.allowed_to?(:done_checklists, @checklist_item.issue.project)
with_issue_journal do
@checklist_item.is_done = params[:is_done] == 'true'
if @checklist_item.save
recalculate_issue_ratio(@checklist_item)
true
end
end
respond_to do |format|
format.js
format.html { redirect_to :back }
end
end
private
def find_issue_by_id
@issue = Issue.find(params[:issue_id])
@project = @issue.project
rescue ActiveRecord::RecordNotFound
render_404
end
def find_checklist_item
@checklist_item = Checklist.find(params[:id])
@project = @checklist_item.issue.project
rescue ActiveRecord::RecordNotFound
render_404
end
def with_issue_journal(&block)
return unless yield
true
end
def recalculate_issue_ratio(checklist_item)
if (Setting.issue_done_ratio == 'issue_field') && RedmineChecklists.issue_done_ratio?
Checklist.recalc_issue_done_ratio(checklist_item.issue.id)
checklist_item.issue.reload
end
end
end

View File

@ -0,0 +1,68 @@
# encoding: utf-8
#
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 ChecklistsHelper
def link_to_remove_checklist_fields(name, f, options={})
f.hidden_field(:_destroy) + link_to(name, "javascript:void(0)", options)
end
def new_object(f, association)
@new_object ||= f.object.class.reflect_on_association(association).klass.new
end
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
end
def new_or_show(f)
object = f.respond_to?(:object) ? f.object : f
if object.new_record?
object.subject.present? ? 'show' : 'new'
else
'show'
end
end
def custom_field_checklist_fields(custom_field)
custom_field.fields_for(:checklist) do |new_checklist|
new_checklist.fields_for(:new_checklist, RedmineChecklists::FieldFormat::ChecklistStruct.new({})) do |f|
render(partial: 'common/custom_field_checklist_item', locals: {custom_field: f})
end
end
end
def custom_field_field_name(custom_field, ind, name)
"#{custom_field.object_name}[checklist][#{ind}][#{name}]"
end
def done_css(f)
if f.object.is_done
"is-done-checklist-item"
else
""
end
end
end

79
app/models/checklist.rb Normal file
View File

@ -0,0 +1,79 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class Checklist < ApplicationRecord
include Redmine::SafeAttributes
belongs_to :issue
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
acts_as_event :datetime => :created_at,
:url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue_id}},
:type => 'issue issue-closed',
:title => Proc.new {|o| o.subject },
:description => Proc.new {|o| "#{l(:field_issue)}: #{o.issue.subject}" }
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"
up_acts_as_list scope: :issue
validates_presence_of :subject
validates_length_of :subject, :maximum => 1000
validates_presence_of :position
validates_numericality_of :position
def self.recalc_issue_done_ratio(issue_id)
issue = Issue.find(issue_id)
return false if (Setting.issue_done_ratio != 'issue_field') || !RedmineChecklists.issue_done_ratio? || issue.checklists.reject(&:is_section).empty?
done_checklist = issue.checklists.reject(&:is_section).map { |c| c.is_done ? 1 : 0 }
done_ratio = (done_checklist.count(1) * 10) / done_checklist.count * 10
issue.update(done_ratio: done_ratio)
end
def self.old_format?(detail)
(detail.old_value.is_a?(String) && detail.old_value.match(/^\[[ |x]\] .+$/).present?) ||
(detail.value.is_a?(String) && detail.value.match(/^\[[ |x]\] .+$/).present?)
end
safe_attributes 'subject', 'position', 'issue_id', 'is_done', 'is_section'
def editable_by?(usr = User.current)
usr && (usr.allowed_to?(:edit_checklists, project) || (author == usr && usr.allowed_to?(:edit_own_checklists, project)))
end
def project
issue.project if issue
end
def info
"[#{is_done ? 'x' : ' '}] #{subject.strip}"
end
def add_to_list_bottom
return unless issue.checklists.select(&:persisted?).map(&:position).include?(self[position_column])
self[position_column] = bottom_position_in_list.to_i + 1
end
end

View File

@ -0,0 +1,129 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class JournalChecklistHistory
def self.can_fixup?(journal_details, prop_key = 'checklist')
return false if journal_details.journal.nil?
issue = journal_details.journal.journalized
return false unless issue.is_a?(Issue)
prev_journal_scope = issue.journals.order('id DESC')
prev_journal_scope = prev_journal_scope.where('id <> ?', journal_details.journal_id) if journal_details.journal_id
prev_journal = prev_journal_scope.first
return false unless prev_journal
return false if prev_journal.user_id != journal_details.journal.user_id
return false if Time.zone.now > prev_journal.created_on + 1.minute
prev_journal.details.all? { |x| x.prop_key == prop_key } &&
journal_details.journal.details.all? { |x| x.prop_key == prop_key } &&
journal_details.journal.notes.blank? &&
prev_journal.notes.blank? &&
prev_journal.details.select { |x| x.prop_key == prop_key }.size == 1
end
def self.fixup(journal_details, prop_key = 'checklist')
issue = journal_details.journal.journalized
prev_journal_scope = issue.journals.order('id DESC')
prev_journal_scope = prev_journal_scope.where('id <> ?', journal_details.journal_id) if journal_details.journal_id
prev_journal = prev_journal_scope.first
checklist_details = prev_journal.details.find{ |x| x.prop_key == prop_key}
if new(checklist_details.old_value, journal_details.value).empty_diff?
prev_journal.destroy
else
checklist_details.update(value: journal_details.value)
journal_details.journal.destroy unless journal_details.journal.new_record? && journal_details.journal.details.any?{ |x| x.prop_key != prop_key}
end
end
def initialize(was, become)
@was = force_object(was)
@become = force_object(become)
@was_ids = @was.map(&:id)
@become_ids = @become.map(&:id)
@both_ids = @become_ids & @was_ids
end
def diff
{
:undone => undone,
:done => done
}
end
def empty_diff?
diff.all?{ |_,v| v.empty? }
end
def journal_details(opts = {})
JournalDetail.new(opts.merge({
:property => 'attr',
:prop_key => 'checklist',
:old_value => @was.map(&:to_h).to_json,
:value => @become.map(&:to_h).to_json
}))
end
private
def undone
@both_ids.map do |id|
was_is_done = was_by_id(id).is_done
become_is_done = become_by_id(id).is_done
if was_is_done != become_is_done && was_is_done
become_by_id(id)
else
nil
end
end.compact
end
def done
@both_ids.map do |id|
was_is_done = was_by_id(id).is_done
become_is_done = become_by_id(id).is_done
if was_is_done != become_is_done && become_is_done
become_by_id(id)
else
nil
end
end.compact
end
def was_by_id(id)
@was.find{ |x| x.id == id }
end
def become_by_id(id)
@become.find{ |x| x.id == id }
end
def force_object(unk)
return [] if unk.nil?
if unk.is_a?(String)
json = JSON.parse(unk)
json = [json] unless json.is_a?(Array)
json.map{ |x| OpenStruct2.new(x.has_key?('checklist') ? x['checklist'] : x) }
else
unk.map{ |x| OpenStruct2.new(x.attributes) }
end
end
end

View File

@ -0,0 +1,34 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class JournalCustomFieldChecklistHistory < JournalChecklistHistory
private def force_object(unk)
return [] if unk.nil?
if unk.is_a?(String)
json = JSON.parse(unk)
json = [json] unless json.is_a?(Array)
json.map do |x|
item = x.has_key?('checklist') ? x['checklist'] : x
item[:id] = Digest::MD5.hexdigest(item['subject']) if item['subject']
OpenStruct2.new(item)
end
end
end
end

View File

@ -0,0 +1,11 @@
<li id="checklist_item_<%= checklist_item.id %>" class="<%= 'is-done-checklist-item' if checklist_item.is_done %> <%= 'checklist-section' if checklist_item.is_section %>">
<% unless checklist_item.is_section %>
<%= check_box_tag 'checklist_item', '', checklist_item.is_done,
disabled: !User.current.allowed_to?(:done_checklists, checklist_item.issue.project) && !User.current.allowed_to?(:edit_checklists, checklist_item.issue.project),
data_url: url_for({ controller: 'checklists', action: 'done', id: checklist_item.id }),
class: 'checklist-checkbox',
id: "checklist-checkbox-#{checklist_item.id}"
%>
<% end %>
<%= textilizable(checklist_item, :subject).gsub(/<\/?(p|h\d+|li|ul|hr \/)>/, '').strip.html_safe %>
</li>

View File

@ -0,0 +1,2 @@
$("#checklist_item_<%= @checklist_item_subject_hash %>").toggleClass('is-done-checklist-item');
$('#cf_checklist_custom_field .checklist-item#<%= @checklist_item_subject_hash %> input[type=checkbox]').trigger('click');

View File

@ -0,0 +1,17 @@
$("#checklist_item_<%= @checklist_item.id %>").toggleClass('is-done-checklist-item');
$('#checklist_form .checklist-item#<%= @checklist_item.id %> input[type=checkbox]').trigger('click');
$('.issue .attributes table.progress').parent().html('<%= j(progress_bar(@checklist_item.issue.done_ratio, :width => '80px', :legend => "#{@checklist_item.issue.done_ratio}%")) %>');
$('#issue_done_ratio').val('<%= @checklist_item.issue.done_ratio %>');
var checkedCheckboxes = $('#checklist_items .checklist-checkbox:checkbox:checked');
if(localStorage.getItem("hide_closed_checklists") === '0' && checkedCheckboxes.length > 0){
$("#checklist_item_<%= @checklist_item.id %>").fadeOut(1000).hide(15);
$('#switch_link').text('<%= l("label_checklist_show_closed") %>' + '(' + checkedCheckboxes.length + ')');
}
if(checkedCheckboxes.length < 1 && localStorage.getItem("hide_closed_checklists") === '1'){
$('#switch_link').hide();
}
if(checkedCheckboxes.length > 0){
$('#switch_link').show();
}

View File

@ -0,0 +1,15 @@
api.array :checklists, api_meta(:total_count => @checklists.size) do
@checklists.each do |checklist|
api.checklist do
api.id checklist.id
api.issue_id checklist.issue_id
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
end
end
end

View File

@ -0,0 +1,11 @@
api.checklist do
api.id @checklist_item.id
api.issue_id @checklist_item.issue_id
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
end

View File

@ -0,0 +1,19 @@
<% if !@issue.blank? && @issue.checklists.any? && User.current.allowed_to?(:view_checklists, @project) %>
<hr />
<div id="checklist">
<div class="contextual">
<%= link_to l("label_checklist_hide_closed"), '#', id: 'switch_link' %>
</div>
<p><strong><%=l(:label_checklist_plural)%></strong></p>
<ul id="checklist_items">
<% @issue.checklists.each do |checklist_item| %>
<%= render :partial => 'checklists/checklist_item', :object => checklist_item %>
<% end %>
</ul>
</div>
<%= javascript_tag do %>
new Redmine.ChecklistToggle('<%= l("label_checklist_show_closed") %>', '<%= l("label_checklist_hide_closed") %>');
$("#checklist_items").checklist();
<% end %>
<% end %>

View File

@ -0,0 +1,28 @@
<span class="checklist-item <%= new_or_show(f) %> <%= 'checklist-section' if f.object.is_section %> existing" id="<%= f.object.id %>">
<% unless f.object.is_section %>
<span class="checklist-show-only checklist-checkbox"><%= f.check_box :is_done %></span>
<% end %>
<span class="checklist-show checklist-subject <%= done_css(f) %>">
<%= f.object.subject.to_s.strip.gsub('<', '&lt;').gsub('>', '&gt;').html_safe %>
</span>
<span class="checklist-edit checklist-new checklist-edit-box">
<%= text_field_tag nil, f.object.subject, class: 'edit-box' %>
<%= f.hidden_field :subject, class: 'checklist-subject-hidden' %>
</span>
<span class="checklist-edit-only checklist-edit-save-button"><%= submit_tag l(:button_save), type: 'button', class: 'item item-save small' %> </span>
<span class="checklist-edit-only checklist-edit-reset-button"><% concat l(:button_cancel) %> </span>
<span class="checklist-show-only checklist-remove"><%= link_to_remove_checklist_fields sprite_icon('del', ''), f, class: 'icon icon-del' %></span>
<%= f.hidden_field :position, class: 'checklist-item-position' %>
<%= f.hidden_field :is_section, class: 'checklist-item-is_section' %>
<%= f.hidden_field :id, class: 'checklist-item-id' %>
<span class="icon icon-add checklist-new-only save-new-by-button">
<%= sprite_icon('add') %>
</span>
<br>
</span>

View File

@ -0,0 +1,23 @@
<% if User.current.allowed_to?(:edit_checklists, @project, :global => true) %>
<div class="tabular">
<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 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 %>
</span>
<% end %>
</p>
</div>
<% end %>
<%= javascript_tag do %>
<% unless User.current.allowed_to?(:done_checklists, @project) %>
$("#checklist_items input").attr("disabled", true);
<% end %>
$("span#checklist_form_items").checklist();
<% end %>

View File

@ -0,0 +1,8 @@
<% checklist_tabs = [
{:name => 'general', :partial => 'settings/checklists/general', :label => :label_general}]
%>
<%= render_tabs checklist_tabs %>
<% html_title(l(:label_settings), l(:label_checklists)) -%>

View File

@ -0,0 +1,13 @@
<% if Setting.issue_done_ratio == "issue_field" %>
<p>
<label for="settings_issue_done_ratio"><%= l(:label_checklist_done_ratio) %></label>
<%= hidden_field_tag 'settings[issue_done_ratio]', 0, :id => nil %>
<%= check_box_tag 'settings[issue_done_ratio]', 1, @settings["issue_done_ratio"].to_i > 0 %>
</p>
<% end %>
<p>
<label for="settings_block_issue_closing"><%= l(:label_checklist_block_issue_closing) %></label>
<%= hidden_field_tag 'settings[block_issue_closing]', 0, :id => nil %>
<%= check_box_tag 'settings[block_issue_closing]', 1, @settings["block_issue_closing"].to_i > 0 %>
</p>

View File

@ -0,0 +1,509 @@
if(typeof(String.prototype.trim) === "undefined")
{
String.prototype.trim = function()
{
return String(this).replace(/^\s+|\s+$/g, '');
};
}
/*! jQuery klass v0.2a - Jean-Louis Grall - MIT license - http://code.google.com/p/jquery-klass-plugin */
( function( $, undefined ) {
// Function: $.klass( [SuperKlass,] props )
// Creates and returns a new class.
// Usages: MyKlass = $.klass( { init: function() { ... } } )
// MyKlass = $.klass( SuperKlass, { } )
// Arguments:
// SuperKlass (optional) The super class that the new class will extend.
// props Set of methods and other class properties.
// Special props names:
// init The constructor. If omitted, an implicit init will be created.
// Thus all classes have an init method.
// _klass Set of class methods (static methods). They will be added directly to the class.
// Notes:
// - $.klass is the implicit super class, not Object
var $klass = $.klass = function( _super, fields ) { // The class factory. It is also the invisible "super class" of all classes. Methods added to its prototype will be available to all classes.
// If no _super:
if ( !fields ) {
fields = _super;
_super = undefined;
}
var
// init is our future class and constructor
// If no init is provided, make one (Implicit constructor)
klass = fields.init || ( fields.init = function() {
// Automatically calls the superconstructor if there is one.
_super && _super.prototype.init.apply( this, arguments );
} ),
// Used to make the new klass extends its super class
protoChainingProxy = function() { },
// klass.prototype
proto,
// index in loop
name;
// Prepare prototype chaining to the super class
// If no super class, use $.klass as implicit super class
protoChainingProxy.prototype = (_super || $klass).prototype;
// Make the [[prototype]]'s chain from klass to it's super class
proto = klass.prototype = new protoChainingProxy; // At the end we have: klass.prototype.[[prototype]] = protoChainingProxy.prototype = _super.prototype. Here the "new" operator creates the new object with the right prototype chain, but doesn't call the constructor because there is no "()". See also: http://brokenliving.blogspot.com/2009/09/simple-javascript-inheritance.html
// Now we have: klass.prototype.[[prototype]] = protoChainingProxy.prototype = _super.prototype
// Accessor for super klass ( can be undefined )
klass._super = _super;
// Add each function to the prototype of the new class (they are our new class methods):
for ( name in fields ) {
// Add the static variables to the new class:
if ( name === "_klass" ) $.extend( klass, fields[name] );
// Each new method keeps a reference to its name and its class, allowing us to find its super method dynamically at runtime:
else $.isFunction( proto[ name ] = fields[name] ) && ( fields[name]._klass = { klass: klass, name: name } );
}
// Sets the constructor for instanciated objects
proto.constructor = klass;
return klass;
},
Array_slice = [].slice;
/* $.klass.prototype */
// Properties assigned to it are available from any instance of a class made by $.klass
// Function: this._super( [ methodName,] arguments, args... )
// Calls a super method. Finds the super method dynamically.
// Usages: this._super( arguments, arg1, arg2, arg3, ... )
// this._super( "methodName", arguments, arg1, arg2, arg3, ... )
// Arguments:
// methodName (optional) Name of the super method.
// By default, use the name of the calling method.
// arguments You must give the arguments object here.
// args... List of arguments for the super method.
// Note:
// - Super methods are found dynamically by the function in the super class using the method's name.
$klass.prototype._super = function( arg0, arg1 ) {
var arg0IsArguments = arg0.callee,
_klass = ( arg0IsArguments ? arg0 : arg1 ).callee._klass,
name = arg0IsArguments ? _klass.name : arg0,
superMethod = _klass.klass._super.prototype[ name ];
return superMethod.apply( this, Array_slice.call( arguments, 1 + ( !arg0IsArguments ) ) );
};
})( jQuery );
var updateChecklistPositions = function() {
$(".checklist-item.existing").each(function(index, element){
$(element).children('.checklist-item-position').val(index);
});
}
var Redmine = Redmine || {};
Redmine.Checklist = $.klass({
preventEvent: function(event) {
if (event.preventDefault)
event.preventDefault()
else
event.returnValue = false
},
addChecklistFields: function() {
var new_id = new Date().getTime();
var regexp = new RegExp("new_checklist", "g");
appended = $(this.content.replace(regexp, new_id)).appendTo(this.root);
updateChecklistPositions();
appended.find('.edit-box').focus();
},
findSpan: function(event) {
return $(event.target).closest('.checklist-item')
},
findSpanBefore: function(elem) {
return elem.prevAll('span.checklist-item.new')
},
transformItem: function(event, elem, valueToSet, isSection) {
var checklistItem;
if (event) {
checklistItem = this.findSpan(event)
} else if (elem) {
checklistItem = this.findSpanBefore(elem)
} else {
checklistItem = this.root.find('span.checklist-item.new')
}
var val;
if (valueToSet) {
val = valueToSet
checklistItem.find('input.edit-box').val(val)
} else {
val = checklistItem.find('input.edit-box').val()
}
checklistItem.find('.checklist-subject').text(val)
checklistItem.find('.checklist-subject-hidden').val(val)
checklistItem.removeClass('edit')
checklistItem.removeClass('new')
checklistItem.addClass('show')
if (isSection) {
checklistItem.addClass('checklist-section');
checklistItem.children('.checklist-item-is_section').val(true);
}
},
resetItem: function(item) {
item.find('input.edit-box').val(item.find('checklist-subject-hidden').val() )
item.removeClass('edit')
item.addClass('show')
},
addChecklistItem: function(event) {
this.preventEvent(event);
this.transformItem(event);
this.addChecklistFields();
},
canSave: function(span) {
return (!span.hasClass('invalid')) && (span.find('input.edit-box').val().length > 0)
},
onEnterInNewChecklistItemForm: function() {
this.root.on('keydown', 'input.edit-box', $.proxy(function(event) {
if (event.which == 13) {
this.preventEvent(event)
span = this.findSpan(event)
if (this.canSave(span))
{
if (span.hasClass('edit'))
this.transformItem(event)
else
this.addChecklistItem(event)
}
}
}, this))
},
onClickPlusInNewChecklistItem: function() {
this.root.on('click', '.save-new-by-button', $.proxy(function(event){
span = this.findSpan(event)
if (this.canSave(span))
this.addChecklistItem(event)
}, this))
},
onClickAddChecklistItemMenuButton: function() {
var menuId = this.root.attr('data-id')
$(`#checklist-menu .add-checklist-item, #cf-checklist-menu_${menuId} .add-checklist-item`).on('click', $.proxy(function(event) {
this.preventEvent(event);
var span = $(`#${this.root.attr('id')} span.checklist-item.new`);
if (this.canSave(span)) {
this.transformItem();
this.addChecklistFields();
this.$plusButtonMenu.hide();
}
}, this))
},
onClickNewSectionMenuButton: function() {
var menuId = this.root.attr('data-id')
$(`#checklist-menu .add-checklist-section, #cf-checklist-menu_${menuId} .add-checklist-section`).on('click', $.proxy(function(event) {
this.preventEvent(event);
var span = $(`#${this.root.attr('id')} span.checklist-item.new`);
if (this.canSave(span)) {
this.transformItem(null, null, null, true);
this.addChecklistFields();
this.$plusButtonMenu.hide();
}
}, this))
},
onMouseEnterLeavePlusButton: function() {
var hideMenuTimer;
var $menu = this.$plusButtonMenu;
this.root.on('mouseenter', '.save-new-by-button', function() {
var $plusButton = $(this);
var position = $plusButton.position();
$menu.css('left', (position.left + 'px'));
$menu.css('top', (position.top + $plusButton.height() + 'px'));
$menu.css('position', 'absolute');
$menu.show();
});
this.root.on('mouseleave', '.save-new-by-button', function() {
hideMenuTimer = setTimeout(function() {
$menu.hide();
}, 500);
});
$(`.${this.root.attr('id')}`).on('mouseenter', function() {
clearTimeout(hideMenuTimer);
});
$(`.${this.root.attr('id')}`).on('mouseleave', function() {
$menu.hide();
});
},
onIssueFormSubmitRemoveEmptyChecklistItems: function() {
$('body').on('submit', '#issue-form', function(){
$('.checklist-subject-hidden').each(function(i, elem) {
if ($(elem).val() == "") {
$(elem).closest('.checklist-item').remove()
}
})
})
},
onChecklistRemove: function() {
this.root.on('click', '.checklist-remove a', $.proxy(function(event){
this.preventEvent(event);
var itemToRemove = this.findSpan(event);
var checkbox = itemToRemove.find(".checklist-remove input[type=hidden]");
if (checkbox.val() === "false") {
checkbox.val("1");
itemToRemove.removeClass('existing')
itemToRemove.fadeOut(200);
}
updateChecklistPositions();
}, this));
},
makeChecklistsSortable: function() {
var menuId = this.root.attr('data-id')
$(`#checklist_form_items, #cf_checklist_form_items_${menuId}`).sortable({
items: '.checklist-item.show',
helper: "clone",
stop: function (event, ui) {
if (ui.item.hasClass("edited-now")) {
$( this ).sortable( "cancel" );
}
if (ui.item.hasClass("edit-active")) {
$( this ).sortable( "cancel" );
}
updateChecklistPositions();
}
});
},
makeChecklistsEditable: function() {
this.root.on('click', '.checklist-subject', $.proxy(function(event) {
$('.checklist-item').each($.proxy(function(i, elem) {
if ($(elem).hasClass('edit'))
this.resetItem($(elem))
}, this))
span = this.findSpan(event)
span.addClass('edit')
span.removeClass('show')
span.find('.edit-box').val(span.find('.checklist-subject-hidden').val())
span.find('.edit-box').focus()
}, this));
this.root.on('click', '.checklist-edit-save-button', $.proxy(function(event){
this.transformItem(event)
}, this))
this.root.on('click', '.checklist-edit-reset-button', $.proxy(function(event){
this.resetItem(this.findSpan(event))
}, this))
},
onCheckboxChanged: function() {
this.root.on('change', 'input[type=checkbox]', $.proxy(function(event){
checkbox = $(event.target)
subj = this.findSpan(event).find('.checklist-show')
if (checkbox.is(':checked'))
subj.addClass('is-done-checklist-item')
else
subj.removeClass('is-done-checklist-item')
}, this))
},
onChangeCheckbox: function(){
this.root.on('change', 'input.checklist-checkbox', $.proxy(function(event) {
this.darkenCompletedSections();
checkbox = $(event.target)
url = checkbox.attr('data_url')
$.ajax({
type: "PUT",
url: url,
data: {
is_done: checkbox.prop('checked')
},
dataType: 'script'
})
}, this))
},
darkenCompletedSections: function() {
var isCompletedSection = true;
var reversedChecklistItems = $(`#${this.root.attr('id')} li`).get().reverse();
$(reversedChecklistItems).each(function(index, element) {
var $element = $(element);
if ($element.hasClass('checklist-section')) {
if (isCompletedSection) {
$element.addClass('completed-section')
} else {
$element.removeClass('completed-section')
}
isCompletedSection = true;
} else {
isCompletedSection = isCompletedSection && $element.children('.checklist-checkbox').is(':checked')
}
})
},
enableUniquenessValidation: function() {
this.root.on('input', 'input.edit-box', $.proxy(function(event) {
value = $(event.target).val()
span = this.findSpan(event)
span.removeClass('invalid')
$(`#${this.root.attr('id')} .checklist-item.existing`).each(function(i, elem) {
e = $(elem)
if (!e.is('.edit') && !e.is('.new'))
{
if ( (value == e.find('.edit-box').val()) )
{
span.addClass('invalid')
}
}
})
}, this))
},
hasAlreadyChecklistWithName: function(value) {
var ret = false;
$('.checklist-show.checklist-subject').each(function(i, elem) {
e = $(elem)
if (value == e.text().trim())
{
ret = true;
}
})
return ret;
},
assignTemplateSelectedEvent: function() {
this.$plusButtonMenu.on('click', 'li a.checklist-template', $.proxy(function(event) {
this.preventEvent(event);
items = $(event.target).data('template-items').split(/\n/);
for(var i = 0; i < items.length; i++) {
var item = items[i];
var isSection = item.slice(0, 2) === '--';
if (isSection) { item = item.slice(2) }
if (!this.hasAlreadyChecklistWithName(item)) {
this.transformItem(null, null, item, isSection);
this.addChecklistFields();
}
}
}, this))
},
init: function(element) {
this.root = element;
this.content = element.data('checklist-fields');
this.onEnterInNewChecklistItemForm();
this.onClickPlusInNewChecklistItem();
this.darkenCompletedSections();
if (this.content) {
this.$plusButtonMenu = $(`.${this.root.attr('id')}`).menu();
if (this.$plusButtonMenu.length > 0) {
this.onMouseEnterLeavePlusButton();
this.onClickAddChecklistItemMenuButton();
this.assignTemplateSelectedEvent();
this.onClickNewSectionMenuButton();
}
}
this.onIssueFormSubmitRemoveEmptyChecklistItems();
this.onChecklistRemove();
this.makeChecklistsSortable();
this.makeChecklistsEditable();
this.onCheckboxChanged();
this.onChangeCheckbox();
this.enableUniquenessValidation();
}
})
$.fn.checklist = function(element){
new Redmine.Checklist(this);
};
Redmine.ChecklistToggle = $.klass({
manageToggling: function (t_val) {
var checkedCheckboxes = $('#checklist_items .checklist-checkbox:checkbox:checked');
if(localStorage.getItem("hide_closed_checklists") === t_val){
$($(checkedCheckboxes).closest('li')).hide();
$(this.switch_link).text(this.show_text + '(' + checkedCheckboxes.length + ')');
} else {
$($(checkedCheckboxes).closest('li')).show();
$(this.switch_link).text(this.hide_text);
}
},
switch_link_click: function(){
var th = $(this)[0];
this.switch_link.click(function (e) {
e.preventDefault();
th.manageToggling("1");
var setVal = (localStorage.getItem("hide_closed_checklists") === "1") ? "0" : "1";
localStorage.setItem("hide_closed_checklists", setVal);
});
},
hide_switch_link: function(){
if($('.checklist-checkbox:checkbox:checked').length < 1){
this.switch_link.hide();
}
},
init: function(show_text, hide_text) {
this.show_text = show_text;
this.hide_text = hide_text;
this.switch_link = $('#switch_link');
this.manageToggling("0");
this.switch_link_click();
this.hide_switch_link();
}
});
$(document).ready(function () {
if (typeof(contextMenuCheckSelectionBox) === 'function') {
var originContextMenuCheckSelectionBox = contextMenuCheckSelectionBox;
contextMenuCheckSelectionBox = function (tr, checked) {
var $td = tr.find('td.checklist_relations');
var $cfs = tr.find('td.checklist');
var $checklist = $td.find('.checklist').detach();
var $cf_checklist = {};
$cfs.each(function (ind, el) {
$cf_checklist[`${ind}`] = $(el).find('div.cf_checklist').detach();
});
originContextMenuCheckSelectionBox(tr, checked);
$checklist.appendTo($td);
$cfs.each(function (ind, el) {
$cf_checklist[`${ind}`].appendTo($(el));
});
};
}
$('td.checklist ul.cf_checklist_items li input[type=checkbox]').each(function() {
$(this).removeAttr('data_url');
$(this).attr('disabled', 'disabled')
});
});

View File

@ -0,0 +1,175 @@
#checklist_form_items input[type="checkbox"],
#checklist_items input[type="checkbox"], .cf_checklist_form_items input[type="checkbox"] {
height: initial;
}
div.checklist_cf {
margin-bottom: 15px;
}
div#checklist ul {
list-style: none;
padding-left: 0px;
margin-bottom: 0px;
}
div.cf_checklist ul {
list-style: none;
padding-left: 0px;
margin: 0;
text-align: left;
}
div#checklist li {
padding-bottom: 10px;
margin-left: 10px;
}
div.cf_checklist li {
padding-bottom: 0;
margin-left: 0;
}
.checklist-checkbox {height: inherit}
#checklist li:hover a.delete, div.cf_checklist li:hover a.delete {opacity: 1;}
#checklist a.delete, div.cf_checklist a.delete {opacity: 0.4;}
span.checklist-item {
display: block;
margin-bottom: 5px;
}
span.checklist-subject.is-done-checklist-item,
span.is-done-checklist-item,
span.checklist-item.is-done-checklist-item,
#checklist_items li.is-done-checklist-item,
ul.cf_checklist_items li.is-done-checklist-item {
text-decoration: line-through;
color: #999;
}
span.checklist-remove { margin-left: 2px; opacity: 0.4;}
span.checklist-remove:hover {opacity: 1;}
span.checklist-edit-box input {
margin-right: 6px;
width: 40%;
-moz-transition: top 0.2s;
-o-transition: top 0.2s;
-webkit-transition: top 0.2s;
transition: top 0.2s;
}
.invalid span.checklist-edit-box input {
border-color: #b94a48;
color: #b94a48;
}
.invalid span.checklist-edit-box input:focus {
border-color: #953b39;
color: #b94a48;
}
.invalid .checklist-edit-save-button {
display: none;
}
span.checklist-edit-reset-button {
cursor: pointer;
color: #2996CC;
}
span.checklist-subject {cursor: pointer;}
span.checklist-item.show .checklist-edit,
span.checklist-item.show .checklist-edit-only,
span.checklist-item.show .checklist-new,
span.checklist-item.show .checklist-new-only,
span.checklist-item.edit .checklist-show,
span.checklist-item.edit .checklist-new-only,
span.checklist-item.new .checklist-edit-only,
span.checklist-item.new .checklist-show-or-edit,
span.checklist-item.new .checklist-show-only,
span.checklist-item.edit .checklist-show-only {
display: none;
}
div#checklist ol, div.cf_checklist ol {
display: inline-block;
padding-left: 0;
}
.checklist-section {
padding-top: 10px;
font-weight: bold;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #eee;
}
li.cf-checklist-section:first-child, span.checklist-item:first-child {
padding-top: 2px !important;
}
ul.cf_checklist_items li:last-child {
margin-bottom: 10px;
}
.checklist-item.checklist-section > .checklist-checkbox { display: none; }
#checklist_items li.checklist-section, ul.cf_checklist_items li.checklist-section {
padding-bottom: 5px;
margin-bottom: 5px;
}
.completed-section { color: #999; }
.save-new-by-button { cursor: pointer; }
table.list td.checklist_relations { text-align: left }
/* ========================================================================= */
/* Checklist context menu */
/* ========================================================================= */
#checklist-menu ul, #checklist-menu li, #checklist-menu a,
#cf-checklist-menu ul, ul.cf-checklist-menu li, ul.cf-checklist-menu a {
display:block;
margin:0;
padding:0;
border:0;
}
#checklist-menu, ul.cf-checklist-menu {
display: none;
position: absolute;
font-size: 0.9em;
}
#checklist-menu, #checklist-menu ul,
ul.cf-checklist-menu, ul.cf-checklist-menu ul {
width: 150px;
border: 1px solid #ccc;
background: white;
list-style: none;
padding: 2px;
border-radius: 2px;
z-index: 10;
}
#checklist-menu li, ul.cf-checklist-menu li {
position: relative;
padding: 1px;
border: 1px solid white;
}
#checklist-menu a:not(:has(svg)), ul.cf-checklist-menu a:not(:has(svg)) {
text-decoration: none !important;
padding: 2px 0px 2px 20px;
}
#checklist-menu a:hover, ul.cf-checklist-menu a:hover { color:#2A5685; }
#checklist-menu li:hover, ul.cf-checklist-menu li:hover { border:1px solid #628db6; background-color:#eef5fd; border-radius:3px; }

9
config/locales/bg.yml Normal file
View File

@ -0,0 +1,9 @@
# encoding: utf-8
bg:
label_checklist_plural: Чеклист
field_checklist: Чеклист
label_checklist_save_log: Съхраняване на записи в историята на дейността
label_checklist_done_ratio: Преизчисляване на процента готовност
permission_view_checklists: Разглеждане на чеклисти
permission_done_checklists: Изпълнение на чеклисти
permission_edit_checklists: Редактиране на чеклисти

44
config/locales/de.yml Normal file
View File

@ -0,0 +1,44 @@
# 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

49
config/locales/en.yml Normal file
View File

@ -0,0 +1,49 @@
# English strings go here for Rails i18n
en:
activerecord:
attributes:
checklists:
subject: Checklist subject
label_checklist_plural: Checklist
field_checklist: Checklist
label_checklist_save_log: Save changes to issue log
label_checklist_done_ratio: Set issue done ratio
permission_view_checklists: View checklist
permission_done_checklists: Done checklist items
permission_edit_checklists: Edit checklist items
label_checklist_template_category_plural: Template categories
label_checklist_template_category_new: New category
field_checklist_template_category: Category
label_checklist_templates: Checklist templates
label_checklist_new_checklist_template: New checklist template
field_template_items: Template items
label_checklist_template: Checklist template
label_add_checklists_from_template: Add from template
label_checklists_from_template: From template
label_select_template: "-- Select template --"
label_checklist_category_not_specified: "-- Not specified --"
label_checklists_description: 'Multiple values allowed (one line for each value)'
label_checklist_item: Checklist item
label_checklist_section: Checklist section
label_checklist_deleted: deleted
label_checklist_changed_from: changed from
label_checklist_changed_to: to
label_checklist_added: added
label_checklist_done: set to Done
label_checklist_undone: set to Not done
label_checklist_updated: Checklist item edited
label_checklist_status: Checklist status
label_checklist_status_done: Done
label_checklist_status_undone: Undone
label_checklist_is_default: Default
field_is_for_tracker: Tracker
label_checklists_must_be_completed: All checklists of an issue must be done before closing
label_checklist_block_issue_closing: Block issue closing
label_checklist_show_closed: Show closed
label_checklist_hide_closed: Hide closed
label_checklist_new_section: New section
label_checklist: Checklist
custom_field_checklist_section: "%{custom_field_name} section"
label_cf_checklist_non_unique_subject_error: Checklist items must be unique
label_cf_checklist_blank_subject_error: Checklist item cannot be blank

28
config/locales/es.yml Normal file
View File

@ -0,0 +1,28 @@
# Spanish strings go here for Rails i18n
es:
label_checklist_plural: Checklist
field_checklist: Checklist
label_checklist_save_log: Salvar cambios al log de la petición
label_checklist_done_ratio: Setear porcentaje de estado de petición
permission_view_checklists: Ver checklist
permission_done_checklists: Cerrar items de checklist
permission_edit_checklists: Editar iterms de checklist
label_checklist_template_category_plural: Categorías de plantillas
label_checklist_template_category_new: Nueva categoría
field_checklist_template_category: Categoría
label_checklist_templates: Plantillas de checklists
label_checklist_new_checklist_template: Nueva plantilla de checklist
field_template_items: Items de la plantilla
label_checklist_template: Plantilla de checklist
label_add_checklists_from_template: Añadir desde plantilla
label_select_template: "-- Seleccionar plantilla --"
label_checklist_category_not_specified: "-- No especificada --"
label_checklists_description: 'Se permiten múltiples valores (un valor por línea)'
label_checklist_item: Item de checklist
label_checklist_deleted: borrado
label_checklist_changed_from: cambiado de
label_checklist_changed_to: a
label_checklist_added: añadido
label_checklist_done: marcado como Hecho
label_checklist_undone: marcado como No hecho
label_checklist_updated: Item de checklist modificado

44
config/locales/fr.yml Normal file
View File

@ -0,0 +1,44 @@
# 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

44
config/locales/hr.yml Normal file
View File

@ -0,0 +1,44 @@
# Croatian (Hrvatski) strings go here for Rails i18n
hr:
activerecord:
attributes:
checklists:
subject: Checklist subject
label_checklist_plural: Checklist
field_checklist: Checklist
label_checklist_save_log: Save changes to issue log
label_checklist_done_ratio: Postavi postotak završenosti slučaja
permission_view_checklists: Prikaz liste zadataka
permission_done_checklists: Označi zadatak s liste završenim
permission_edit_checklists: Promjena zadatka na listi
label_checklist_template_category_plural: Kategorije predložaka
label_checklist_template_category_new: Nova kategorija
field_checklist_template_category: kategorija
label_checklist_templates: Predložal liste zadataka
label_checklist_new_checklist_template: Novi predložak liste zadataka
field_template_items: Stavke na predlošku
label_checklist_template: Predložak liste zadataka
label_add_checklists_from_template: Dodaj s predloška
label_checklists_from_template: Iz oredloška
label_select_template: "-- Odaberi predložak --"
label_checklist_category_not_specified: "-- Nije definirano --"
label_checklists_description: 'Dozvoljeno je više vrijednosti (jedan red za svaku vrijednost)'
label_checklist_item: Stavka na listi
label_checklist_section: Dio liste zadataka
label_checklist_deleted: obrisano
label_checklist_changed_from: promijenjeno Iz
label_checklist_changed_to: u
label_checklist_added: dodano
label_checklist_done: označi kao završeno
label_checklist_undone: označi kao Nezavršeno
label_checklist_updated: Stavka liste je promijenjena
label_checklist_status: Status liste zadataka
label_checklist_status_done: Završeno
label_checklist_status_undone: Undone
label_checklist_is_default: Standardno
field_is_for_tracker: Vrsta slučaja
label_checklists_must_be_completed: Sve stavke na listi slučaja moraju biti završene prije zatvaranja slučaja
label_checklist_block_issue_closing: Onemogući zatvaranje slučaja
label_checklist_show_closed: Prikaži završene
label_checklist_hide_closed: Sakrij završene
label_checklist_new_section: Novi dio

47
config/locales/hu.yml Normal file
View File

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

45
config/locales/it.yml Normal file
View File

@ -0,0 +1,45 @@
# encoding: utf-8
# Italian strings go here for Rails i18n
it:
activerecord:
attributes:
checklists:
subject: Checklist soggetto
label_checklist_plural: Checklist
field_checklist: Checklist
label_checklist_save_log: Salva le modifiche nel log delle segnalazioni
label_checklist_done_ratio: Imposta ratio checklist segnalazioni completate
permission_view_checklists: Visualizza la checklist
permission_done_checklists: Elementi checklist completati
permission_edit_checklists: Modifica elementi checklist
label_checklist_template_category_plural: Categorie di modelli
label_checklist_template_category_new: Nuova categoria
field_checklist_template_category: Categoria
label_checklist_templates: Modelli di checklist
label_checklist_new_checklist_template: Nuovo modello di checklist
field_template_items: Elementi del modello
label_checklist_template: Modello di checklist
label_add_checklists_from_template: Aggiungi dal modello
label_checklists_from_template: Dal modello
label_select_template: "- Seleziona modello -"
label_checklist_category_not_specified: "-- Non specificato --"
label_checklists_description: "Sono consentiti più valori (una riga per ciascun valore)"
label_checklist_item: Elemento della checklist
label_checklist_section: Sezione checklist
label_checklist_deleted: Eliminato
label_checklist_changed_from: Modificato da
label_checklist_changed_to: a
label_checklist_added: aggiunto
label_checklist_done: Impostato su Completato
label_checklist_undone: Impostato su Non completato
label_checklist_updated: Elemento della checklist aggiornato
label_checklist_status: Stato della checklist
label_checklist_status_done: Completato
label_checklist_status_undone: Non completato
label_checklist_is_default: Predefinito
field_is_for_tracker: Tracker
label_checklists_must_be_completed: Tutte le liste di controllo di una segnalazione devono essere eseguite prima della chiusura
label_checklist_block_issue_closing: Blocca segnalazione in chiusura
label_checklist_show_closed: Mostra completati
label_checklist_hide_closed: Nascondi completati
label_checklist_new_section: Nuova sezione

44
config/locales/ja.yml Normal file
View File

@ -0,0 +1,44 @@
ja:
activerecord:
attributes:
checklists:
subject: "チェックリスト名称" # Checklist subject
label_checklist_plural: "チェックリスト" # Checklist
field_checklist: "チェックリスト" # Checklist
label_checklist_save_log: "変更をチケットに記録する" # Save changes to issue log
label_checklist_done_ratio: "チェックリストの進捗率を更新する" # Set issue done ratio
permission_view_checklists: "チェックリストの表示" # View checklist
permission_done_checklists: "チェック項目の完了" # Done checklist items
permission_edit_checklists: "チェック項目の編集" # Edit checklist items
permission_manage_checklist_templates: "チェックリストの雛形の管理"
label_checklist_template_category_plural: "雛形のカテゴリ" # Template categories
label_checklist_template_category_new: "新規カテゴリ" # New category
field_checklist_template_category: "カテゴリ" # Category
label_checklist_templates: "チェックリスト雛形" # Checklist templates
label_checklist_new_checklist_template: "新規チェックリスト雛形" # New checklist template
field_template_items: "チェック項目" # Template items
label_checklist_template: "チェックリスト雛形" # Checklist template
label_add_checklists_from_template: "雛形から追加" # Add from template
label_checklists_from_template: "雛形から選択" # From template
label_select_template: "-- 雛形を選択 --" # "-- Select template --"
label_checklist_category_not_specified: "-- 未選択--" # "-- Not specified --"
label_checklists_description: '複数指定可能1行毎に1つのチェック項目になります' # 'Multiple values allowed (one line for each value)'
label_checklist_item: "チェック項目" # Checklist item
label_checklist_section: "節見出し" # Checklist section
label_checklist_deleted: "削除済" # deleted
label_checklist_changed_from: "変更前" # changed from
label_checklist_changed_to: "変更後" # to
label_checklist_added: "作成済" # added
label_checklist_done: "完了" # set to Done
label_checklist_undone: "未完了" # set to Not done
label_checklist_updated: "チェック項目が編集されました" # Checklist item edited
label_checklist_status: "チェックリストの状態" # Checklist status
label_checklist_status_done: "完了" # Done
label_checklist_status_undone: "未完了" # Undone
label_checklist_is_default: "デフォルトにする" # Default
field_is_for_tracker: "トラッカー" # Tracker
label_checklists_must_be_completed: "未チェックの項目があるのでチケットを完了できません" # All checklists of an issue must be done before closing
label_checklist_block_issue_closing: "チケットの完了をブロックする" # Block issue closing
label_checklist_show_closed: "完了した項目を表示" # Show closed
label_checklist_hide_closed: "完了した項目を隠す" # Hide closed
label_checklist_new_section: "節見出しの追加" # New section

11
config/locales/ko.yml Normal file
View File

@ -0,0 +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: "체크리스트 수정"
label_checklists_must_be_completed: "일감을 완료하려면 모든 체크리스트가 완료되어야 합니다."
label_checklist_block_issue_closing: "일감이 종료되는 것을 방지합니다."

44
config/locales/nl.yml Normal file
View File

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

28
config/locales/pl.yml Normal file
View File

@ -0,0 +1,28 @@
# English strings go here for Rails i18n
pl:
label_checklist_plural: Lista
field_checklist: Checklista
label_checklist_save_log: Zapisuj zmiany w historii
label_checklist_done_ratio: Ustawia wskaźnik wykonania dla zgłoszeń
permission_view_checklists: Zobacz listę
permission_done_checklists: Ustaw jako ukończone elementy checklisty
permission_edit_checklists: Edytuj elementy checklisty
label_checklist_template_category_plural: Kategorie szablonów
label_checklist_template_category_new: Nowa kategoria
field_checklist_template_category: Kategoria
label_checklist_templates: Szablony checklist
label_checklist_new_checklist_template: New checklist template
field_template_items: Elementy szablonu
label_checklist_template: Szablon checklisty
label_add_checklists_from_template: Dodaj z szablonu
label_select_template: "-- Wybierz szablon --"
label_checklist_category_not_specified: "-- Nie wybrano --"
label_checklists_description: 'Dozwolone wiele wartości (po jednej linii dla każdej wartości)'
label_checklist_item: Element checklisty
label_checklist_deleted: usunięty
label_checklist_changed_from: zmieniony z
label_checklist_changed_to: na
label_checklist_added: dodany
label_checklist_done: ustaw jako Wykonane
label_checklist_undone: ustaw jako Niewykonane
label_checklist_updated: Zmieniono element checklisty

44
config/locales/pt-BR.yml Normal file
View File

@ -0,0 +1,44 @@
#Portuguese Brazilian strings go here for Rails i18n
pt-BR:
activerecord:
attributes:
checklists:
subject: Checklist conteúdo
label_checklist_plural: Checklist
field_checklist: Checklist
label_checklist_save_log: Salvar alterações nas notas
label_checklist_done_ratio: Atribuir % conclusão
permission_view_checklists: Ver checklist
permission_done_checklists: Prontos do checklist
permission_edit_checklists: Editar checklist
label_checklist_template_category_plural: Categoria de templates
label_checklist_template_category_new: Nova categoria
field_checklist_template_category: Categoria
label_checklist_templates: Checklist templates
label_checklist_new_checklist_template: Novo checklist template
field_template_items: Template items
label_checklist_template: Checklist template
label_add_checklists_from_template: Adicionar do template
label_checklists_from_template: Do template
label_select_template: "-- Selecione o template --"
label_checklist_category_not_specified: "-- Não especificado --"
label_checklists_description: 'Permitir multiplos valores'
label_checklist_item: Checklist item
label_checklist_section: Checklist sessão
label_checklist_deleted: deletado
label_checklist_changed_from: alterado por
label_checklist_changed_to: para
label_checklist_added: adicionado
label_checklist_done: alterar para concluído
label_checklist_undone: alterar para não concluído
label_checklist_updated: Checklist item editado
label_checklist_status: Checklist status
label_checklist_status_done: Pronto
label_checklist_status_undone: Não pronto
label_checklist_is_default: Padrão
field_is_for_tracker: Tipo
label_checklists_must_be_completed: Para concluir a tarefa, todos os checklists devem estar prontos
label_checklist_block_issue_closing: Bloquear tarefa ao concluir
label_checklist_show_closed: Mostrar concluídos
label_checklist_hide_closed: Esconder concluídos
label_checklist_new_section: Nova sessão

44
config/locales/pt.yml Normal file
View File

@ -0,0 +1,44 @@
#Portuguese Portugal strings go here for Rails i18n
pt:
activerecord:
attributes:
checklists:
subject: Checklist conteúdo
label_checklist_plural: Checklist
field_checklist: Checklist
label_checklist_save_log: Salvar alterações nas notas
label_checklist_done_ratio: Atribuir % conclusão
permission_view_checklists: Ver checklist
permission_done_checklists: Prontos do checklist
permission_edit_checklists: Editar checklist
label_checklist_template_category_plural: Categoria de templates
label_checklist_template_category_new: Nova categoria
field_checklist_template_category: Categoria
label_checklist_templates: Checklist templates
label_checklist_new_checklist_template: Novo checklist template
field_template_items: Template items
label_checklist_template: Checklist template
label_add_checklists_from_template: Adicionar do template
label_checklists_from_template: Do template
label_select_template: "-- Selecione o template --"
label_checklist_category_not_specified: "-- Não especificado --"
label_checklists_description: 'Permitir multiplos valores'
label_checklist_item: Checklist item
label_checklist_section: Checklist sessão
label_checklist_deleted: deletado
label_checklist_changed_from: alterado por
label_checklist_changed_to: para
label_checklist_added: adicionado
label_checklist_done: alterar para concluído
label_checklist_undone: alterar para não concluído
label_checklist_updated: Checklist item editado
label_checklist_status: Checklist status
label_checklist_status_done: Pronto
label_checklist_status_undone: Não pronto
label_checklist_is_default: Padrão
field_is_for_tracker: Tipo
label_checklists_must_be_completed: Para concluir a tarefa, todos os checklists devem estar prontos
label_checklist_block_issue_closing: Bloquear tarefa ao concluir
label_checklist_show_closed: Mostrar concluídos
label_checklist_hide_closed: Esconder concluídos
label_checklist_new_section: Nova sessão

51
config/locales/ru.yml Normal file
View File

@ -0,0 +1,51 @@
# encoding: utf-8
ru:
activerecord:
attributes:
checklists:
subject: Заголовок чеклиста
label_checklist_plural: Чеклист
field_checklist: Чеклист
label_checklist_save_log: Сохранять изменения в истории
label_checklist_done_ratio: Рассчитывать готовность задачи
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_template: Шаблон чеклистов
label_add_checklists_from_template: Добавить из шаблона
label_checklists_from_template: Из шаблона
label_select_template: "-- Выберите шаблон --"
label_checklist_category_not_specified: "-- Без категории --"
label_checklists_description: 'Для ввода нескольких значений вводите по одному на строку'
label_checklist_item: Пункт чеклиста
label_checklist_section: Раздел чеклиста
label_checklist_deleted: удалён
label_checklist_changed_from: изменён с
label_checklist_changed_to: на
label_checklist_added: добавлен
label_checklist_done: выполнен
label_checklist_undone: не выполнен
label_checklist_updated: Пункт чеклиста изменен
label_checklist_status: Статус пункта чеклиста
label_checklist_status_done: Выполнен
label_checklist_status_undone: Не выполнен
label_checklist_is_default: По умолчанию
field_is_for_tracker: Трекер
label_checklist_show_closed: Показать закрытые
label_checklist_hide_closed: Скрыть закрытые
label_checklist_new_section: Новая секция
label_checklist_block_issue_closing: Запретить закрытие заявки
label_checklists: Чеклист
label_checklist: Чеклист
label_checklists_must_be_completed: Чтобы заявка закрылась, должны быть выполнены все пункты чеклиста
field_checklists: Чеклист
custom_field_checklist_section: "%{custom_field_name} section"
label_cf_checklist_non_unique_subject_error: Пункты чеклиста должны быть уникальными
label_cf_checklist_blank_subject_error: Пункт чеклиста не может быть пустым

10
config/locales/sk.yml Normal file
View File

@ -0,0 +1,10 @@
# encoding: utf-8
# Slovak strings go here for Rails i18n
sk:
label_checklist_plural: Checklist
field_checklist: Checklist
label_checklist_save_log: Uložiť zmeny do histórie úlohy
label_checklist_done_ratio: Nastaviť úlohu ako kompletnú
permission_view_checklists: Zobraziť checklist
permission_done_checklists: Splnené checklist položky
permission_edit_checklists: Upraviť checklist položky

46
config/locales/sv.yml Normal file
View File

@ -0,0 +1,46 @@
# Swedish strings go here for Rails i18n
# Translation by Khedron Wilk (khedron.wilk@gmail.com)
# Created 2014 Dec 14 Based on RedmineUP Checklist plugin (Light) ver 3.0.2
sv:
activerecord:
attributes:
checklists:
subject: Checklista ärende
label_checklist_plural: Checklista
field_checklist: Checklista
label_checklist_save_log: Spara ändringar i ärendeloggen
label_checklist_done_ratio: 'Använd checklista för att beräkna "% Klart"'
permission_view_checklists: Visa checklistor
permission_done_checklists: Avklarade checklistepunkter
permission_edit_checklists: Redigera checklistepunkter
label_checklist_template_category_plural: Mallkategorier
label_checklist_template_category_new: Ny kategori
field_checklist_template_category: Kategori
label_checklist_templates: Mallar för checklistor
label_checklist_new_checklist_template: Ny mall
field_template_items: Punkter för mallen
label_checklist_template: Mallchecklista
label_add_checklists_from_template: Lägg till från mall
label_checklists_from_template: Från mall
label_select_template: "-- välj mall --"
label_checklist_category_not_specified: "-- ej vald --"
label_checklists_description: Ingående punkter (en rad per punkt)
label_checklist_item: Checklistepunkt # label_checklist_items: Checklistepunkter
label_checklist_section: Checklistesektion
label_checklist_deleted: borttagen
label_checklist_changed_from: ändrad från
label_checklist_changed_to: till
label_checklist_added: tillagd
label_checklist_done: satt som Avklarad
label_checklist_undone: satt som Ej klar
label_checklist_updated: Checklista punkt redigerad
label_checklist_status: Checklistestatus
label_checklist_status_done: Avklarad
label_checklist_status_undone: Ej klar
label_checklist_is_default: Vald som standard
field_is_for_tracker: Ärendetyp
label_checklists_must_be_completed: "Alla checklistor/punkter måste vara avklarade innan ett ärende kan stängas"
label_checklist_block_issue_closing: Blockera ärendestängning
label_checklist_show_closed: Visa ibockade
label_checklist_hide_closed: Dölj ibockade
label_checklist_new_section: Ny sektion

44
config/locales/tr.yml Normal file
View File

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

9
config/locales/uk.yml Normal file
View File

@ -0,0 +1,9 @@
# encoding: utf-8
uk:
label_checklist_plural: Чекліст
field_checklist: Чекліст
label_checklist_save_log: Зберегти зміни в історії
label_checklist_done_ratio: Розрахувати готовність завдання
permission_view_checklists: Переглядати чеклісти
permission_done_checklists: Виконувати чеклісти
permission_edit_checklists: Редагувати чеклісти

44
config/locales/zh-TW.yml Normal file
View File

@ -0,0 +1,44 @@
# encoding: utf-8
# Simplified Chinese strings go here for Rails i18n
# Author: Steven.W
# Based on file: en.yml
zh-TW:
label_checklist_plural: 檢查清單
field_checklist: 檢查清單
label_checklist_save_log: 保存檢查清單的變更到問題日誌
label_checklist_done_ratio: 設置列表完成比率
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_template: 檢查清單範本
label_add_checklists_from_template: 從範本新建
label_checklists_from_template: 從範本中新增
label_select_template: "-- 選擇範本 --"
label_checklist_category_not_specified: "-- 未指定 --"
label_checklists_description: '允許多重值 (每一行的值)'
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: 檢查清單項目編輯
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: 新增區塊

32
config/locales/zh.yml Normal file
View File

@ -0,0 +1,32 @@
# encoding: utf-8
# Simplified Chinese strings go here for Rails i18n
# Author: Steven.W
# Based on file: en.yml
zh:
label_checklist_plural: 检查列表
field_checklist: 检查列表
label_checklist_save_log: 保存检查列表变更到问题日志
label_checklist_done_ratio: 设置列表完成比率
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_template: 检查列表模板
label_add_checklists_from_template: 从模板新建
label_select_template: "-- 选择模板 --"
label_checklist_category_not_specified: "-- 未指定 --"
label_checklists_description: '允许多重值 (每一行的值)'
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: 检查列表项编辑

28
config/routes.rb Normal file
View File

@ -0,0 +1,28 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
resources :issues do
resources :checklists, :only => [:index, :create]
end
resources :checklists, :only => [:destroy, :update, :show] do
member do
put :done
end
end

View File

@ -0,0 +1,38 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class CreateChecklists < ActiveRecord::Migration[4.2]
def self.up
if ActiveRecord::Base.connection.table_exists? :issue_checklists
rename_table :issue_checklists, :checklists
else
create_table :checklists do |t|
t.boolean :is_done, :default => false
t.string :subject
t.integer :position, :default => 1
t.references :issue, :null => false
end
end
end
def self.down
drop_table :checklists
end
end

View File

@ -0,0 +1,25 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class AddTimeStampsToChecklists < ActiveRecord::Migration[4.2]
def change
add_column :checklists, :created_at, :timestamp
add_column :checklists, :updated_at, :timestamp
end
end

View File

@ -0,0 +1,32 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class CreateChecklistTemplateCategory < ActiveRecord::Migration[4.2]
def self.up
create_table :checklist_template_categories do |t|
t.string :name
t.integer :position, :default => 1
end
end
def self.down
drop_table :checklist_template_categories
end
end

View File

@ -0,0 +1,36 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class CreateChecklistTemplates < ActiveRecord::Migration[4.2]
def self.up
create_table :checklist_templates do |t|
t.string :name
t.references :project
t.references :category
t.references :user
t.boolean :is_public
t.text :template_items
end
end
def self.down
drop_table :checklist_templates
end
end

View File

@ -0,0 +1,28 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class ModifyChecklistSubjectLength < ActiveRecord::Migration[4.2]
def self.up
change_column :checklists, :subject, :text, :limit => 1000
end
def self.down
change_column :checklists, :subject, :string, :limit => 256
end
end

View File

@ -0,0 +1,31 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
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
add_index :checklist_templates, :tracker_id
end
def self.down
remove_column :checklist_templates, :is_default
remove_column :checklist_templates, :tracker_id
end
end

View File

@ -0,0 +1,24 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
class AddIsSectionToChecklists < (Rails.version < '5.1') ? ActiveRecord::Migration : ActiveRecord::Migration[4.2]
def change
add_column :checklists, :is_section, :boolean, default: false
end
end

209
doc/CHANGELOG Normal file
View File

@ -0,0 +1,209 @@
== Redmine Checklists plugin changelog
Redmine Checklists plugin - managing issue checklists plugin for Redmine
Copyright (C) 2011-2025 Kirill Bezrukov (RedmineUP)
http://www.redmineup.com/
== 2025-10-02 v4.0.0
* Added Checklist format for custom fields
* Updated API format for checklist custom field format
* Updated Japanese locale (Hideki Sakamoto)
== 2025-07-09 v3.1.27
* Added Croatian (Hrvatski) locale (Josip Golubić)
* Added compatibility with a third-party plugin (Dashboard)
* Added support for very long checklist items
== 2025-03-03 v3.1.26
* Added Redmine 6.0 compatibility
* Added svg icons for compatibility with Redmine 6
* Updated Swedish locale (Jimmy Westberg)
== 2024-08-28 v3.1.25
* Fixed copying of checklists with bulk copying of issues
* Fixed notifications when changing a checklist and a log at the same time
== 2024-05-27 v3.1.24
* Updated Redmine 5.0 compatibility
* Fixed input for items with <> tags
== 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
* Fixed empty project errors
* Fixed notification on journal fixup
* Fixed checklist positions bug
== 2020-08-17 v3.1.18
* Added italian locale
* Updated zh-tw locale
* Fixed size() method error
* Fixed initial install error
* Fixed checklist ration recalculate
* Fixed display checklist element with Markdown syntax
* Fixed done ratio recalculate on checklist API update
* Fixed API call journalizing
== 2020-01-31 v3.1.17
* Redmine 4.1 compatibility fixes
* Fixed view permission bug
* Fixed template permissions bug
* Fixed context menu conflicts
* Fixed Agile support
* Fixed checklist copy bug
* Fixed locale bug
* Fixed project copy bug
== 2019-04-29 v3.1.16
* Checklists sections
== 2019-04-15 v3.1.15
* Redmine 4.0.3 support
* Added Hide link for closed items
== 2018-12-20 v3.1.14
* Hotfix for Redmine 4
== 2018-12-18 v3.1.13
* Redmine 4 saving issue fixes
== 2018-11-26 v3.1.12
* German translation update from Tobias Fischer
* Fixed diferent authors changes bug
* Fixed sortable animation bug
== 2018-03-23 v3.1.11
* Redmine 4 support
* Setting for block issues with undone checklists
* Fixed bug with default template
* Fixed email notification bug
== 2017-10-12 v3.1.10
* Fixed email notification bug
* Fixed empty project issues bug
== 2017-09-23 v3.1.9
* Fixed bug with creating issues without checklist
== 2017-09-21 v3.1.8
* Default templates bug fixed
== 2017-08-30 v3.1.7
* Assigned tracker for checklist template
* Fixed bug with coping project and issue with subissues
* Fixed settings saving bug
* 512 characters in checklist subjects (Ondřej Kudlík)
* Fixed bug for markdown
== 2017-07-07 v3.1.6
* Redmine 3.4 support
* New checklists filters for issues table
* Save log by default
* Chinese translation update
* Polish translation update
* Fixed bug with template editing
== 2016-08-15 v3.1.5
* Fixed bug with project tabs
== 2016-08-10 v3.1.4
* Fixed empty history items for issues with checklists
* Fixed XSS in journal rendering
* Fixed error with template search in MSSQL
* Banner plugin compatibility
* Fixed for-all-project template option
* Validation for subject length
* Hungarian translation by Peter Tabajdi
* Spanish translation update by Luis Blasco
* Merge checklists history if less than minute interval changes
== 2015-09-25 v3.1.3
* Bug with attach files history fixed
* Bug with old checkboxes fixed
== 2015-09-25 v3.1.2
* Issue history details
* Templates permissions fixes
== 2015-04-08 v3.1.0
* Checklist templates
== 2015-03-06 v3.0.4
* Redmine 3.0 compatibility fixes
* Fixed checklist styles on read only issue mode
== 2015-02-23 v3.0.3
* Swedish translation update (Khedron Wilk)
* Portuguese Brazilian translation (Leandro Gehlen)
* Redmine 3.0 (Rails4) support
* Copying checklists with project copying (Andrew Reshetov)
* Fixed bug with unable editing checklist after tracker or status changed
== 2014-12-09 v3.0.2
* Fixed bug wuth empty subject with CKEditor plugin
== 2014-09-15 v3.0.1
* Bulgarian translation (Иван Ценов)
* Fixed bug with IE browser
== 2014-09-10 v3.0.0
* Editing checklist items
* REST API for index, create, destroy, update, show
* Change issues progress in real time
* Sync checked items with show and edit forms
* Fixed bug with rejecting new checklist items on update issue status
* Japan translation (Yukio KANEDA)

339
doc/COPYING Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

26
doc/LICENSE Normal file
View File

@ -0,0 +1,26 @@
LICENSING
RedmineUP Licencing
This End User License Agreement is a binding legal agreement between you and RedmineUP. Purchase, installation or use of RedmineUP Extensions provided on redmineup.com signifies that you have read, understood, and agreed to be bound by the terms outlined below.
RedmineUP GPL Licencing
All Redmine Extensions produced by RedmineUP are released under the GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html). Specifically, the Ruby code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript are NOT GPL, and are released under the RedmineUP Proprietary Use License v1.0 (See below) unless specifically authorized by RedmineUP. Elements of the extensions released under this proprietary license may not be redistributed or repackaged for use other than those allowed by the Terms of Service.
RedmineUP Proprietary Use License (v1.0)
The RedmineUP Proprietary Use License covers any images, cascading stylesheets, manuals and JavaScript files in any extensions produced and/or distributed by redmineup.com. These files are copyrighted by redmineup.com (RedmineUP) and cannot be redistributed in any form without prior consent from redmineup.com (RedmineUP)
Usage Terms
You are allowed to use the Extensions on one or many "production" domains, depending on the type of your license
You are allowed to make any changes to the code, however modified code will not be supported by us.
Modification Of Extensions Produced By RedmineUP.
You are authorized to make any modification(s) to RedmineUP extension Ruby code. However, if you change any Ruby code and it breaks functionality, support may not be available to you.
In accordance with the RedmineUP Proprietary Use License v1.0, you may not release any proprietary files (modified or otherwise) under the GPL license. The terms of this license and the GPL v2 prohibit the removal of the copyright information from any file.
Please contact us if you have any requirements that are not covered by these terms.

53
init.rb Normal file
View File

@ -0,0 +1,53 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.
requires_redmineup version_or_higher: '1.0.10' rescue raise "\n\033[31mRedmine requires newer redmineup gem version.\nPlease update with 'bundle update redmineup'.\033[0m"
CHECKLISTS_VERSION_NUMBER = '4.0.0'.freeze
CHECKLISTS_VERSION_TYPE = "Light version"
Redmine::Plugin.register :redmine_checklists do
name "Redmine Checklists plugin (#{CHECKLISTS_VERSION_TYPE})"
author 'RedmineUP'
description 'This is a issue checklist plugin for Redmine'
version CHECKLISTS_VERSION_NUMBER
url 'https://www.redmineup.com/pages/plugins/checklists'
author_url 'mailto:support@redmineup.com'
requires_redmine version_or_higher: '4.0'
settings default: {
save_log: true,
issue_done_ratio: false
}, partial: 'settings/checklists/checklists'
Redmine::AccessControl.map do |map|
map.project_module :issue_tracking do |map|
map.permission :view_checklists, { checklists: [:show, :index] }
map.permission :done_checklists, { checklists: :done }
map.permission :edit_checklists, { checklists: [:done, :create, :destroy, :update] }
end
end
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'
require 'redmineup/patches/compatibility_patch'

46
lib/redmine_checklists.rb Normal file
View File

@ -0,0 +1,46 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 RedmineChecklists
def self.settings() Setting.plugin_redmine_checklists.blank? ? {} : Setting.plugin_redmine_checklists end
def self.block_issue_closing?
settings['block_issue_closing'].to_i > 0
end
def self.issue_done_ratio?
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) }

View File

@ -0,0 +1,31 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 RedmineChecklists
module Hooks
class ControllerIssuesHook < Redmine::Hook::ViewListener
def controller_issues_edit_after_save(context = {})
if (Setting.issue_done_ratio == 'issue_field') && RedmineChecklists.issue_done_ratio?
Checklist.recalc_issue_done_ratio(context[:issue].id)
end
end
end
end
end

View File

@ -0,0 +1,27 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 RedmineChecklists
module Hooks
class ViewsIssuesHook < Redmine::Hook::ViewListener
render_on :view_issues_show_description_bottom, :partial => "issues/checklist"
render_on :view_issues_form_details_bottom, :partial => "issues/checklist_form"
end
end
end

View File

@ -0,0 +1,29 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 RedmineChecklists
module Hooks
class ViewsLayoutsHook < Redmine::Hook::ViewListener
def view_layouts_base_html_head(context={})
return javascript_include_tag(:checklists, :plugin => 'redmine_checklists') +
stylesheet_link_tag(:checklists, :plugin => 'redmine_checklists')
end
end
end
end

View File

@ -0,0 +1,36 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 RedmineChecklists
module Patches
module ApplicationHelperPatch
def self.included(base) # :nodoc:
base.class_eval do
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
end
end
end
end
end
unless ApplicationHelper.included_modules.include?(RedmineChecklists::Patches::ApplicationHelperPatch)
ApplicationHelper.send(:include, RedmineChecklists::Patches::ApplicationHelperPatch)
end

View File

@ -0,0 +1,38 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 'ostruct'
class OpenStruct2 < OpenStruct
undef id if defined?(id)
def to_h
json
end
def [](key)
json[key.to_s]
end
def json
return @json if @json
@json = JSON.parse(to_json)
@json = @json['table'] if @json.has_key?('table')
@json
end
end

View File

@ -0,0 +1,32 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 RedmineChecklists
module Patches
module HelperForChecklistsPatch
def self.apply(controller)
controller.send(:helper, 'checklists')
end
end
end
end
[IssuesController].each do |controller|
RedmineChecklists::Patches::HelperForChecklistsPatch.apply(controller)
end

View File

@ -0,0 +1,80 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 'issue'
module RedmineChecklists
module Patches
module IssuePatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
base.class_eval do
attr_accessor :old_checklists, :removed_checklist_ids, :checklists_from_params
attr_reader :copied_from
alias_method :after_create_from_copy_without_checklists, :after_create_from_copy
alias_method :after_create_from_copy, :after_create_from_copy_with_checklists
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? }
validate :block_issue_closing_if_checklists_unclosed
safe_attributes 'checklists_attributes',
:if => lambda { |issue, user| (user.allowed_to?(:done_checklists, issue.project) || user.allowed_to?(:edit_checklists, issue.project)) }
end
end
module InstanceMethods
def copy_checklists
checklists_attributes = copied_from.checklists.map { |checklist| checklist.attributes.dup.except('id', 'issue_id').merge('issue_id' => id) }
checklists.create(checklists_attributes)
end
def after_create_from_copy_with_checklists
after_create_from_copy_without_checklists
copy_checklists if copy? && checklists.blank? && copied_from.checklists.present? && !checklists_from_params
end
def all_checklist_items_is_done?
(checklists - checklists.where(id: removed_checklist_ids)).reject(&:is_section).all?(&:is_done)
end
def need_to_block_issue_closing?
RedmineChecklists.block_issue_closing? &&
checklists.reject(&:is_section).any? &&
status.is_closed? &&
!all_checklist_items_is_done?
end
def block_issue_closing_if_checklists_unclosed
if need_to_block_issue_closing?
errors.add(:checklists, l(:label_checklists_must_be_completed))
end
end
end
end
end
end
unless Issue.included_modules.include?(RedmineChecklists::Patches::IssuePatch)
Issue.send(:include, RedmineChecklists::Patches::IssuePatch)
end

View File

@ -0,0 +1,38 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 'query'
module RedmineChecklists
module Patches
module IssueQueryPatch
def self.included(base)
base.send(:include, InstanceMethods)
end
module InstanceMethods
end
end
end
end
if (ActiveRecord::Base.connection.tables.include?('queries') rescue false) &&
IssueQuery.included_modules.exclude?(RedmineChecklists::Patches::IssueQueryPatch)
IssueQuery.send(:include, RedmineChecklists::Patches::IssueQueryPatch)
end

View File

@ -0,0 +1,87 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 RedmineChecklists
module Patches
module IssuesControllerPatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
base.class_eval do
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]
end
end
module InstanceMethods
def build_new_issue_from_params_with_checklist
if params[:id].blank?
begin
if params[:copy_from].blank?
else
fill_checklist_attributes
end
rescue ActiveRecord::RecordNotFound
render_404
return
end
end
build_new_issue_from_params_without_checklist
@issue.checklists_from_params = true
end
def save_before_state
@issue.old_checklists = @issue.checklists.to_json
checklists_params = params.dig(:issue, :checklists_attributes) || {}
@issue.removed_checklist_ids =
if checklists_params.present?
checklists_params = checklists_params.to_unsafe_hash if checklists_params.respond_to?(:to_unsafe_hash)
checklists_params.map { |_k, v| v['id'].to_i if ['1', 'true'].include?(v['_destroy']) }.compact
else
[]
end
end
def fill_checklist_attributes
return unless params[:issue].blank?
@copy_from = Issue.visible.find(params[:copy_from])
add_checklists_to_params(@copy_from.checklists)
end
def add_checklists_to_params(checklists)
params[:issue].blank? ? params[:issue] = { :checklists_attributes => {} } : params[:issue][:checklists_attributes] = {}
checklists.each_with_index do |checklist_item, index|
params[:issue][:checklists_attributes][index.to_s] = {
is_done: checklist_item.is_done,
subject: checklist_item.subject,
position: checklist_item.position,
is_section: checklist_item.is_section
}
end
end
end
end
end
end
unless IssuesController.included_modules.include?(RedmineChecklists::Patches::IssuesControllerPatch)
IssuesController.send(:include, RedmineChecklists::Patches::IssuesControllerPatch)
end

View File

@ -0,0 +1,94 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 RedmineChecklists
module Patches
module IssuesHelperPatch
def self.included(base)
base.send(:include, InstanceMethods)
base.class_eval do
alias_method :details_to_strings_without_checklists, :details_to_strings
alias_method :details_to_strings, :details_to_strings_with_checklists
end
end
module InstanceMethods
def details_to_strings_with_checklists(details, no_html = false, options = {})
custom_field_checklist_ids = @issue.available_custom_fields.select { |cf| cf.field_format == 'checklist' }.pluck(:id)
details_checklist, details_other = details.partition{ |x| x.prop_key == 'checklist' || custom_field_checklist_ids.include?(x.prop_key.to_i) }
if @issue.nil? || !User.current.allowed_to?(:view_checklists, @issue.try(:project), global: @issue.present?)
return details_to_strings_without_checklists(details_other, no_html, options)
end
details_checklist.map do |detail|
result = []
diff = Hash.new([])
if detail.custom_field.present?
item_name = { name: detail.custom_field.name, section: l(:custom_field_checklist_section, custom_field_name: detail.custom_field.name) }
else
item_name = { name: l(:label_checklist_item), section: l(:label_checklist_item) }
end
if Checklist.old_format?(detail)
result << "<b>#{item_name[:name]}</b> #{l(:label_checklist_changed_from)} #{detail.old_value} #{l(:label_checklist_changed_to)} #{detail.value}"
else
diff = custom_field_checklist_ids.include?(detail.prop_key.to_i) ? JournalCustomFieldChecklistHistory.new(detail.old_value, detail.value).diff : JournalChecklistHistory.new(detail.old_value, detail.value).diff
end
checklist_item_label = lambda do |item|
item[:is_section] ? item_name[:section] : item_name[:name]
end
if diff[:done].any?
diff[:done].each do |item|
result << "<b>#{ERB::Util.h item_name[:name]}</b> <input type='checkbox' class='checklist-checkbox' #{item.is_done ? 'checked' : '' } disabled> <i>#{ERB::Util.h item[:subject]}</i> #{ERB::Util.h l(:label_checklist_done)}"
end
end
if diff[:undone].any?
diff[:undone].each do |item|
result << "<b>#{ERB::Util.h item_name[:name]}</b> <input type='checkbox' class='checklist-checkbox' #{item.is_done ? 'checked' : '' } disabled> <i>#{ERB::Util.h item[:subject]}</i> #{ERB::Util.h l(:label_checklist_undone)}"
end
end
result = result.join('</li><li>').html_safe
result = nil if result.blank?
if result && no_html
result = result.gsub /<\/li><li>/, "\n"
result = result.gsub /<input type='checkbox' class='checklist-checkbox'[^c^>]*checked[^>]*>/, '[x]'
result = result.gsub /<input type='checkbox' class='checklist-checkbox'[^c^>]*>/, '[ ]'
result = result.gsub /<[^>]*>/, ''
result = CGI.unescapeHTML(result)
end
result
end.compact + details_to_strings_without_checklists(details_other, no_html, options)
end
end
end
end
end
unless IssuesHelper.included_modules.include?(RedmineChecklists::Patches::IssuesHelperPatch)
IssuesHelper.send(:include, RedmineChecklists::Patches::IssuesHelperPatch)
end

View File

@ -0,0 +1,20 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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/>.

View File

@ -0,0 +1,39 @@
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 'project'
module RedmineChecklists
module Patches
module ProjectPatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
base.class_eval do
end
end
module InstanceMethods
end
end
end
end
unless Project.included_modules.include?(RedmineChecklists::Patches::ProjectPatch)
Project.send(:include, RedmineChecklists::Patches::ProjectPatch)
end

27
test/fixtures/checklists.yml vendored Normal file
View File

@ -0,0 +1,27 @@
---
# === Checklist for Issue(1) ===
one:
id: 1
is_done: false
subject: First todo
issue_id: 1
two:
id: 2
is_done: true
subject: Second todo
issue_id: 1
# === Checklist for Issue(2) ===
section_one:
id: 4
is_done: false
subject: New section
is_section: true
issue_id: 2
three:
id: 3
is_done: true
subject: Third todo
issue_id: 2

View File

@ -0,0 +1,90 @@
# encoding: utf-8
#
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 File.expand_path('../../test_helper', __FILE__)
class ChecklistsControllerTest < ActionController::TestCase
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields,
:custom_values,
:custom_fields_projects,
:custom_fields_trackers,
:time_entries,
:journals,
:journal_details,
:queries
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/', [:checklists])
def setup
RedmineChecklists::TestCase.prepare
Setting.default_language = 'en'
Project.find(1).enable_module!(:checklists)
User.current = nil
@project_1 = Project.find(1)
@issue_1 = Issue.find(1)
@checklist_1 = Checklist.find(1)
end
test "should post done" do
# log_user('admin', 'admin')
@request.session[:user_id] = 1
compatible_xhr_request :put, :done, :is_done => 'true', :id => '1'
assert_response :success, 'Post done not working'
assert_equal true, Checklist.find(1).is_done, 'Post done not working'
end
test "should not post done by deny user" do
# log_user('admin', 'admin')
@request.session[:user_id] = 5
compatible_xhr_request :put, :done, :is_done => true, :id => "1"
assert_response 403, "Post done accessible for all"
end
test "should view issue with checklist" do
# log_user('admin', 'admin')
@request.session[:user_id] = 1
@controller = IssuesController.new
compatible_request :get, :show, :id => @issue_1.id
assert_select 'ul#checklist_items li#checklist_item_1', @checklist_1.subject, "Issue won't view for admin"
end
test "should not view issue with checklist if deny" do
# log_user('anonymous', '')
@request.session[:user_id] = 5
@controller = IssuesController.new
compatible_request :get, :show, :id => @issue_1.id
assert_select 'ul#checklist_items', false, "Issue view for anonymous"
end
end

View File

@ -0,0 +1,286 @@
# encoding: utf-8
#
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 File.expand_path('../../test_helper', __FILE__)
# Re-raise errors caught by the controller.
# class HelpdeskMailerController; def rescue_action(e) raise e end; end
class IssuesControllerTest < ActionController::TestCase
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields,
:custom_values,
:custom_fields_projects,
:custom_fields_trackers,
:time_entries,
:journals,
:journal_details,
:queries
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/', [:checklists])
def setup
@request.session[:user_id] = 1
@custom_field_checklist_params = {
checklist: {
'0' => {
subject: "Item A",
_destroy: "false",
position: "0",
is_section: "false",
id: ""
}
}
}
RedmineChecklists::TestCase.prepare
@custom_field_checklist = Issue.find(1).available_custom_fields.detect { |custom_field| custom_field.name == 'Test checklist' }
end
def test_new_issue_without_project
compatible_request :get, :new
assert_response :success
end
def test_get_show_issue
issue = Issue.find(1)
assert_not_nil issue.checklists.first
compatible_request(:get, :show, :id => 1)
assert_response :success
assert_select "ul#checklist_items li#checklist_item_1", /First todo/
assert_select "ul#checklist_items li#checklist_item_1 input[checked=?]", "checked", { :count => 0 }
assert_select "ul#checklist_items li#checklist_item_2 input[checked=?]", "checked"
end
def test_get_edit_issue
compatible_request :get, :edit, :id => 1
assert_response :success
end
def test_get_copy_issue
compatible_request :get, :new, :project_id => 1, :copy_from => 1
assert_response :success
assert_select "span#checklist_form_items span.checklist-subject", { :count => 3 }
assert_select "span#checklist_form_items span.checklist-edit input[value=?]", "First todo"
end
def test_put_update_form
parameters = {:tracker_id => 2,
:checklists_attributes => {
"0" => {"is_done"=>"0", "subject"=>"FirstChecklist"},
"1" => {"is_done"=>"0", "subject"=>"Second"}}}
@request.session[:user_id] = 1
issue = Issue.find(1)
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
end
def test_added_attachment_shows_in_log_once
Setting[:plugin_redmine_checklists] = { :save_log => 1, :issue_done_ratio => 0 }
set_tmp_attachments_directory
parameters = { :tracker_id => 2,
:checklists_attributes => {
'0' => { 'is_done' => '0', 'subject' => 'First' },
'1' => { 'is_done' => '0', 'subject' => 'Second' } } }
@request.session[:user_id] = 1
issue = Issue.find(1)
compatible_request :post, :update, :issue => parameters,
:attachments => { '1' => { 'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file' } },
:project_id => issue.project,
:id => issue.to_param
assert_response :redirect
assert_equal 1, Journal.last.details.where(:property => 'attachment').count
end
def test_history_dont_show_old_format_checklists
Setting[:plugin_redmine_checklists] = { :save_log => 1, :issue_done_ratio => 0 }
@request.session[:user_id] = 1
issue = Issue.find(1)
issue.journals.create!(:user_id => 1)
issue.journals.last.details.create!(:property => 'attr',
:prop_key => 'checklist',
:old_value => '[ ] TEST',
:value => '[x] TEST')
compatible_request :post, :show, :id => issue.id
assert_response :success
last_journal = issue.journals.last
assert_equal last_journal.details.size, 1
assert_equal last_journal.details.first.prop_key, 'checklist'
assert_select "#change-#{last_journal.id} ul li", 'Checklist item changed from [ ] TEST to [x] TEST'
end
def test_empty_update_dont_write_to_journal
@request.session[:user_id] = 1
issue = Issue.find(1)
journals_before = issue.journals.count
compatible_request :post, :update, :issue => {}, :id => issue.to_param, :project_id => issue.project
assert_response :redirect
assert_equal journals_before, issue.reload.journals.count
end
def test_create_issue_without_checklists
@request.session[:user_id] = 1
assert_difference 'Issue.count' do
compatible_request :post, :create, :project_id => 1, :issue => { :tracker_id => 3,
:status_id => 2,
:subject => 'NEW issue without checklists',
:description => 'This is the description'
}
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
issue = Issue.find_by_subject('NEW issue without checklists')
assert_not_nil issue
end
def test_create_issue_with_checklists
@request.session[:user_id] = 1
assert_difference 'Issue.count' do
compatible_request :post, :create, :project_id => 1, :issue => { :tracker_id => 3,
:status_id => 2,
:subject => 'NEW issue with checklists',
:description => 'This is the description',
:checklists_attributes => { '0' => { 'is_done' => '0', 'subject' => 'item 001', 'position' => '1' } }
}
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
issue = Issue.find_by_subject('NEW issue with checklists')
assert_equal 1, issue.checklists.count
assert_equal 'item 001', issue.checklists.last.subject
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'
@request.session[:user_id] = 1
assert_difference 'Issue.count' do
compatible_request :post, :create, :format => :json, :project_id => 1, :issue => { :tracker_id => 3,
:status_id => 2,
:subject => 'NEW JSON issue',
:description => 'This is the description',
:checklists_attributes => [{ :is_done => 0, :subject => 'JSON checklist' }]
},
:key => User.find(1).api_key
end
assert_response :created
issue = Issue.find_by_subject('NEW JSON issue')
assert_not_nil issue
assert_equal 1, issue.checklists.count
ensure
Setting.rest_api_enabled = old_value
end
def test_history_displaying_for_checklist
@request.session[:user_id] = 1
Setting[:plugin_redmine_checklists] = { save_log: 1, issue_done_ratio: 0 }
issue = Issue.find(1)
journal = issue.journals.create!(user_id: 1)
journal.details.create!(:property => 'attr',
:prop_key => 'checklist',
:old_value => '[ ] TEST',
:value => '[x] TEST')
# With permissions
@request.session[:user_id] = 1
compatible_request :get, :show, id: issue.id
assert_response :success
assert_include 'changed from [ ] TEST to [x] TEST', response.body
# Without permissions
@request.session[:user_id] = 5
compatible_request :get, :show, id: issue.id
assert_response :success
assert_not_include 'changed from [ ] TEST to [x] TEST', response.body
end
def test_bulk_copy_issues_with_checklists
@target_project = Project.find(2)
@target_project.issues.destroy_all
issue1 = Issue.find(1) # issue with checklists
issue3 = Issue.find(3) # issue without checklists
@request.session[:user_id] = 2
assert_difference 'Issue.count', 2 do
assert_no_difference 'Project.find(1).issues.count' do
post(
:bulk_update,
:params => {
:ids => [issue1.id, issue3.id],
:copy => '1',
:issue => {
:project_id => @target_project.id,
:tracker_id => '',
:assigned_to_id => '2',
:status_id => '1'
}
}
)
end
end
copied_issues = Issue.where(project_id: @target_project.id)
assert_equal 2, copied_issues.count
copied_issues.each do |issue|
assert_equal @target_project.id, issue.project_id, "Project is incorrect"
assert_equal 2, issue.assigned_to_id, "Assigned to is incorrect"
assert_equal 1, issue.status_id, "Status is incorrect"
end
issue_with_checklists = copied_issues.select { |issue| issue.checklists.present? }.first
assert_equal issue1.checklists.count, issue_with_checklists.checklists.count
end
end

View File

@ -0,0 +1,166 @@
# encoding: utf-8
#
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 File.expand_path('../../../test_helper', __FILE__)
class Redmine::ApiTest::ChecklistsTest < Redmine::ApiTest::Base
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields,
:custom_values,
:custom_fields_projects,
:custom_fields_trackers,
:time_entries,
:journals,
:journal_details,
:queries
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/', [:checklists])
def setup
Setting.rest_api_enabled = '1'
end
def test_get_checklists_xml
compatible_api_request :get, '/issues/1/checklists.xml', {}, credentials('admin')
assert_select 'checklists[type=array]' do
assert_select 'checklist' do
assert_select 'id', :text => '1'
assert_select 'subject', :text => 'First todo'
end
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')
assert_select 'checklist' do
assert_select 'id', :text => '1'
assert_select 'subject', :text => 'First todo'
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',
:is_done => true } }
assert_difference('Checklist.count') do
compatible_api_request :post, '/issues/1/checklists.xml', parameters, credentials('admin')
end
checklist = Checklist.order('id DESC').first
assert_equal parameters[:checklist][:subject], checklist.subject
assert_response :created
assert_match 'application/xml', @response.content_type
assert_select 'checklist id', :text => checklist.id.to_s
end
def test_put_checklists_1_xml
parameters = { :checklist => { subject: 'Item_UPDATED', is_done: '1' } }
assert_no_difference('Checklist.count') do
compatible_api_request :put, '/checklists/1.xml', parameters, credentials('admin')
end
checklist = Checklist.find(1)
assert_equal parameters[:checklist][:subject], checklist.subject
end
def test_recalculate_ratio_after_multirequests
issue = Issue.find(1)
with_checklists_settings('issue_done_ratio' => '1') do
assert_equal 0, issue.reload.done_ratio
parameters_array = [
[1, { :checklist => { subject: 'Item 1', is_done: '1' } }],
[2, { :checklist => { subject: 'Item 2', is_done: '1' } }],
[1, { :checklist => { subject: 'Item 1', is_done: '0' } }],
[2, { :checklist => { subject: 'Item 2', is_done: '1' } }]
]
assert_no_difference('Checklist.count') do
parameters_array.each do |params|
compatible_api_request :put, "/checklists/#{params[0]}.xml", params[1], credentials('admin')
assert ['200', '204'].include?(response.code)
end
end
assert_equal 50, issue.reload.done_ratio
end
end
def test_delete_1_xml
assert_difference 'Checklist.count', -1 do
compatible_api_request :delete, '/checklists/1.xml', {}, credentials('admin')
end
assert ['200', '204'].include?(response.code)
assert_equal '', @response.body
assert_nil Checklist.find_by_id(1)
end
end

View File

@ -0,0 +1,62 @@
# encoding: utf-8
#
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 File.expand_path('../../test_helper', __FILE__)
class CommonIssueTest < RedmineChecklists::IntegrationTest
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields,
:custom_values,
:custom_fields_projects,
:custom_fields_trackers,
:time_entries,
:journals,
:journal_details,
:queries
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/', [:checklists])
def setup
RedmineChecklists::TestCase.prepare
Setting.default_language = 'en'
@project_1 = Project.find(1)
@issue_1 = Issue.find(1)
@checklist_1 = Checklist.find(1)
end
def test_global_search_with_checklist
log_user('admin', 'admin')
compatible_request :get, '/search?q=First'
assert_response :success
end
end

86
test/test_helper.rb Normal file
View File

@ -0,0 +1,86 @@
# encoding: utf-8
#
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper')
module RedmineChecklists
module TestHelper
def compatible_request(type, action, parameters = {})
return send(type, action, :params => parameters) if Rails.version >= '5.1'
send(type, action, parameters)
end
def compatible_xhr_request(type, action, parameters = {})
return send(type, action, :params => parameters, :xhr => true) if Rails.version >= '5.1'
xhr type, action, parameters
end
def compatible_api_request(type, action, parameters = {}, headers = {})
return send(type, action, :params => parameters, :headers => headers) if Redmine::VERSION.to_s >= '3.4'
send(type, action, parameters, headers)
end
def issues_in_list
ids = css_select('tr.issue td.id a').map { |tag| tag.to_s.gsub(/<.*?>/, '') }.map(&:to_i)
Issue.where(:id => ids).sort_by { |issue| ids.index(issue.id) }
end
def with_checklists_settings(options, &block)
original_settings = Setting.plugin_redmine_checklists
Setting.plugin_redmine_checklists = original_settings.merge(Hash[options.map {|k,v| [k, v]}])
yield
ensure
Setting.plugin_redmine_checklists = original_settings
end
end
end
include RedmineChecklists::TestHelper
class RedmineChecklists::IntegrationTest < Redmine::IntegrationTest; end
class RedmineChecklists::TestCase
def self.create_fixtures(fixtures_directory, table_names, class_names = {})
ActiveRecord::FixtureSet.create_fixtures(fixtures_directory, table_names, class_names = {})
end
def self.prepare
Role.find([1,2]).each do |r| # For anonymous
r.permissions << :view_checklists
r.save
end
Role.find(1, 2, 3, 4).each do |r|
r.permissions << :edit_checklists
r.save
end
Role.find(3, 4).each do |r|
r.permissions << :done_checklists
r.save
end
Role.find([2]).each do |r|
r.permissions << :manage_checklist_templates
r.save
end
end
end

138
test/unit/checklist_test.rb Normal file
View File

@ -0,0 +1,138 @@
# encoding: utf-8
#
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 File.expand_path('../../test_helper', __FILE__)
class ChecklistTest < ActiveSupport::TestCase
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields,
:custom_values,
:custom_fields_projects,
:custom_fields_trackers,
:time_entries,
:journals,
:journal_details,
:queries
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/', [:checklists])
def setup
RedmineChecklists::TestCase.prepare
Setting.default_language = 'en'
@project_1 = Project.find(1)
@issue_1 = Issue.create(:project_id => 1, :tracker_id => 1, :author_id => 1,
:status_id => 1, :priority => IssuePriority.first,
:subject => 'Invoice Issue 1')
@checklist_1 = Checklist.create(:subject => 'TEST1', :position => 1, :issue => @issue_1)
end
test "should save checklist" do
assert @checklist_1.save, "Checklist save error"
end
test "should not save checklist without subject" do
@checklist_1.subject = nil
assert !@checklist_1.save, "Checklist save with nil subject"
end
test "should not save checklist without position" do
@checklist_1.position = nil
assert !@checklist_1.save, "Checklist save with nil position"
end
test "should not save checklist with non integer position" do
@checklist_1.position = "string"
assert !@checklist_1.save, "Checklist save with non ingeger position"
end
test "should return project info" do
assert_equal @project_1, @checklist_1.project, "Helper project broken"
end
test "should return info about checklist" do
assert_equal "[ ] #{@checklist_1.subject}", @checklist_1.info, "Helper info broken"
@checklist_1.is_done = 1
assert_equal "[x] #{@checklist_1.subject}", @checklist_1.info, "Helper info broken"
end
def test_should_correct_recalculate_rate
issues = [
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #1", done_ratio: 0,
checklists_attributes: {
'0' => { subject: 'item 1', is_done: false },
'1' => { subject: 'item 2', is_done: false },
'2' => { subject: 'item 3', is_done: true },
}),
30],
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #2", done_ratio: 0,
checklists_attributes: {
'0' => { subject: 'item 1', is_done: false },
'1' => { subject: 'item 2', is_done: true },
'2' => { subject: 'item 3', is_done: true },
}),
60],
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #3", done_ratio: 0,
checklists_attributes: {
'0' => { subject: 'item 1', is_done: true },
'1' => { subject: 'item 2', is_done: true },
'2' => { subject: 'item 3', is_done: true },
}),
100],
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #4", done_ratio: 0,
checklists_attributes: {
'0' => { subject: 'item 1', is_done: false },
'1' => { subject: 'item 2', is_done: false },
'2' => { subject: 'section 1', is_done: true, is_section: true },
'3' => { subject: 'item 3', is_done: true },
}),
30],
[Issue.create(project_id: 1, tracker_id: 1, author_id: 1, status_id: 1, priority: IssuePriority.first, subject: "TI #5", done_ratio: 0,
checklists_attributes: {
'0' => { subject: 'section 1', is_done: true, is_section: true }
}),
0]
]
with_checklists_settings('issue_done_ratio' => '1') do
issues.each do |issue, after_ratio|
assert_equal 0, issue.done_ratio
Checklist.recalc_issue_done_ratio(issue.id)
issue.reload
assert_equal after_ratio, issue.done_ratio
end
end
ensure
issues.each { |issue, ratio| issue.destroy }
end
end

85
test/unit/issue_test.rb Normal file
View File

@ -0,0 +1,85 @@
# encoding: utf-8
#
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 File.expand_path('../../test_helper', __FILE__)
include RedmineChecklists::TestHelper
class IssueTest < ActiveSupport::TestCase
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields,
:custom_values,
:custom_fields_projects,
:custom_fields_trackers,
:time_entries,
:journals,
:journal_details,
:queries
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/', [:checklists])
def setup
RedmineChecklists::TestCase.prepare
Setting.default_language = 'en'
@project = Project.find(1)
@issue = Issue.create(:project => @project, :tracker_id => 1, :author_id => 1,
:status_id => 1, :priority => IssuePriority.first,
:subject => 'TestIssue')
@checklist_1 = Checklist.create(:subject => 'TEST1', :position => 1, :issue => @issue)
@checklist_2 = Checklist.create(:subject => 'TEST2', :position => 2, :issue => @issue, :is_done => true)
@issue.reload
end
def test_issue_shouldnt_close_when_it_has_unfinished_checklists
with_checklists_settings('block_issue_closing' => '1') do
@issue.status_id = 5
assert !@issue.valid?
end
end
def test_validation_should_be_ignored_if_setting_disabled
with_checklists_settings('block_issue_closing' => '0') do
@issue.status_id = 5
assert @issue.valid?
end
end
def test_issue_should_close_when_all_checklists_finished
with_checklists_settings('block_issue_closing' => '1') do
@checklist_1.update(is_done: true)
assert @issue.valid?
end
ensure
@checklist_1.update(is_done: false)
end
end

73
test/unit/project_test.rb Normal file
View File

@ -0,0 +1,73 @@
# encoding: utf-8
#
# This file is a part of Redmine Checklists (redmine_checklists) plugin,
# issue checklists management plugin for Redmine
#
# Copyright (C) 2011-2025 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 File.expand_path('../../test_helper', __FILE__)
class ProjectTest < ActiveSupport::TestCase
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:versions,
:trackers,
:projects_trackers,
:issue_categories,
:enabled_modules,
:enumerations,
:attachments,
:workflows,
:custom_fields,
:custom_values,
:custom_fields_projects,
:custom_fields_trackers,
:time_entries,
:journals,
:journal_details,
:queries
RedmineChecklists::TestCase.create_fixtures(Redmine::Plugin.find(:redmine_checklists).directory + '/test/fixtures/',
[:checklists])
def setup
RedmineChecklists::TestCase.prepare
Setting.default_language = 'en'
@project_1 = Project.find(1)
@issue_1 = Issue.create(:project => @project_1, :tracker_id => 1, :author_id => 1,
:status_id => 1, :priority => IssuePriority.first,
:subject => 'TestIssue')
@checklist_1 = Checklist.create(:subject => 'TEST1', :position => 1, :issue => @issue_1)
@checklist_1 = Checklist.create(:subject => 'TEST2', :position => 2, :issue => @issue_1, :is_done => true)
end
test 'should copy checklists' do
project_copy = Project.copy_from(Project.find(1))
project_copy.name = 'Test name'
project_copy.identifier = Project.next_identifier
project_copy.copy(Project.find(1))
checklists_copies = project_copy.issues.where(:subject => 'TestIssue').first.checklists
assert_equal(checklists_copies.count, 2)
assert_equal(checklists_copies.where(:subject => 'TEST1').first.is_done, false)
assert_equal(checklists_copies.where(:subject => 'TEST2').first.is_done, true)
end
end