forked from tmerten/redmine_re
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
120 lines (105 loc) · 6.33 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
require 'redmine'
require 'redmine_re/hooks'
require 'rubygems'
require_dependency '../app/models/re_artifact_relationship'
require_dependency '../app/models/re_artifact_properties'
require_dependency '../app/helpers/re_application_helper'
# Make singular and plural for RE_Artifact_Properties the same
ActiveSupport::Inflector.inflections do |inflect|
inflect.singular /^(ReArtifactPropert)ies/i, '\1ies'
inflect.plural /^(ReArtifactPropert)ies/i, '\1ies'
end
#Rails.configuration.to_prepare do
ActionDispatch::Callbacks.to_prepare do
# redmine_re patches
require_dependency 'issue_patch'
require_dependency 'issue_controller_patch'
require_dependency 'mailer_patch'
require_dependency 'query_patch'
require_dependency 'role_patch'
require_dependency 'project_patch'
require_dependency 'projects_controller_patch'
require_dependency 'user_patch'
end
require_dependency '../lib/re_wiki_macros'
ActionView::Base.class_eval do
include ReApplicationHelper
end
Redmine::Plugin.register :redmine_re do
name 'Redmine Requirements Engineering Plugin'
author 'Bonn-Rhine-Sieg University of Applied Sciences ([email protected])'
description 'This is a plugin to handle requirements engineering artifacts within redmine. The plugin has been developed
within the KoREM project (http://korem.de) at Bonn-Rhine-Sieg University of Applied Sciences (http://h-brs.de)'
version 'development version'
url 'http://redmine.korem.de'
author_url 'http://korem.de'
requires_redmine :version_or_higher => '2.1.0'
# this plugin creates a project module. navigate to 'settings->modules' in the app to activate the plugin per project
project_module :requirements do
# before_filter :authorize is set in the redmine_re_controller
permission(:view_requirements,
{
:requirements => [:index, :treeview, :treestate, :load_settings,
:find_project, :add_hidden_re_artifact_properties_attributes, :create_tree,
:render_to_html_tree, :render_children_to_html_tree,
:enhanced_filter, :build_conditions_hash, :find_first_artifacts_with_first_parameter,
:reduce_search_result_with_parameter, :sendDiagramPreviewImage, :export],
:redmine_re => [:enhanced_filter, :index, :treeview, :treestate, :load_settings,
:find_project, :add_hidden_re_artifact_properties_attributes, :create_tree,
:render_to_html_tree, :render_children_to_html_tree,
:enhanced_filter, :build_conditions_hash, :find_first_artifacts_with_first_parameter,
:reduce_search_result_with_parameter],
:re_artifact_properties => [:show, :redirect, :download],
:re_artifact_relationship => [:prepare_relationships, :visualization, :build_json_according_to_user_choice],
:re_queries => [:index, :show, :query, :apply,
:suggest_artifacts, :suggest_issues, :suggest_diagrams, :suggest_users,
:artifacts_bits, :issues_bits, :diagrams_bits, :users_bits]
}
)
permission(:edit_requirements,
{
:requirements => [:index, :treeview, :context_menu, :treestate, :load_settings,
:find_project, :add_hidden_re_artifact_properties_attributes, :create_tree,
:delegate_tree_drop, :render_to_html_tree, :render_children_to_html_tree,
:enhanced_filter, :build_conditions_hash, :find_first_artifacts_with_first_parameter,
:reduce_search_result_with_parameter, :sendDiagramPreviewImage, :add_relation],
:redmine_re => [:enhanced_filter, :index, :treeview, :context_menu, :treestate, :load_settings,
:find_project, :add_hidden_re_artifact_properties_attributes, :create_tree,
:delegate_tree_drop, :render_to_html_tree, :render_children_to_html_tree,
:enhanced_filter, :build_conditions_hash, :find_first_artifacts_with_first_parameter,
:reduce_search_result_with_parameter],
:re_artifact_properties => [:show, :new, :create, :update, :edit, :redirect, :destroy, :autocomplete_parent, :autocomplete_issue,
:autocomplete_artifact, :remove_issue_from_artifact, :remove_artifact_from_issue,
:rate_artifact, :how_to_delete, :recursive_destroy, :new_comment],
:re_artifact_relationship => [:delete, :autocomplete_sink, :prepare_relationships,
:visualization, :build_json_according_to_user_choice],
:re_rationale => [:edit, :new],
:re_queries => [:index, :new, :edit, :show, :delete, :create, :update, :query, :apply,
:suggest_artifacts, :suggest_issues, :suggest_diagrams, :suggest_users,
:artifacts_bits, :issues_bits, :diagrams_bits, :users_bits]
}
)
permission(:administrate_requirements,
{
:requirements => [:setup],
:re_settings => [:configure, :configure_fields, :edit_artifact_type_description]
}
)
permission(:comment_on_requirements, {
:re_artifact_properties => [:new_comment]
})
permission(:delete_re_artifact_properties_watchers, {}
)
end
# The Requirements item is added to the project menu after the Activity item
menu :project_menu, :re, {:controller => 'requirements', :action => 'index'}, :caption => 'Requirements', :after => :activity, :param => :project_id
activity_provider :re_artifact_properties, :class_name => 'ReArtifactProperties', :default => true
#settings :default => {'re_artifact_types' => ''}, :partial => 'settings/redmine_re'
# add "acts_as_re_artifact" method to any ActiveRecord::Base class
# as an alias to "include Artifact"
class ActiveRecord::Base
def self.acts_as_re_artifact
include Artifact
end
end
end