* Added links to previous and next revisions on revision view (patch by Cyril Mougel slightly edited)

* Fixed TimelogController#report december error
* Fixed ProjectsControllerTest#test_activity 1st and 2nd day of the month failure

git-svn-id: http://redmine.rubyforge.org/svn/trunk@938 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-12-01 17:15:42 +00:00
parent 3baf086e2d
commit db002edabd
10 changed files with 118 additions and 11 deletions
+11 -3
View File
@@ -19,6 +19,9 @@ require 'SVG/Graph/Bar'
require 'SVG/Graph/BarHorizontal'
require 'digest/sha1'
class ChangesetNotFound < Exception
end
class RepositoriesController < ApplicationController
layout 'base'
before_filter :find_repository, :except => :edit
@@ -94,14 +97,19 @@ class RepositoriesController < ApplicationController
def revision
@changeset = @repository.changesets.find_by_revision(@rev)
show_error and return unless @changeset
raise ChangesetNotFound unless @changeset
@changes_count = @changeset.changes.size
@changes_pages = Paginator.new self, @changes_count, 150, params['page']
@changes = @changeset.changes.find(:all,
:limit => @changes_pages.items_per_page,
:offset => @changes_pages.current.offset)
render :action => "revision", :layout => false if request.xhr?
respond_to do |format|
format.html
format.js {render :layout => false}
end
rescue ChangesetNotFound
show_error
end
def diff
+1 -1
View File
@@ -54,7 +54,7 @@ class TimelogController < ApplicationController
begin; @date_to = params[:date_to].to_date; rescue; end
end
@date_from ||= Date.civil(Date.today.year, 1, 1)
@date_to ||= Date.civil(Date.today.year, Date.today.month+1, 1) - 1
@date_to ||= (Date.civil(Date.today.year, Date.today.month, 1) >> 1) - 1
unless @criterias.empty?
sql_select = @criterias.collect{|criteria| @available_criterias[criteria][:sql] + " AS " + criteria}.join(', ')
+10
View File
@@ -91,4 +91,14 @@ class Changeset < ActiveRecord::Base
self.issues = referenced_issues.uniq
end
# Returns the previous changeset
def previous
@previous ||= Changeset.find(:first, :conditions => ['revision < ? AND repository_id = ?', self.revision, self.repository_id], :order => 'revision DESC')
end
# Returns the next changeset
def next
@next ||= Changeset.find(:first, :conditions => ['revision > ? AND repository_id = ?', self.revision, self.repository_id], :order => 'revision ASC')
end
end
+18 -4
View File
@@ -1,8 +1,22 @@
<div class="contextual">
<% form_tag do %>
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
<%= submit_tag 'OK' %>
<% end %>
&#171;
<% unless @changeset.previous.nil? -%>
<%= link_to l(:label_previous), :controller => 'repositories', :action => 'revision', :id => @project, :rev => @changeset.previous.revision %>
<% else -%>
<%= l(:label_previous) %>
<% end -%>
|
<% unless @changeset.next.nil? -%>
<%= link_to l(:label_next), :controller => 'repositories', :action => 'revision', :id => @project, :rev => @changeset.next.revision %>
<% else -%>
<%= l(:label_next) %>
<% end -%>
&#187;&nbsp;
<% form_tag do %>
<%= text_field_tag 'rev', @rev, :size => 5 %>
<%= submit_tag 'OK' %>
<% end %>
</div>
<h2><%= l(:label_revision) %> <%= @changeset.revision %></h2>