Treat Calendar and Gantt pages as separate modules. #6153
This will let the Issue Tracking, Gantt, and Calendar modules be enabled or disabled as needed. A database migration will enable the Gantt and Calendar for all existing projects that have Issue Tracking enabled. Contributed by Adam Soltys git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4013 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7e565eed34
commit
fc9b984cc1
|
@ -150,6 +150,8 @@ default_projects_modules:
|
||||||
- wiki
|
- wiki
|
||||||
- repository
|
- repository
|
||||||
- boards
|
- boards
|
||||||
|
- calendar
|
||||||
|
- gantt
|
||||||
# Role given to a non-admin user who creates a project
|
# Role given to a non-admin user who creates a project
|
||||||
new_project_user_role_id:
|
new_project_user_role_id:
|
||||||
format: int
|
format: int
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
class EnableCalendarAndGanttModulesWhereAppropriate < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
EnabledModule.find(:all, :conditions => ["name = ?", 'issue_tracking']).each do |e|
|
||||||
|
EnabledModule.create(:name => 'calendar', :project_id => e.project_id)
|
||||||
|
EnabledModule.create(:name => 'gantt', :project_id => e.project_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
EnabledModule.delete_all("name = 'calendar' OR name = 'gantt'")
|
||||||
|
end
|
||||||
|
end
|
|
@ -76,9 +76,6 @@ Redmine::AccessControl.map do |map|
|
||||||
# Queries
|
# Queries
|
||||||
map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member
|
map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member
|
||||||
map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin
|
map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin
|
||||||
# Gantt & calendar
|
|
||||||
map.permission :view_gantt, :gantts => :show
|
|
||||||
map.permission :view_calendar, :calendars => :show
|
|
||||||
# Watchers
|
# Watchers
|
||||||
map.permission :view_issue_watchers, {}
|
map.permission :view_issue_watchers, {}
|
||||||
map.permission :add_issue_watchers, {:watchers => :new}
|
map.permission :add_issue_watchers, {:watchers => :new}
|
||||||
|
@ -137,6 +134,14 @@ Redmine::AccessControl.map do |map|
|
||||||
map.permission :delete_messages, {:messages => :destroy}, :require => :member
|
map.permission :delete_messages, {:messages => :destroy}, :require => :member
|
||||||
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
|
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
|
||||||
end
|
end
|
||||||
|
|
||||||
|
map.project_module :calendar do |map|
|
||||||
|
map.permission :view_calendar, :calendars => :show
|
||||||
|
end
|
||||||
|
|
||||||
|
map.project_module :gantt do |map|
|
||||||
|
map.permission :view_gantt, :gantts => :show
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Redmine::MenuManager.map :top_menu do |menu|
|
Redmine::MenuManager.map :top_menu do |menu|
|
||||||
|
|
|
@ -63,3 +63,35 @@ enabled_modules_016:
|
||||||
name: boards
|
name: boards
|
||||||
project_id: 2
|
project_id: 2
|
||||||
id: 16
|
id: 16
|
||||||
|
enabled_modules_017:
|
||||||
|
name: calendar
|
||||||
|
project_id: 1
|
||||||
|
id: 17
|
||||||
|
enabled_modules_018:
|
||||||
|
name: gantt
|
||||||
|
project_id: 1
|
||||||
|
id: 18
|
||||||
|
enabled_modules_019:
|
||||||
|
name: calendar
|
||||||
|
project_id: 2
|
||||||
|
id: 19
|
||||||
|
enabled_modules_020:
|
||||||
|
name: gantt
|
||||||
|
project_id: 2
|
||||||
|
id: 20
|
||||||
|
enabled_modules_021:
|
||||||
|
name: calendar
|
||||||
|
project_id: 3
|
||||||
|
id: 21
|
||||||
|
enabled_modules_022:
|
||||||
|
name: gantt
|
||||||
|
project_id: 3
|
||||||
|
id: 22
|
||||||
|
enabled_modules_023:
|
||||||
|
name: calendar
|
||||||
|
project_id: 5
|
||||||
|
id: 23
|
||||||
|
enabled_modules_024:
|
||||||
|
name: gantt
|
||||||
|
project_id: 5
|
||||||
|
id: 24
|
||||||
|
|
|
@ -62,12 +62,14 @@ class RedmineTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_project_menu
|
def test_project_menu
|
||||||
assert_number_of_items_in_menu :project_menu, 12
|
assert_number_of_items_in_menu :project_menu, 14
|
||||||
assert_menu_contains_item_named :project_menu, :overview
|
assert_menu_contains_item_named :project_menu, :overview
|
||||||
assert_menu_contains_item_named :project_menu, :activity
|
assert_menu_contains_item_named :project_menu, :activity
|
||||||
assert_menu_contains_item_named :project_menu, :roadmap
|
assert_menu_contains_item_named :project_menu, :roadmap
|
||||||
assert_menu_contains_item_named :project_menu, :issues
|
assert_menu_contains_item_named :project_menu, :issues
|
||||||
assert_menu_contains_item_named :project_menu, :new_issue
|
assert_menu_contains_item_named :project_menu, :new_issue
|
||||||
|
assert_menu_contains_item_named :project_menu, :calendar
|
||||||
|
assert_menu_contains_item_named :project_menu, :gantt
|
||||||
assert_menu_contains_item_named :project_menu, :news
|
assert_menu_contains_item_named :project_menu, :news
|
||||||
assert_menu_contains_item_named :project_menu, :documents
|
assert_menu_contains_item_named :project_menu, :documents
|
||||||
assert_menu_contains_item_named :project_menu, :wiki
|
assert_menu_contains_item_named :project_menu, :wiki
|
||||||
|
|
Loading…
Reference in New Issue