Project

General

Profile

Feature #15180 » 0001-Add-start-date-to-versions_WIP.patch

Marius BĂLTEANU, 2018-09-01 12:09

View differences:

app/models/version.rb
151 151
  safe_attributes 'name',
152 152
    'description',
153 153
    'effective_date',
154
    'start_date',
154 155
    'due_date',
155 156
    'wiki_page_title',
156 157
    'status',
......
181 182
  end
182 183

  
183 184
  def start_date
184
    @start_date ||= fixed_issues.minimum('start_date')
185
    version_start_date = read_attribute('start_date')
186
    if version_start_date.nil?
187
      @start_date = fixed_issues.minimum('start_date')
188
    else
189
      @start_date = version_start_date
190
    end
185 191
  end
186 192

  
187 193
  def due_date
app/views/versions/_form.html.erb
8 8
  <p><%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]} %></p>
9 9
<% end %>
10 10
<p><%= f.text_field :wiki_page_title, :label => :label_wiki_page, :size => 60, :disabled => @project.wiki.nil? %></p>
11
<p><%= f.date_field :start_date, :size => 10 %><%= calendar_for('version_start_date') %></p>
11 12
<p><%= f.date_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
12 13
<p><%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]} %></p>
13 14
<% if @version.new_record? %>
db/migrate/20180901095034_add_start_date_to_versions.rb
1
class AddStartDateToVersions < ActiveRecord::Migration[5.2]
2
  def change
3
    add_column :versions, :start_date, :date, :after => :description
4
  end
5
end
(2-2/3)