Merge pull request #1714 from opf/backport/1708

Backport/1708
pull/1734/head v3.0.11
kgalli 10 years ago
commit 9480cdec33
  1. 34
      app/models/planning_element_type_color.rb
  2. 42
      config/locales/de.yml
  3. 40
      config/locales/en.yml
  4. 4
      db/seeds/all.rb
  5. 232
      lib/redmine/default_data/loader.rb
  6. 2
      lib/tasks/timelines.rake
  7. 2
      spec/factories/project_factory.rb
  8. 4
      test/functional/admin_controller_test.rb
  9. 2
      test/unit/default_data_test.rb

@ -48,26 +48,22 @@ class PlanningElementTypeColor < ActiveRecord::Base
validates_length_of :name, :maximum => 255, :unless => lambda { |e| e.name.blank? }
validates_format_of :hexcode, :with => /\A#[0-9A-F]{6}\z/, :unless => lambda { |e| e.hexcode.blank? }
def self.ms_project_colors
# Colors should be limited to the ones in MS Project.
# http://msdn.microsoft.com/en-us/library/ff862872.aspx
def self.colors
[
self.find_or_initialize_by_name_and_hexcode('pjBlack', '#000000'),
self.find_or_initialize_by_name_and_hexcode('pjRed', '#FF0013'),
self.find_or_initialize_by_name_and_hexcode('pjYellow', '#FEFE56'),
self.find_or_initialize_by_name_and_hexcode('pjLime', '#82FFA1'),
self.find_or_initialize_by_name_and_hexcode('pjAqua', '#C0DDFC'),
self.find_or_initialize_by_name_and_hexcode('pjBlue', '#1E16F4'),
self.find_or_initialize_by_name_and_hexcode('pjFuchsia', '#FF7FF7'),
self.find_or_initialize_by_name_and_hexcode('pjWhite', '#FFFFFF'),
self.find_or_initialize_by_name_and_hexcode('pjMaroon', '#850005'),
self.find_or_initialize_by_name_and_hexcode('pjGreen', '#008025'),
self.find_or_initialize_by_name_and_hexcode('pjOlive', '#7F8027'),
self.find_or_initialize_by_name_and_hexcode('pjNavy', '#09067A'),
self.find_or_initialize_by_name_and_hexcode('pjPurple', '#86007B'),
self.find_or_initialize_by_name_and_hexcode('pjTeal', '#008180'),
self.find_or_initialize_by_name_and_hexcode('pjGray', '#808080'),
self.find_or_initialize_by_name_and_hexcode('pjSilver', '#BFBFBF')
self.find_or_initialize_by_name_and_hexcode('Black', '#000000'),
self.find_or_initialize_by_name_and_hexcode('White', '#FFFFFF'),
self.find_or_initialize_by_name_and_hexcode('Blue', '#3399CC'),
self.find_or_initialize_by_name_and_hexcode('Mint', '#66CCCC'),
self.find_or_initialize_by_name_and_hexcode('Lime', '#66CC99'),
self.find_or_initialize_by_name_and_hexcode('Green-neon', '#00CC33'),
self.find_or_initialize_by_name_and_hexcode('Green', '#339933'),
self.find_or_initialize_by_name_and_hexcode('Orange', '#FFCC00'),
self.find_or_initialize_by_name_and_hexcode('Red', '#CC3333'),
self.find_or_initialize_by_name_and_hexcode('Red-bright', '#FF3300'),
self.find_or_initialize_by_name_and_hexcode('Yellow', '#FFFF00'),
self.find_or_initialize_by_name_and_hexcode('Purple', '#CC0066'),
self.find_or_initialize_by_name_and_hexcode('Grey-dark', '#666666'),
self.find_or_initialize_by_name_and_hexcode('Grey-light', '#DDDDDD')
]
end

