Versions can now be created with no date.
Versions with no date appear at the end of the roadmap, sorted by name. git-svn-id: http://redmine.rubyforge.org/svn/trunk@536 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
bb1fccb7b7
commit
d34ea9a569
|
@ -426,35 +426,25 @@ class ProjectsController < ApplicationController
|
||||||
Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
|
Mailer.deliver_attachments_add(@attachments) if !@attachments.empty? and Permission.find_by_controller_and_action(params[:controller], params[:action]).mail_enabled?
|
||||||
redirect_to :controller => 'projects', :action => 'list_files', :id => @project
|
redirect_to :controller => 'projects', :action => 'list_files', :id => @project
|
||||||
end
|
end
|
||||||
@versions = @project.versions
|
@versions = @project.versions.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
def list_files
|
def list_files
|
||||||
@versions = @project.versions
|
@versions = @project.versions.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
# Show changelog for @project
|
# Show changelog for @project
|
||||||
def changelog
|
def changelog
|
||||||
@trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
|
@trackers = Tracker.find(:all, :conditions => ["is_in_chlog=?", true], :order => 'position')
|
||||||
retrieve_selected_tracker_ids(@trackers)
|
retrieve_selected_tracker_ids(@trackers)
|
||||||
|
@versions = @project.versions.sort
|
||||||
@fixed_issues = @project.issues.find(:all,
|
|
||||||
:include => [ :fixed_version, :status, :tracker ],
|
|
||||||
:conditions => [ "#{IssueStatus.table_name}.is_closed=? and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}) and #{Issue.table_name}.fixed_version_id is not null", true],
|
|
||||||
:order => "#{Version.table_name}.effective_date DESC, #{Issue.table_name}.id DESC"
|
|
||||||
) unless @selected_tracker_ids.empty?
|
|
||||||
@fixed_issues ||= []
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def roadmap
|
def roadmap
|
||||||
@trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position')
|
@trackers = Tracker.find(:all, :conditions => ["is_in_roadmap=?", true], :order => 'position')
|
||||||
retrieve_selected_tracker_ids(@trackers)
|
retrieve_selected_tracker_ids(@trackers)
|
||||||
conditions = ("1" == params[:completed] ? nil : [ "#{Version.table_name}.effective_date > ?", Date.today])
|
conditions = ("1" == params[:completed] ? nil : [ "#{Version.table_name}.effective_date > ? OR #{Version.table_name}.effective_date IS NULL", Date.today])
|
||||||
|
@versions = @project.versions.find(:all, :conditions => conditions).sort
|
||||||
@versions = @project.versions.find(:all,
|
|
||||||
:conditions => conditions,
|
|
||||||
:order => "#{Version.table_name}.effective_date ASC"
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def activity
|
def activity
|
||||||
|
|
|
@ -94,7 +94,7 @@ class Query < ActiveRecord::Base
|
||||||
@available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values }
|
@available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values }
|
||||||
@available_filters["author_id"] = { :type => :list, :order => 5, :values => user_values }
|
@available_filters["author_id"] = { :type => :list, :order => 5, :values => user_values }
|
||||||
@available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } }
|
@available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } }
|
||||||
@available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.collect{|s| [s.name, s.id.to_s] } }
|
@available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.sort.collect{|s| [s.name, s.id.to_s] } }
|
||||||
unless @project.children.empty?
|
unless @project.children.empty?
|
||||||
@available_filters["subproject_id"] = { :type => :list_one_or_more, :order => 13, :values => @project.children.collect{|s| [s.name, s.id.to_s] } }
|
@available_filters["subproject_id"] = { :type => :list_one_or_more, :order => 13, :values => @project.children.collect{|s| [s.name, s.id.to_s] } }
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Version < ActiveRecord::Base
|
||||||
|
|
||||||
validates_presence_of :name
|
validates_presence_of :name
|
||||||
validates_uniqueness_of :name, :scope => [:project_id]
|
validates_uniqueness_of :name, :scope => [:project_id]
|
||||||
validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :activerecord_error_not_a_date
|
validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :activerecord_error_not_a_date, :allow_nil => true
|
||||||
|
|
||||||
def start_date
|
def start_date
|
||||||
effective_date
|
effective_date
|
||||||
|
@ -37,6 +37,16 @@ class Version < ActiveRecord::Base
|
||||||
effective_date && effective_date <= Date.today
|
effective_date && effective_date <= Date.today
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Versions are sorted by effective_date
|
||||||
|
# Those with no effective_date are at the end, sorted by name
|
||||||
|
def <=>(version)
|
||||||
|
if self.effective_date
|
||||||
|
version.effective_date ? (self.effective_date <=> version.effective_date) : -1
|
||||||
|
else
|
||||||
|
version.effective_date ? 1 : (self.name <=> version.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def check_integrity
|
def check_integrity
|
||||||
raise "Can't delete version" if self.fixed_issues.find(:first)
|
raise "Can't delete version" if self.fixed_issues.find(:first)
|
||||||
|
|
|
@ -11,17 +11,26 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @fixed_issues.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
|
<% if @versions.empty? %><p><i><%= l(:label_no_data) %></i></p><% end %>
|
||||||
|
|
||||||
<% ver_id = nil
|
<% @versions.each do |version| %>
|
||||||
@fixed_issues.each do |issue| %>
|
<a name="<%= version.name %>"><h3 class="icon22 icon22-package"><%= version.name %></h3></a>
|
||||||
<% unless ver_id == issue.fixed_version_id %>
|
<% if version.completed? %>
|
||||||
<% if ver_id %></ul><% end %>
|
<p><%= format_date(version.effective_date) %></p>
|
||||||
<h3 class="icon22 icon22-package"><%= issue.fixed_version.name %></h3>
|
<% elsif version.effective_date %>
|
||||||
<p><%= format_date(issue.fixed_version.effective_date) %><br />
|
<p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p>
|
||||||
<%=h issue.fixed_version.description %></p>
|
<% end %>
|
||||||
|
<p><%=h version.description %></p>
|
||||||
|
<% issues = version.fixed_issues.find(:all,
|
||||||
|
:include => [:status, :tracker],
|
||||||
|
:conditions => ["#{IssueStatus.table_name}.is_closed=? AND #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')})", true],
|
||||||
|
:order => "#{Tracker.table_name}.position")
|
||||||
|
%>
|
||||||
|
<% if !issues.empty? %>
|
||||||
<ul>
|
<ul>
|
||||||
<% ver_id = issue.fixed_version_id
|
<% issues.each do |issue| %>
|
||||||
end %>
|
<li><%= link_to_issue(issue) %>: <%=h issue.subject %></li>
|
||||||
<li><%= link_to_issue issue %>: <%=h issue.subject %></li>
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<a name="<%= version.name %>"><h3 class="icon22 icon22-package"><%= version.name %></h3></a>
|
<a name="<%= version.name %>"><h3 class="icon22 icon22-package"><%= version.name %></h3></a>
|
||||||
<% if version.completed? %>
|
<% if version.completed? %>
|
||||||
<p><%= format_date(version.effective_date) %></p>
|
<p><%= format_date(version.effective_date) %></p>
|
||||||
<% else %>
|
<% elsif version.effective_date %>
|
||||||
<p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p>
|
<p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p><%=h version.description %></p>
|
<p><%=h version.description %></p>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead><th><%= l(:label_version) %></th><th><%= l(:field_effective_date) %></th><th><%= l(:field_description) %></th><th style="width:15%"></th><th style="width:15%"></th></thead>
|
<thead><th><%= l(:label_version) %></th><th><%= l(:field_effective_date) %></th><th><%= l(:field_description) %></th><th style="width:15%"></th><th style="width:15%"></th></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% for version in @project.versions %>
|
<% for version in @project.versions.sort %>
|
||||||
<tr class="<%= cycle 'odd', 'even' %>">
|
<tr class="<%= cycle 'odd', 'even' %>">
|
||||||
<td><%=h version.name %></td>
|
<td><%=h version.name %></td>
|
||||||
<td align="center"><%= format_date(version.effective_date) %></td>
|
<td align="center"><%= format_date(version.effective_date) %></td>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<!--[form:version]-->
|
<!--[form:version]-->
|
||||||
<p><%= f.text_field :name, :size => 20, :required => true %></p>
|
<p><%= f.text_field :name, :size => 20, :required => true %></p>
|
||||||
<p><%= f.text_field :description, :size => 60 %></p>
|
<p><%= f.text_field :description, :size => 60 %></p>
|
||||||
<p><%= f.text_field :effective_date, :size => 10, :required => true %><%= calendar_for('version_effective_date') %></p>
|
<p><%= f.text_field :effective_date, :size => 10 %><%= calendar_for('version_effective_date') %></p>
|
||||||
<!--[eoform:version]-->
|
<!--[eoform:version]-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class AllowNullVersionEffectiveDate < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
change_column :versions, :effective_date, :date, :default => nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
raise IrreversibleMigration
|
||||||
|
end
|
||||||
|
end
|
|
@ -15,3 +15,12 @@ versions_002:
|
||||||
id: 2
|
id: 2
|
||||||
description: Stable release
|
description: Stable release
|
||||||
effective_date: 2006-07-19
|
effective_date: 2006-07-19
|
||||||
|
versions_003:
|
||||||
|
created_on: 2006-07-19 21:00:33 +02:00
|
||||||
|
name: "2.0"
|
||||||
|
project_id: 1
|
||||||
|
updated_on: 2006-07-19 21:00:33 +02:00
|
||||||
|
id: 3
|
||||||
|
description: Future version
|
||||||
|
effective_date:
|
||||||
|
|
|
@ -109,7 +109,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
||||||
get :changelog, :id => 1
|
get :changelog, :id => 1
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'changelog'
|
assert_template 'changelog'
|
||||||
assert_not_nil assigns(:fixed_issues)
|
assert_not_nil assigns(:versions)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_roadmap
|
def test_roadmap
|
||||||
|
|
Loading…
Reference in New Issue