summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-15 15:22:55 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-15 15:22:55 +0000
commitba7cf9c3ce6c970a2ecb49d1f4ab276a071ada40 (patch)
tree8ec30a96db6089c7e140e7cb2a4ea5c864fe1ac8
parent7d57833740bb546753d6d908ee082e8268044fa3 (diff)
downloadredmine-ba7cf9c3ce6c970a2ecb49d1f4ab276a071ada40.tar.gz
redmine-ba7cf9c3ce6c970a2ecb49d1f4ab276a071ada40.zip
Adds custom fields for versions (#4219).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3064 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/versions_controller.rb2
-rw-r--r--app/helpers/custom_fields_helper.rb1
-rw-r--r--app/models/version.rb1
-rw-r--r--app/models/version_custom_field.rb22
-rw-r--r--app/views/versions/_form.rhtml4
-rw-r--r--app/views/versions/_overview.rhtml7
6 files changed, 37 insertions, 0 deletions
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index 6513d080c..7be042d9f 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -21,6 +21,8 @@ class VersionsController < ApplicationController
before_filter :find_project, :only => :close_completed
before_filter :authorize
+ helper :custom_fields
+
def show
end
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 13348546b..e11f7ccfe 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -21,6 +21,7 @@ module CustomFieldsHelper
tabs = [{:name => 'IssueCustomField', :partial => 'custom_fields/index', :label => :label_issue_plural},
{:name => 'TimeEntryCustomField', :partial => 'custom_fields/index', :label => :label_spent_time},
{:name => 'ProjectCustomField', :partial => 'custom_fields/index', :label => :label_project_plural},
+ {:name => 'VersionCustomField', :partial => 'custom_fields/index', :label => :label_version_plural},
{:name => 'UserCustomField', :partial => 'custom_fields/index', :label => :label_user_plural},
{:name => 'GroupCustomField', :partial => 'custom_fields/index', :label => :label_group_plural},
{:name => 'TimeEntryActivityCustomField', :partial => 'custom_fields/index', :label => TimeEntryActivity::OptionName},
diff --git a/app/models/version.rb b/app/models/version.rb
index dc72e8212..e63ed46cf 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -19,6 +19,7 @@ class Version < ActiveRecord::Base
before_destroy :check_integrity
belongs_to :project
has_many :fixed_issues, :class_name => 'Issue', :foreign_key => 'fixed_version_id'
+ acts_as_customizable
acts_as_attachable :view_permission => :view_files,
:delete_permission => :manage_files
diff --git a/app/models/version_custom_field.rb b/app/models/version_custom_field.rb
new file mode 100644
index 000000000..400caf0df
--- /dev/null
+++ b/app/models/version_custom_field.rb
@@ -0,0 +1,22 @@
+# Redmine - project management software
+# Copyright (C) 2006-2009 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 VersionCustomField < CustomField
+ def type_name
+ :label_version_plural
+ end
+end
diff --git a/app/views/versions/_form.rhtml b/app/views/versions/_form.rhtml
index dfdbc18fe..13579b8b6 100644
--- a/app/views/versions/_form.rhtml
+++ b/app/views/versions/_form.rhtml
@@ -6,4 +6,8 @@
<p><%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %></p>
<p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
<p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
+
+<% @version.custom_field_values.each do |value| %>
+ <p><%= custom_field_tag_with_label :version, value %></p>
+<% end %>
</div>
diff --git a/app/views/versions/_overview.rhtml b/app/views/versions/_overview.rhtml
index 724f9f923..550cf3e78 100644
--- a/app/views/versions/_overview.rhtml
+++ b/app/views/versions/_overview.rhtml
@@ -5,6 +5,13 @@
<% end %>
<p><%=h version.description %></p>
+<ul>
+ <% version.custom_values.each do |custom_value| %>
+ <% if !custom_value.value.blank? %>
+ <li><%=h custom_value.custom_field.name %>: <%=h show_value(custom_value) %></li>
+ <% end %>
+ <% end %>
+</ul>
<% if version.fixed_issues.count > 0 %>
<%= progress_bar([version.closed_pourcent, version.completed_pourcent], :width => '40em', :legend => ('%0.0f%' % version.completed_pourcent)) %>