@ -447,30 +447,44 @@ de:
one: "1 Sekunde"
other: "%{count} Sekunden"
default_activity_management: "Management"
default_activity_design: "Design"
default_activity_development: "Entwicklung"
default_status_closed: "Erledigt"
default_status_feedback: "Feedback"
default_status_in_progress: "In Bearbeitung"
default_status_new: "Neu"
default_status_rejected: "Abgewiesen"
default_status_resolved: "Gelöst"
default_priority_high: "Hoch"
default_priority_immediate: "Sofort"
default_activity_testing: "Testung"
default_activity_Support: "Unterstützung"
default_activity_Other: "Andere"
default_status_new: "neu"
default_status_specified: "spezifiziert"
default_status_confirmed: "bestätigt"
default_status_to_be_scheduled: "zu planen"
default_status_scheduled: "geplant"
default_status_in_progress: "in Bearbeitung"
default_status_tested: "getestet"
default_status_on_hold: "wartend"
default_status_rejected: "abgewiesen"
default_status_closed: "erledigt"
default_priority_low: "Niedrig"
default_priority_normal: "Normal"
default_priority_urgent: "Dringend"
default_priority_high: "Hoch"
default_priority_immediate: "Sofort"
default_project_type_customer: "Kundenprojekt"
default_project_type_internal: "Internes Projekt"
default_reported_project_status_green: "Grün"
default_reported_project_status_amber: "Gelb"
default_reported_project_status_red: "Rot"
default_role_anonymous: "Anonymus"
default_role_developer: "Entwickler"
default_role_manager: "Manager"
default_role_non_member: "Nichtmitglied"
default_role_reporter: "Reporter"
default_role_reader: "Leser"
default_role_member: "Mitglied"
default_type: "Arbeitspaket"
default_type_bug: "Fehler"
default_type_feature: "Feature"
default_type_support: "Unterstützung"
default_type_phase: "Phase"
default_type_task: "Task"
default_type_deliverable: "Deliverable"
default_type_milestone: "Meilenstein"
default_type_phase: "Phase"
default_type_bug: "Bug"
default_type_feature: "Feature"
description_active: "Aktiv?"
description_attachment_toggle: "Dateien aus/einblenden"

@ -445,30 +445,44 @@ en:
one: "1 second"
other: "%{count} seconds"
default_activity_management: "Management"
default_activity_design: "Design"
default_activity_development: "Development"
default_status_closed: "Closed"
default_status_feedback: "Feedback"
default_status_in_progress: "In Progress"
default_status_new: "New"
default_status_rejected: "Rejected"
default_status_resolved: "Resolved"
default_priority_high: "High"
default_priority_immediate: "Immediate"
default_activity_testing: "Testing"
default_activity_Support: "Support"
default_activity_Other: "Other"
default_status_new: "new"
default_status_specified: "specified"
default_status_confirmed: "confirmed"
default_status_to_be_scheduled: "to be scheduled"
default_status_scheduled: "scheduled"
default_status_in_progress: "in progress"
default_status_tested: "tested"
default_status_on_hold: "on hold"
default_status_rejected: "rejected"
default_status_closed: "closed"
default_priority_low: "Low"
default_priority_normal: "Normal"
default_priority_urgent: "Urgent"
default_priority_high: "High"
default_priority_immediate: "Immediate"
default_project_type_customer: "Customer Project"
default_project_type_internal: "Internal Project"
default_reported_project_status_green: "Green"
default_reported_project_status_amber: "Amber"
default_reported_project_status_red: "Red"
default_role_anonymous: "Anonymous"
default_role_developer: "Developer"
default_role_manager: "Manager"
default_role_non_member: "Non member"
default_role_reporter: "Reporter"
default_role_reader: "Reader"
default_role_member: "Member"
default_type: "Work Package"
default_type_task: "Task"
default_type_deliverable: "Deliverable"
default_type_milestone: "Milestone"
default_type_phase: "Phase"
default_type_bug: "Bug"
default_type_feature: "Feature"
default_type_support: "Support"
default_type_phase: "Phase"
default_type_milestone: "Milestone"
description_active: "Active?"
description_attachment_toggle: "Show/Hide attachments"

