diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2009-10-21 22:34:22 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2009-10-21 22:34:22 +0000 |
commit | ac4937a76755de2f9b6a83f6160efa0fde2d03aa (patch) | |
tree | 611bf32cf6c377b65e3362583f4846e1f6a69210 /app | |
parent | 29ab7b4108cb45bc4efb44253419fa2e658ac3e9 (diff) | |
download | redmine-ac4937a76755de2f9b6a83f6160efa0fde2d03aa.tar.gz redmine-ac4937a76755de2f9b6a83f6160efa0fde2d03aa.zip |
Enumerations can now have custom fields defined on them. #4077
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2945 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/enumerations_controller.rb | 3 | ||||
-rw-r--r-- | app/helpers/custom_fields_helper.rb | 5 | ||||
-rw-r--r-- | app/models/document_category_custom_field.rb | 23 | ||||
-rw-r--r-- | app/models/enumeration.rb | 1 | ||||
-rw-r--r-- | app/models/issue_priority_custom_field.rb | 23 | ||||
-rw-r--r-- | app/models/time_entry_activity_custom_field.rb | 23 | ||||
-rw-r--r-- | app/views/custom_fields/_form.rhtml | 3 | ||||
-rw-r--r-- | app/views/enumerations/_form.rhtml | 4 |
8 files changed, 84 insertions, 1 deletions
diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 63965fae1..8070df03d 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -17,6 +17,9 @@ class EnumerationsController < ApplicationController before_filter :require_admin + + helper :custom_fields + include CustomFieldsHelper def index list diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index 6e99b6a7c..2545dd893 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -22,7 +22,10 @@ module CustomFieldsHelper {:name => 'TimeEntryCustomField', :partial => 'custom_fields/index', :label => :label_spent_time}, {:name => 'ProjectCustomField', :partial => 'custom_fields/index', :label => :label_project_plural}, {:name => 'UserCustomField', :partial => 'custom_fields/index', :label => :label_user_plural}, - {:name => 'GroupCustomField', :partial => 'custom_fields/index', :label => :label_group_plural} + {:name => 'GroupCustomField', :partial => 'custom_fields/index', :label => :label_group_plural}, + {:name => 'TimeEntryActivityCustomField', :label => TimeEntryActivity::OptionName}, + {:name => 'IssuePriorityCustomField', :label => IssuePriority::OptionName}, + {:name => 'DocumentCategoryCustomField', :label => DocumentCategory::OptionName} ] end diff --git a/app/models/document_category_custom_field.rb b/app/models/document_category_custom_field.rb new file mode 100644 index 000000000..5cde029c2 --- /dev/null +++ b/app/models/document_category_custom_field.rb @@ -0,0 +1,23 @@ +# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class DocumentCategoryCustomField < CustomField + def type_name + :enumeration_doc_categories + end +end + diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb index 380a4d3d2..4fb7d6d07 100644 --- a/app/models/enumeration.rb +++ b/app/models/enumeration.rb @@ -17,6 +17,7 @@ class Enumeration < ActiveRecord::Base acts_as_list :scope => 'type = \'#{type}\'' + acts_as_customizable before_destroy :check_integrity diff --git a/app/models/issue_priority_custom_field.rb b/app/models/issue_priority_custom_field.rb new file mode 100644 index 000000000..559bafeb9 --- /dev/null +++ b/app/models/issue_priority_custom_field.rb @@ -0,0 +1,23 @@ +# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class IssuePriorityCustomField < CustomField + def type_name + :enumeration_issue_priorities + end +end + diff --git a/app/models/time_entry_activity_custom_field.rb b/app/models/time_entry_activity_custom_field.rb new file mode 100644 index 000000000..149bbb5c8 --- /dev/null +++ b/app/models/time_entry_activity_custom_field.rb @@ -0,0 +1,23 @@ +# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class TimeEntryActivityCustomField < CustomField + def type_name + :enumeration_time_entry_activities + end +end + diff --git a/app/views/custom_fields/_form.rhtml b/app/views/custom_fields/_form.rhtml index b9d7ec017..f82d28784 100644 --- a/app/views/custom_fields/_form.rhtml +++ b/app/views/custom_fields/_form.rhtml @@ -94,6 +94,9 @@ when "IssueCustomField" %> <% when "TimeEntryCustomField" %> <p><%= f.check_box :is_required %></p> +<% else %> + <p><%= f.check_box :is_required %></p> + <% end %> <%= call_hook(:"view_custom_fields_form_#{@custom_field.type.to_s.underscore}", :custom_field => @custom_field, :form => f) %> </div> diff --git a/app/views/enumerations/_form.rhtml b/app/views/enumerations/_form.rhtml index dac0c9331..741bbc5d9 100644 --- a/app/views/enumerations/_form.rhtml +++ b/app/views/enumerations/_form.rhtml @@ -9,4 +9,8 @@ <p><label for="enumeration_is_default"><%=l(:field_is_default)%></label> <%= check_box 'enumeration', 'is_default' %></p> <!--[eoform:optvalue]--> + +<% @enumeration.custom_field_values.each do |value| %> + <p><%= custom_field_tag_with_label :enumeration, value %></p> +<% end %> </div>
\ No newline at end of file |