Project

General

Profile

Feature #1828 » 0001-Adding-default-version.patch

Patch to set a default version per project - Eric Thomas, 2010-07-12 22:37

View differences:

app/models/project.rb
20 20
  STATUS_ACTIVE     = 1
21 21
  STATUS_ARCHIVED   = 9
22 22
  
23
  belongs_to :default_version, :class_name => 'Version', :foreign_key => 'default_version_id'
24

  
23 25
  # Specific overidden Activities
24 26
  has_many :time_entry_activities
25 27
  has_many :members, :include => [:user, :roles], :conditions => "#{User.table_name}.type='User' AND #{User.table_name}.status=#{User::STATUS_ACTIVE}"
app/views/issues/_attributes.rhtml
19 19
                     :tabindex => 199) if authorize_for('issue_categories', 'new') %></p>
20 20
<% end %>
21 21
<% unless @issue.assignable_versions.empty? %>
22
<p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version), :include_blank => true %>
22
<p><%= f.select :fixed_version_id, version_options_for_select(@issue.assignable_versions, @issue.fixed_version ||= @project.default_version), :include_blank => true %>
23 23
<%= prompt_to_remote(image_tag('add.png', :style => 'vertical-align: middle;'),
24 24
                     l(:label_version_new),
25 25
                     'version[name]', 
app/views/projects/_form.rhtml
15 15
<% end %></p>
16 16
<p><%= f.text_field :homepage, :size => 60 %></p>
17 17
<p><%= f.check_box :is_public %></p>
18

  
19
<% if Project.exists?(@project) && !@project.shared_versions.empty? %>
20
  <p><%= f.select :default_version_id, version_options_for_select(@project.shared_versions, @project.default_version), :include_blank => true %></p>
21
<% end %>
22

  
18 23
<%= wikitoolbar_for 'project_description' %>
19 24

  
20 25
<% @project.custom_field_values.each do |value| %>
config/locales/en.yml
241 241
  field_new_password: New password
242 242
  field_password_confirmation: Confirmation
243 243
  field_version: Version
244
  field_default_version: Default version
244 245
  field_type: Type
245 246
  field_host: Host
246 247
  field_port: Port
db/migrate/109_add_default_version_to_project.rb
1
class AddDefaultVersionToProject < ActiveRecord::Migration
2
  def self.up
3
    add_column :projects, :default_version_id, :integer, :default => nil
4
  end
5

  
6
  def self.down
7
    remove_column :projects, :default_version_id
8
  end
9
end
(1-1/4)