redmine_extensions 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/redmine_extensions/entity/entity_generator.rb +21 -24
- data/lib/generators/redmine_extensions/entity/templates/_form.html.erb.erb +4 -0
- data/lib/generators/redmine_extensions/entity/templates/_sidebar.html.erb.erb +1 -1
- data/lib/generators/redmine_extensions/entity/templates/context_menu.html.erb.erb +1 -1
- data/lib/generators/redmine_extensions/entity/templates/controller.rb.erb +19 -16
- data/lib/generators/redmine_extensions/entity/templates/custom_field.rb.erb +7 -7
- data/lib/generators/redmine_extensions/entity/templates/edit.js.erb.erb +10 -9
- data/lib/generators/redmine_extensions/entity/templates/en.yml.erb +1 -2
- data/lib/generators/redmine_extensions/entity/templates/index.api.rsb.erb +5 -5
- data/lib/generators/redmine_extensions/entity/templates/index.html.erb.erb +2 -0
- data/lib/generators/redmine_extensions/entity/templates/index.js.erb.erb +7 -6
- data/lib/generators/redmine_extensions/entity/templates/mail_added.html.erb.erb +1 -1
- data/lib/generators/redmine_extensions/entity/templates/mail_added.text.erb.erb +2 -2
- data/lib/generators/redmine_extensions/entity/templates/mail_updated.text.erb.erb +2 -2
- data/lib/generators/redmine_extensions/entity/templates/migration.rb.erb +3 -1
- data/lib/generators/redmine_extensions/entity/templates/model.rb.erb +4 -4
- data/lib/generators/redmine_extensions/entity/templates/new.js.erb.erb +10 -9
- data/lib/generators/redmine_extensions/entity/templates/query.rb.erb +8 -5
- data/lib/generators/redmine_extensions/entity/templates/routes.rb.erb +12 -12
- data/lib/generators/redmine_extensions/entity/templates/show.html.erb.erb +37 -37
- data/lib/generators/redmine_extensions/entity/templates/show.js.erb.erb +7 -6
- data/lib/generators/redmine_extensions/plugin/plugin_generator.rb +3 -1
- data/lib/generators/redmine_extensions/plugin/templates/after_init.rb.erb +22 -0
- data/lib/generators/redmine_extensions/plugin/templates/init.rb.erb +4 -22
- data/lib/generators/redmine_extensions/plugin/templates/javascript.js +1 -0
- data/lib/generators/redmine_extensions/plugin/templates/stylesheet.css +3 -0
- data/lib/redmine_extensions/version.rb +1 -1
- metadata +12 -216
- data/app/assets/javascripts/redmine_extensions/redmine_extensions.js.orig +0 -648
- data/app/views/easy_entity_assignments/_query_index.html.erb.orig +0 -16
- data/lib/redmine_extensions/redmine_patches/controllers/issues_controller_patch.rb +0 -9
- data/lib/redmine_extensions/version.rb.orig +0 -7
- data/spec/redmine/app/controllers/custom_field_enumerations_controller.rb +0 -75
- data/spec/redmine/app/controllers/imports_controller.rb +0 -121
- data/spec/redmine/app/helpers/imports_helper.rb +0 -47
- data/spec/redmine/app/models/custom_field_enumeration.rb +0 -90
- data/spec/redmine/app/models/import.rb +0 -249
- data/spec/redmine/app/models/import_item.rb +0 -22
- data/spec/redmine/app/models/issue_import.rb +0 -186
- data/spec/redmine/app/views/attachments/image.html.erb +0 -3
- data/spec/redmine/app/views/attachments/other.html.erb +0 -3
- data/spec/redmine/app/views/common/_image.html.erb +0 -1
- data/spec/redmine/app/views/common/_other.html.erb +0 -1
- data/spec/redmine/app/views/custom_field_enumerations/create.js.erb +0 -2
- data/spec/redmine/app/views/custom_field_enumerations/destroy.html.erb +0 -14
- data/spec/redmine/app/views/custom_field_enumerations/index.html.erb +0 -47
- data/spec/redmine/app/views/custom_fields/formats/_enumeration.erb +0 -12
- data/spec/redmine/app/views/imports/_fields_mapping.html.erb +0 -90
- data/spec/redmine/app/views/imports/mapping.html.erb +0 -52
- data/spec/redmine/app/views/imports/mapping.js.erb +0 -1
- data/spec/redmine/app/views/imports/new.html.erb +0 -15
- data/spec/redmine/app/views/imports/run.html.erb +0 -20
- data/spec/redmine/app/views/imports/run.js.erb +0 -11
- data/spec/redmine/app/views/imports/settings.html.erb +0 -30
- data/spec/redmine/app/views/imports/show.html.erb +0 -38
- data/spec/redmine/app/views/layouts/_file.html.erb +0 -15
- data/spec/redmine/app/views/mailer/security_notification.html.erb +0 -13
- data/spec/redmine/app/views/mailer/security_notification.text.erb +0 -8
- data/spec/redmine/app/views/mailer/settings_updated.html.erb +0 -14
- data/spec/redmine/app/views/mailer/settings_updated.text.erb +0 -12
- data/spec/redmine/app/views/queries/_query_form.html.erb +0 -62
- data/spec/redmine/app/views/repositories/_changeset.html.erb +0 -40
- data/spec/redmine/app/views/search/index.api.rsb +0 -12
- data/spec/redmine/app/views/settings/_api.html.erb +0 -10
- data/spec/redmine/app/views/settings/_attachments.html.erb +0 -21
- data/spec/redmine/app/views/wiki/_new_modal.html.erb +0 -21
- data/spec/redmine/app/views/wiki/new.html.erb +0 -17
- data/spec/redmine/app/views/wiki/new.js.erb +0 -2
- data/spec/redmine/appveyor.yml +0 -36
- data/spec/redmine/db/migrate/20150725112753_insert_allowed_statuses_for_new_issues.rb +0 -23
- data/spec/redmine/db/migrate/20150730122707_create_imports.rb +0 -13
- data/spec/redmine/db/migrate/20150730122735_create_import_items.rb +0 -10
- data/spec/redmine/db/migrate/20150921204850_change_time_entries_comments_limit_to_1024.rb +0 -9
- data/spec/redmine/db/migrate/20150921210243_change_wiki_contents_comments_limit_to_1024.rb +0 -11
- data/spec/redmine/db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb +0 -9
- data/spec/redmine/db/migrate/20151020182731_fix_comma_in_user_format_setting_value.rb +0 -13
- data/spec/redmine/db/migrate/20151021184614_change_issue_categories_name_limit_to_60.rb +0 -9
- data/spec/redmine/db/migrate/20151021185456_change_auth_sources_filter_to_text.rb +0 -9
- data/spec/redmine/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb +0 -9
- data/spec/redmine/db/migrate/20151024082034_add_tokens_updated_on.rb +0 -10
- data/spec/redmine/db/migrate/20151025072118_create_custom_field_enumerations.rb +0 -10
- data/spec/redmine/db/migrate/20151031095005_add_projects_default_version_id.rb +0 -12
- data/spec/redmine/db/migrate/20160404080304_force_password_reset_during_setup.rb +0 -9
- data/spec/redmine/db/migrate/20160416072926_remove_position_defaults.rb +0 -13
- data/spec/redmine/db/migrate/20160529063352_add_roles_settings.rb +0 -5
- data/spec/redmine/lib/redmine/acts/positioned.rb +0 -118
- data/spec/redmine/lib/redmine/helpers/url.rb +0 -35
- data/spec/redmine/lib/redmine/hook/listener.rb +0 -32
- data/spec/redmine/lib/redmine/hook/view_listener.rb +0 -78
- data/spec/redmine/log/test.log +0 -2
- data/spec/redmine/plugins/dummy_plugin/Gemfile +0 -1
- data/spec/redmine/plugins/dummy_plugin/app/controllers/dummy_autocompletes_controller.rb +0 -4
- data/spec/redmine/plugins/dummy_plugin/app/views/dummy_autocompletes/index.html.erb +0 -3
- data/spec/redmine/plugins/dummy_plugin/config/locales/en.yml +0 -2
- data/spec/redmine/plugins/dummy_plugin/config/routes.rb +0 -1
- data/spec/redmine/plugins/dummy_plugin/init.rb +0 -34
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/controllers/issues_controller_patch.example +0 -30
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/helpers/issues_helper_patch.example +0 -30
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/easy_patch/redmine/models/issue_patch.example +0 -30
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/hooks.rb +0 -5
- data/spec/redmine/plugins/dummy_plugin/lib/dummy_plugin/internals.rb +0 -4
- data/spec/redmine/public/images/jstoolbar/bt_precode.png +0 -0
- data/spec/redmine/public/images/reorder.png +0 -0
- data/spec/redmine/public/javascripts/jquery-1.11.1-ui-1.11.0-ujs-3.1.4.js +0 -21
- data/spec/redmine/public/javascripts/redmine_extensions/application.js +0 -13
- data/spec/redmine/public/javascripts/redmine_extensions/easy_togglers.js +0 -58
- data/spec/redmine/public/javascripts/redmine_extensions/jquery.entityarray.js +0 -130
- data/spec/redmine/public/javascripts/redmine_extensions/redmine_extensions.js +0 -642
- data/spec/redmine/public/javascripts/responsive.js +0 -83
- data/spec/redmine/public/stylesheets/responsive.css +0 -799
- data/spec/redmine/test/fixtures/files/import_dates.csv +0 -4
- data/spec/redmine/test/fixtures/files/import_iso8859-1.csv +0 -3
- data/spec/redmine/test/fixtures/files/import_issues.csv +0 -4
- data/spec/redmine/test/fixtures/ldap/slapd.centos6.conf +0 -24
- data/spec/redmine/test/fixtures/ldap/slapd.ubuntu.12.04.conf +0 -23
- data/spec/redmine/test/fixtures/mail_handler/issue_update_with_cc.eml +0 -19
- data/spec/redmine/test/fixtures/mail_handler/ticket_on_project_given_by_to_header.eml +0 -60
- data/spec/redmine/test/fixtures/mail_handler/ticket_with_text_attachment_iso-8859-2.eml +0 -31
- data/spec/redmine/test/functional/custom_field_enumerations_controller_test.rb +0 -115
- data/spec/redmine/test/functional/imports_controller_test.rb +0 -205
- data/spec/redmine/test/functional/sessions_controller_test.rb +0 -138
- data/spec/redmine/test/integration/api_test/search_test.rb +0 -92
- data/spec/redmine/test/integration/routing/imports_test.rb +0 -36
- data/spec/redmine/test/integration/sessions_test.rb +0 -97
- data/spec/redmine/test/ui/custom_fields_test_ui.rb +0 -38
- data/spec/redmine/test/unit/attachment_transaction_test.rb +0 -76
- data/spec/redmine/test/unit/helpers/journals_helper_test.rb +0 -48
- data/spec/redmine/test/unit/helpers/wiki_helper_test.rb +0 -45
- data/spec/redmine/test/unit/issue_import_test.rb +0 -178
- data/spec/redmine/test/unit/lib/redmine/acts/positioned_with_scope_test.rb +0 -53
- data/spec/redmine/test/unit/lib/redmine/acts/positioned_without_scope_test.rb +0 -55
- data/spec/redmine/test/unit/lib/redmine/field_format/enumeration_format_test.rb +0 -91
- data/spec/support/easy_queries_helpers.rb +0 -0
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
class CreateImports < ActiveRecord::Migration
|
|
2
|
-
def change
|
|
3
|
-
create_table :imports do |t|
|
|
4
|
-
t.string :type
|
|
5
|
-
t.integer :user_id, :null => false
|
|
6
|
-
t.string :filename
|
|
7
|
-
t.text :settings
|
|
8
|
-
t.integer :total_items
|
|
9
|
-
t.boolean :finished, :null => false, :default => false
|
|
10
|
-
t.timestamps :null => false
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
class ChangeWikiContentsCommentsLimitTo1024 < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
change_column :wiki_content_versions, :comments, :string, :limit => 1024, :default => ''
|
|
4
|
-
change_column :wiki_contents, :comments, :string, :limit => 1024, :default => ''
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def self.down
|
|
8
|
-
change_column :wiki_content_versions, :comments, :string, :limit => 255, :default => ''
|
|
9
|
-
change_column :wiki_contents, :comments, :string, :limit => 255, :default => ''
|
|
10
|
-
end
|
|
11
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
class ChangeAttachmentsFilesizeLimitTo8 < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
change_column :attachments, :filesize, :integer, :limit => 8, :default => 0, :null => false
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
def self.down
|
|
7
|
-
change_column :attachments, :filesize, :integer, :limit => 4, :default => 0, :null => false
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
class FixCommaInUserFormatSettingValue < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
Setting.
|
|
4
|
-
where(:name => 'user_format', :value => 'lastname_coma_firstname').
|
|
5
|
-
update_all(:value => 'lastname_comma_firstname')
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def self.down
|
|
9
|
-
Setting.
|
|
10
|
-
where(:name => 'user_format', :value => 'lastname_comma_firstname').
|
|
11
|
-
update_all(:value => 'lastname_coma_firstname')
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
class ChangeIssueCategoriesNameLimitTo60 < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
change_column :issue_categories, :name, :string, :limit => 60, :default => "", :null => false
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
def self.down
|
|
7
|
-
change_column :issue_categories, :name, :string, :limit => 30, :default => "", :null => false
|
|
8
|
-
end
|
|
9
|
-
end
|
data/spec/redmine/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
class ChangeUserPreferencesHideMailDefaultToTrue < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
change_column :user_preferences, :hide_mail, :boolean, :default => true
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
def self.down
|
|
7
|
-
change_column :user_preferences, :hide_mail, :boolean, :default => false
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
class CreateCustomFieldEnumerations < ActiveRecord::Migration
|
|
2
|
-
def change
|
|
3
|
-
create_table :custom_field_enumerations do |t|
|
|
4
|
-
t.integer :custom_field_id, :null => false
|
|
5
|
-
t.string :name, :null => false
|
|
6
|
-
t.boolean :active, :default => true, :null => false
|
|
7
|
-
t.integer :position, :default => 1, :null => false
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
class AddProjectsDefaultVersionId < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
# Don't try to add the column if redmine_default_version plugin was used
|
|
4
|
-
unless column_exists?(:projects, :default_version_id, :integer)
|
|
5
|
-
add_column :projects, :default_version_id, :integer, :default => nil
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def self.down
|
|
10
|
-
remove_column :projects, :default_version_id
|
|
11
|
-
end
|
|
12
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
class ForcePasswordResetDuringSetup < ActiveRecord::Migration
|
|
2
|
-
def up
|
|
3
|
-
User.where(login: "admin", last_login_on: nil).update_all(must_change_passwd: true)
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
def down
|
|
7
|
-
User.where(login: "admin", last_login_on: nil, must_change_passwd: true).update_all(must_change_passwd: false)
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
class RemovePositionDefaults < ActiveRecord::Migration
|
|
2
|
-
def up
|
|
3
|
-
[Board, CustomField, Enumeration, IssueStatus, Role, Tracker].each do |klass|
|
|
4
|
-
change_column klass.table_name, :position, :integer, :default => nil
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def down
|
|
9
|
-
[Board, CustomField, Enumeration, IssueStatus, Role, Tracker].each do |klass|
|
|
10
|
-
change_column klass.table_name, :position, :integer, :default => 1
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
# Redmine - project management software
|
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
|
3
|
-
#
|
|
4
|
-
# This program is free software; you can redistribute it and/or
|
|
5
|
-
# modify it under the terms of the GNU General Public License
|
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
|
7
|
-
# of the License, or (at your option) any later version.
|
|
8
|
-
#
|
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
# GNU General Public License for more details.
|
|
13
|
-
#
|
|
14
|
-
# You should have received a copy of the GNU General Public License
|
|
15
|
-
# along with this program; if not, write to the Free Software
|
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
17
|
-
|
|
18
|
-
module Redmine
|
|
19
|
-
module Acts
|
|
20
|
-
module Positioned
|
|
21
|
-
def self.included(base)
|
|
22
|
-
base.extend ClassMethods
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# This extension provides the capabilities for reordering objects in a list.
|
|
26
|
-
# The class needs to have a +position+ column defined as an integer on the
|
|
27
|
-
# mapped database table.
|
|
28
|
-
module ClassMethods
|
|
29
|
-
# Configuration options are:
|
|
30
|
-
#
|
|
31
|
-
# * +scope+ - restricts what is to be considered a list. Must be a symbol
|
|
32
|
-
# or an array of symbols
|
|
33
|
-
def acts_as_positioned(options = {})
|
|
34
|
-
class_attribute :positioned_options
|
|
35
|
-
self.positioned_options = {:scope => Array(options[:scope])}
|
|
36
|
-
|
|
37
|
-
send :include, Redmine::Acts::Positioned::InstanceMethods
|
|
38
|
-
|
|
39
|
-
before_save :set_default_position
|
|
40
|
-
after_save :update_position
|
|
41
|
-
after_destroy :remove_position
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
module InstanceMethods
|
|
46
|
-
def self.included(base)
|
|
47
|
-
base.extend ClassMethods
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
private
|
|
51
|
-
|
|
52
|
-
def position_scope
|
|
53
|
-
build_position_scope {|c| send(c)}
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def position_scope_was
|
|
57
|
-
build_position_scope {|c| send("#{c}_was")}
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def build_position_scope
|
|
61
|
-
condition_hash = self.class.positioned_options[:scope].inject({}) do |h, column|
|
|
62
|
-
h[column] = yield(column)
|
|
63
|
-
h
|
|
64
|
-
end
|
|
65
|
-
self.class.where(condition_hash)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def set_default_position
|
|
69
|
-
if position.nil?
|
|
70
|
-
self.position = position_scope.maximum(:position).to_i + (new_record? ? 1 : 0)
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def update_position
|
|
75
|
-
if !new_record? && position_scope_changed?
|
|
76
|
-
remove_position
|
|
77
|
-
insert_position
|
|
78
|
-
elsif position_changed?
|
|
79
|
-
if position_was.nil?
|
|
80
|
-
insert_position
|
|
81
|
-
else
|
|
82
|
-
shift_positions
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def insert_position
|
|
88
|
-
position_scope.where("position >= ? AND id <> ?", position, id).update_all("position = position + 1")
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def remove_position
|
|
92
|
-
position_scope_was.where("position >= ? AND id <> ?", position_was, id).update_all("position = position - 1")
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def position_scope_changed?
|
|
96
|
-
(changed & self.class.positioned_options[:scope].map(&:to_s)).any?
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def shift_positions
|
|
100
|
-
offset = position_was <=> position
|
|
101
|
-
min, max = [position, position_was].sort
|
|
102
|
-
r = position_scope.where("id <> ? AND position BETWEEN ? AND ?", id, min, max).update_all("position = position + #{offset}")
|
|
103
|
-
if r != max - min
|
|
104
|
-
reset_positions_in_list
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def reset_positions_in_list
|
|
109
|
-
position_scope.reorder(:position, :id).pluck(:id).each_with_index do |record_id, p|
|
|
110
|
-
self.class.where(:id => record_id).update_all(:position => p+1)
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
ActiveRecord::Base.send :include, Redmine::Acts::Positioned
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Redmine - project management software
|
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
|
3
|
-
#
|
|
4
|
-
# This program is free software; you can redistribute it and/or
|
|
5
|
-
# modify it under the terms of the GNU General Public License
|
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
|
7
|
-
# of the License, or (at your option) any later version.
|
|
8
|
-
#
|
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
# GNU General Public License for more details.
|
|
13
|
-
#
|
|
14
|
-
# You should have received a copy of the GNU General Public License
|
|
15
|
-
# along with this program; if not, write to the Free Software
|
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
17
|
-
|
|
18
|
-
require 'uri'
|
|
19
|
-
|
|
20
|
-
module Redmine
|
|
21
|
-
module Helpers
|
|
22
|
-
module URL
|
|
23
|
-
def uri_with_safe_scheme?(uri, schemes = ['http', 'https', 'ftp', 'mailto', nil])
|
|
24
|
-
# URLs relative to the current document or document root (without a protocol
|
|
25
|
-
# separator, should be harmless
|
|
26
|
-
return true unless uri.to_s.include? ":"
|
|
27
|
-
|
|
28
|
-
# Other URLs need to be parsed
|
|
29
|
-
schemes.include? URI.parse(uri).scheme
|
|
30
|
-
rescue URI::InvalidURIError
|
|
31
|
-
false
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Redmine - project management software
|
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
|
3
|
-
#
|
|
4
|
-
# This program is free software; you can redistribute it and/or
|
|
5
|
-
# modify it under the terms of the GNU General Public License
|
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
|
7
|
-
# of the License, or (at your option) any later version.
|
|
8
|
-
#
|
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
# GNU General Public License for more details.
|
|
13
|
-
#
|
|
14
|
-
# You should have received a copy of the GNU General Public License
|
|
15
|
-
# along with this program; if not, write to the Free Software
|
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
17
|
-
|
|
18
|
-
module Redmine
|
|
19
|
-
module Hook
|
|
20
|
-
# Base class for hook listeners.
|
|
21
|
-
class Listener
|
|
22
|
-
include Singleton
|
|
23
|
-
include Redmine::I18n
|
|
24
|
-
|
|
25
|
-
# Registers the listener
|
|
26
|
-
def self.inherited(child)
|
|
27
|
-
Redmine::Hook.add_listener(child)
|
|
28
|
-
super
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Redmine - project management software
|
|
2
|
-
# Copyright (C) 2006-2016 Jean-Philippe Lang
|
|
3
|
-
#
|
|
4
|
-
# This program is free software; you can redistribute it and/or
|
|
5
|
-
# modify it under the terms of the GNU General Public License
|
|
6
|
-
# as published by the Free Software Foundation; either version 2
|
|
7
|
-
# of the License, or (at your option) any later version.
|
|
8
|
-
#
|
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
# GNU General Public License for more details.
|
|
13
|
-
#
|
|
14
|
-
# You should have received a copy of the GNU General Public License
|
|
15
|
-
# along with this program; if not, write to the Free Software
|
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
17
|
-
|
|
18
|
-
module Redmine
|
|
19
|
-
module Hook
|
|
20
|
-
# Listener class used for views hooks.
|
|
21
|
-
# Listeners that inherit this class will include various helpers by default.
|
|
22
|
-
class ViewListener < Listener
|
|
23
|
-
include ERB::Util
|
|
24
|
-
include ActionView::Helpers::TagHelper
|
|
25
|
-
include ActionView::Helpers::FormHelper
|
|
26
|
-
include ActionView::Helpers::FormTagHelper
|
|
27
|
-
include ActionView::Helpers::FormOptionsHelper
|
|
28
|
-
include ActionView::Helpers::JavaScriptHelper
|
|
29
|
-
include ActionView::Helpers::NumberHelper
|
|
30
|
-
include ActionView::Helpers::UrlHelper
|
|
31
|
-
include ActionView::Helpers::AssetTagHelper
|
|
32
|
-
include ActionView::Helpers::TextHelper
|
|
33
|
-
include Rails.application.routes.url_helpers
|
|
34
|
-
include ApplicationHelper
|
|
35
|
-
|
|
36
|
-
# Default to creating links using only the path. Subclasses can
|
|
37
|
-
# change this default as needed
|
|
38
|
-
def self.default_url_options
|
|
39
|
-
{:only_path => true, :script_name => Redmine::Utils.relative_url_root}
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# Helper method to directly render using the context,
|
|
43
|
-
# render_options must be valid #render options.
|
|
44
|
-
#
|
|
45
|
-
# class MyHook < Redmine::Hook::ViewListener
|
|
46
|
-
# render_on :view_issues_show_details_bottom, :partial => "show_more_data"
|
|
47
|
-
# end
|
|
48
|
-
#
|
|
49
|
-
# class MultipleHook < Redmine::Hook::ViewListener
|
|
50
|
-
# render_on :view_issues_show_details_bottom,
|
|
51
|
-
# {:partial => "show_more_data"},
|
|
52
|
-
# {:partial => "show_even_more_data"}
|
|
53
|
-
# end
|
|
54
|
-
#
|
|
55
|
-
def self.render_on(hook, *render_options)
|
|
56
|
-
define_method hook do |context|
|
|
57
|
-
render_options.map do |options|
|
|
58
|
-
if context[:hook_caller].respond_to?(:render)
|
|
59
|
-
context[:hook_caller].send(:render, {:locals => context}.merge(options))
|
|
60
|
-
elsif context[:controller].is_a?(ActionController::Base)
|
|
61
|
-
context[:controller].send(:render_to_string, {:locals => context}.merge(options))
|
|
62
|
-
else
|
|
63
|
-
raise "Cannot render #{self.name} hook from #{context[:hook_caller].class.name}"
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def controller
|
|
70
|
-
nil
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def config
|
|
74
|
-
ActionController::Base.config
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|