@ -35,8 +35,8 @@
# not fixing stuff!
Project
PlanningElementTypeColor.ms_project_colors.map(&:save)
default_color = PlanningElementTypeColor.find_by_name('pjSilver')
PlanningElementTypeColor.colors.map(&:save)
default_color = PlanningElementTypeColor.find_by_name('Grey-light')
Type.find_or_create_by_is_standard(true, name: 'none',
position: 0,

@ -53,81 +53,96 @@ module Redmine
Role.transaction do
# Roles
manager = Role.create! :name => l(:default_role_manager),
:position => 1
:position => 3
manager.permissions = manager.setable_permissions.collect {|p| p.name}
manager.save!
developer = Role.create! :name => l(:default_role_developer),
:position => 2,
:permissions => [:manage_versions,
:manage_categories,
:view_work_packages,
member = Role.create! :name => l(:default_role_member),
:position => 4,
:permissions => [:view_work_packages,
:export_work_packages,
:add_work_packages,
:move_work_packages,
:edit_work_packages,
:add_work_package_notes,
:edit_own_work_package_notes,
:manage_work_package_relations,
:manage_subtasks,
:add_work_package_notes,
:manage_public_queries,
:save_queries,
:view_work_package_watchers,
:add_work_package_watchers,
:delete_work_package_watchers,
:view_calendar,
:comment_news,
:log_time,
:view_time_entries,
:comment_news,
:edit_own_time_entries,
:view_project_associations,
:view_timelines,
:edit_timelines,
:delete_timelines,
:view_reportings,
:edit_reportings,
:delete_reportings,
:manage_wiki,
:manage_wiki_menu,
:rename_wiki_pages,
:change_wiki_parent_page,
:delete_wiki_pages,
:view_wiki_pages,
:export_wiki_pages,
:view_wiki_edits,
:edit_wiki_pages,
:delete_wiki_pages,
:delete_wiki_pages_attachments,
:protect_wiki_pages,
:list_attachments,
:add_messages,
:edit_own_messages,
:delete_own_messages,
:browse_repository,
:view_changesets,
:commit_access,
:view_commit_author_statistics]
reporter = Role.create! :name => l(:default_role_reporter),
:position => 3,
:permissions => [:view_work_packages,
:add_work_packages,
:add_work_package_notes,
:save_queries,
:view_calendar,
:log_time,
:view_time_entries,
:comment_news,
:view_wiki_pages,
:view_wiki_edits,
:add_messages,
:edit_own_messages,
:browse_repository,
:view_changesets,
:view_commit_author_statistics]
reader = Role.create! :name => l(:default_role_reader),
:position => 5,
:permissions => [:view_work_packages,
:add_work_package_notes,
:edit_own_work_package_notes,
:save_queries,
:view_calendar,
:comment_news,
:view_project_associations,
:view_timelines,
:view_reportings,
:view_wiki_pages,
:export_wiki_pages,
:view_wiki_edits,
:edit_wiki_pages,
:list_attachments,
:add_messages,
:edit_own_messages,
:delete_own_messages,
:browse_repository,
:view_changesets]
Role.non_member.update_attributes :name => l(:default_role_non_member),
:permissions => [:view_work_packages,
:add_work_packages,
:add_work_package_notes,
:save_queries,
:view_calendar,
:view_time_entries,
:comment_news,
:view_wiki_pages,
:view_wiki_edits,
:add_messages,
:browse_repository,
:view_changesets,
:view_commit_author_statistics]
:view_calendar,
:comment_news,
:browse_repository,
:view_changesets,
:view_wiki_pages]
Role.anonymous.update_attributes :name => l(:default_role_anonymous),
:permissions => [:view_work_packages,
:view_calendar,
:view_time_entries,
:view_wiki_pages,
:view_wiki_edits,
:browse_repository,
:view_changesets,
:view_commit_author_statistics]
:view_wiki_pages]
# Colors
colors_list = PlanningElementTypeColor.ms_project_colors
colors_list = PlanningElementTypeColor.colors
colors = Hash[*(colors_list.map do |color|
color.save
color.reload
@ -135,78 +150,86 @@ module Redmine
end).flatten]
# Types
Type.create! :name => l(:default_type_bug),
:color_id => colors[:pjRed],
:is_default => true,
:is_in_roadmap => false,
task = Type.create! :name => l(:default_type_task),
:color_id => colors[:Mint],
:is_default => false,
:is_in_roadmap => true,
:in_aggregation => true,
:is_milestone => false,
:position => 1
Type.create! :name => l(:default_type_feature),
:is_default => true,
:color_id => colors[:pjLime],
deliverable = Type.create! :name => l(:default_type_deliverable),
:is_default => false,
:color_id => colors[:Orange],
:is_in_roadmap => true,
:in_aggregation => true,
:is_milestone => false,
:position => 2
Type.create! :name => l(:default_type_support),
milestone = Type.create! :name => l(:default_type_milestone),
:is_default => true,
:color_id => colors[:pjBlue],
:color_id => colors[:Purple],
:is_in_roadmap => false,
:in_aggregation => true,
:is_milestone => false,
:is_milestone => true,
:position => 3
Type.create! :name => l(:default_type_phase),
phase = Type.create! :name => l(:default_type_phase),
:is_default => true,
:color_id => colors[:pjSilver],
:color_id => colors[:Lime],
:is_in_roadmap => false,
:in_aggregation => true,
:is_milestone => false,
:position => 4
Type.create! :name => l(:default_type_milestone),
:is_default => true,
:color_id => colors[:pjPurple],
bug = Type.create! :name => l(:default_type_bug),
:is_default => false,
:color_id => colors[:'Red-bright'],
:is_in_roadmap => true,
:in_aggregation => true,
:is_milestone => true,
:is_milestone => false,
:position => 5
feature = Type.create! :name => l(:default_type_feature),
:is_default => false,
:color_id => colors[:Blue],
:is_in_roadmap => true,
:in_aggregation => true,
:is_milestone => false,
:position => 6
none = Type.standard_type
# Issue statuses
new = Status.create!(:name => l(:default_status_new), :is_closed => false, :is_default => true, :position => 1)
in_progress = Status.create!(:name => l(:default_status_in_progress), :is_closed => false, :is_default => false, :position => 3)
resolved = Status.create!(:name => l(:default_status_resolved), :is_closed => false, :is_default => false, :position => 3)
feedback = Status.create!(:name => l(:default_status_feedback), :is_closed => false, :is_default => false, :position => 4)
closed = Status.create!(:name => l(:default_status_closed), :is_closed => true, :is_default => false, :position => 5)
rejected = Status.create!(:name => l(:default_status_rejected), :is_closed => true, :is_default => false, :position => 6)
specified = Status.create!(:name => l(:default_status_specified), :is_closed => false, :is_default => false, :position => 2)
confirmed = Status.create!(:name => l(:default_status_confirmed), :is_closed => false, :is_default => false, :position => 3)
to_be_scheduled = Status.create!(:name => l(:default_status_to_be_scheduled), :is_closed => false, :is_default => false, :position => 4)
scheduled = Status.create!(:name => l(:default_status_scheduled), :is_closed => false, :is_default => false, :position => 5)
in_progress = Status.create!(:name => l(:default_status_in_progress), :is_closed => false, :is_default => false, :position => 6)
tested = Status.create!(:name => l(:default_status_tested), :is_closed => false, :is_default => false, :position => 7)
on_hold = Status.create!(:name => l(:default_status_on_hold), :is_closed => false, :is_default => false, :position => 8)
rejected = Status.create!(:name => l(:default_status_rejected), :is_closed => true, :is_default => false, :position => 9)
closed = Status.create!(:name => l(:default_status_closed), :is_closed => true, :is_default => false, :position => 10)
# Workflow
Type.find(:all).each { |t|
Status.find(:all).each { |os|
Status.find(:all).each { |ns|
Workflow.create!(:type_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
}
}
}
Type.find(:all).each { |t|
[new, in_progress, resolved, feedback].each { |os|
[in_progress, resolved, feedback, closed].each { |ns|
Workflow.create!(:type_id => t.id, :role_id => developer.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
}
}
}
Type.find(:all).each { |t|
[new, in_progress, resolved, feedback].each { |os|
[closed].each { |ns|
Workflow.create!(:type_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
statuses_for_task = [new, in_progress, on_hold, rejected, closed]
statuses_for_deliverable = [new, specified, in_progress, on_hold, rejected, closed]
statuses_for_none = [new, in_progress, rejected, closed]
statuses_for_milestone = [new, to_be_scheduled, scheduled, in_progress, on_hold, rejected, closed]
statuses_for_phase = statuses_for_milestone
statuses_for_bug = [new, confirmed, in_progress, tested, on_hold, rejected, closed]
statuses_for_feature = [new, specified, confirmed, in_progress, tested, on_hold, rejected, closed]
#Give each type its own workflow. Possible statuses are stored in one of the arrays above.
#Every status from the array gets a workflow to every other status from the array.
["task", "deliverable", "none", "milestone", "phase", "bug", "feature"].each { |t|
(eval "statuses_for_".concat(t)).each { |os|
(eval "statuses_for_".concat(t)).each { |ns|
[manager.id, member.id].each { |role_id|
Workflow.create!(:type_id => (eval t).id, :role_id => role_id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns
}
}
}
Workflow.create!(:type_id => t.id, :role_id => reporter.id, :old_status_id => resolved.id, :new_status_id => feedback.id)
}
# Enumerations
@ -214,11 +237,42 @@ module Redmine
IssuePriority.create!(:name => l(:default_priority_low), :position => 1)
IssuePriority.create!(:name => l(:default_priority_normal), :position => 2, :is_default => true)
IssuePriority.create!(:name => l(:default_priority_high), :position => 3)
IssuePriority.create!(:name => l(:default_priority_urgent), :position => 4)
IssuePriority.create!(:name => l(:default_priority_immediate), :position => 5)
TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1)
TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2)
TimeEntryActivity.create!(:name => l(:default_activity_management), :position => 1, :is_default => true)
TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 2)
TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 3)
TimeEntryActivity.create!(:name => l(:default_activity_testing), :position => 4)
TimeEntryActivity.create!(:name => l(:default_activity_Support), :position => 5)
TimeEntryActivity.create!(:name => l(:default_activity_Other), :position => 6)
ReportedProjectStatus.create!(:name => l(:default_reported_project_status_green), :is_default => true)
ReportedProjectStatus.create!(:name => l(:default_reported_project_status_amber), :is_default => false)
ReportedProjectStatus.create!(:name => l(:default_reported_project_status_red), :is_default => false)
# Project types
ProjectType.create!(:name => l(:default_project_type_customer))
ProjectType.create!(:name => l(:default_project_type_internal))
reported_status_ids = ReportedProjectStatus.find(:all).map { |rps| rps.id }
ProjectType.find(:all).each { |project|
project.update_attributes(reported_project_status_ids: reported_status_ids)
}
Setting['notified_events'] = ['work_package_added', \
'work_package_updated',\
'work_package_note_added',\
'work_package_updated',\
'status_updated',\
'work_package_updated',\
'work_package_priority_updated',\
'work_package_updated',\
'news_added', 'news_comment_added',\
'file_added',\
'message_posted',\
'wiki_content_added',\
'wiki_content_updated']
end
true
end

@ -69,7 +69,7 @@ namespace :timelines do
:available_project_status]
task :colors => :environment do
Color.ms_project_colors.map(&:save!)
Color.colors.map(&:save!)
end
task :project_types => :environment do

@ -126,7 +126,7 @@ FactoryGirl.define do
@project_types = Array.new
@planning_element_types = Array.new
@colors = PlanningElementTypeColor.ms_project_colors
@colors = PlanningElementTypeColor.colors
# create some project types

@ -82,7 +82,7 @@ class AdminControllerTest < ActionController::TestCase
post :default_configuration, :lang => 'de'
assert_response :redirect
assert_nil flash[:error]
assert Status.find_by_name('Neu')
assert Status.find_by_name('neu')
end
def test_test_email
@ -151,7 +151,7 @@ class AdminControllerTest < ActionController::TestCase
def delete_configuration_data
Role.delete_all('builtin = 0')
Type.delete_all
Type.delete_all('is_standard = false')
Status.delete_all
Enumeration.delete_all
end

@ -62,7 +62,7 @@ private
def delete_loaded_data!
Role.delete_all("builtin = 0")
Type.delete_all
Type.delete_all("is_standard = false")
Status.delete_all
Enumeration.delete_all
end

Loading…
Cancel
Save