forked from kawasima/redmine_impasse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.rb
executable file
·94 lines (79 loc) · 3.53 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
require 'redmine'
require 'impasse_projects_helper_patch'
if Rails::VERSION::MAJOR < 3
require 'dispatcher'
object_to_prepare = Dispatcher
else
object_to_prepare = Rails.configuration
end
object_to_prepare.to_prepare do
require_dependency 'impasse_hooks'
unless ProjectsHelper.included_modules.include? ImpasseProjectsHelperPatch
ProjectsHelper.send(:include, ImpasseProjectsHelperPatch)
end
unless VersionsController.included_modules.include? ImpasseVersionsControllerPatch
VersionsController.send(:include, ImpasseVersionsControllerPatch)
end
Project.class_eval do
has_and_belongs_to_many :test_case_custom_fields,
:class_name => 'Impasse::TestCaseCustomField',
:order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:foreign_key => 'project_id',
:association_foreign_key => 'custom_field_id'
has_and_belongs_to_many :test_suite_custom_fields,
:class_name => 'Impasse::TestSuiteCustomField',
:order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:foreign_key => 'project_id',
:association_foreign_key => 'custom_field_id'
has_and_belongs_to_many :test_plan_custom_fields,
:class_name => 'Impasse::TestPlanCustomField',
:order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:foreign_key => 'project_id',
:association_foreign_key => 'custom_field_id'
has_and_belongs_to_many :execution_custom_fields,
:class_name => 'Impasse::ExecutionCustomField',
:order => "#{CustomField.table_name}.position",
:join_table => "#{table_name_prefix}custom_fields_projects#{table_name_suffix}",
:foreign_key => 'project_id',
:association_foreign_key => 'custom_field_id'
end
end
Redmine::Plugin.register :redmine_impasse do
name 'Redmine Impasse plugin'
author 'kawasima'
description 'Test management tool integrated Redmine'
version '1.2.0'
url 'http://unit8.net/redmine_impasse'
author_url 'http://unit8.net/'
settings :partial => 'redmine_impasse/setting'
project_module :impasse do
permission :view_testcases, {
'impasse_test_case' => [:index, :show, :list, :keywords],
'impasse_test_plans' => [:index, :show, :list, :tc_assign, :user_assign, :statistics, :autocomplete],
'impasse_executions' => [:index, :get_list],
'impasse_requirement_issues' => [:index],
'impasse_screenshots' => [:show],
}
permission :manage_testcases, {
'impasse_test_case' => [:new, :edit, :destroy, :copy, :move, :copy_to_another_project, :screenshot],
'impasse_test_plans' => [:new, :edit, :destroy,:copy, :add_test_case, :remove_test_case],
'impasse_executions' => [:new, :edit, :destroy, :put],
'impasse_execution_bugs' => [:new, :edit, :destroy, :upload_attachments],
'impasse_requirement_issues' => [:add_test_case, :remove_test_case],
'impasse_screenshots' => [:new, :destroy],
}, :require => :member
permission :setting_testcases, {
'impasse_settings' => [:index, :show, :edit],
}, :require => :member
end
menu :project_menu, :impasse, { :controller => :impasse_test_case, :action => :index },
:caption => :label_impasse,
:param => :project_id
Redmine::MenuManager.map :impasse_admin_menu do |menu|
menu.push :custom_field, {:controller => 'impasse_custom_fields'}, :caption => :label_custom_field_plural,
:html => {:class => 'custom_fields'}
end
end