Pretty URL for the repository browser (Cyril Mougel)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@880 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d4e47d5d64
commit
d46e3a501e
|
@ -110,7 +110,7 @@ class RepositoriesController < ApplicationController
|
||||||
|
|
||||||
@cache_key = "repositories/diff/#{@repository.id}/" + Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}")
|
@cache_key = "repositories/diff/#{@repository.id}/" + Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}")
|
||||||
unless read_fragment(@cache_key)
|
unless read_fragment(@cache_key)
|
||||||
@diff = @repository.diff(@path, @rev, @rev_to, type)
|
@diff = @repository.diff(@path, @rev, @rev_to, @diff_type)
|
||||||
show_error and return unless @diff
|
show_error and return unless @diff
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -145,7 +145,7 @@ private
|
||||||
@project = Project.find(params[:id])
|
@project = Project.find(params[:id])
|
||||||
@repository = @project.repository
|
@repository = @project.repository
|
||||||
render_404 and return false unless @repository
|
render_404 and return false unless @repository
|
||||||
@path = params[:path].squeeze('/') if params[:path]
|
@path = params[:path].join('/') unless params[:path].nil?
|
||||||
@path ||= ''
|
@path ||= ''
|
||||||
@rev = params[:rev].to_i if params[:rev]
|
@rev = params[:rev].to_i if params[:rev]
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<% form_tag({:controller => 'repositories', :action => 'diff', :id => @project}, :method => :get) do %>
|
<% form_tag({:controller => 'repositories', :action => 'diff', :id => @project, :path => path}, :method => :get) do %>
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
|
@ -24,6 +24,5 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<%= hidden_field_tag 'path', path %>
|
|
||||||
<%= submit_tag(l(:label_view_diff), :class => 'small', :name => nil) if show_diff %>
|
<%= submit_tag(l(:label_view_diff), :class => 'small', :name => nil) if show_diff %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -17,6 +17,13 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
|
map.connect 'projects/:project_id/boards/:action/:id', :controller => 'boards'
|
||||||
map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
|
map.connect 'boards/:board_id/topics/:action/:id', :controller => 'messages'
|
||||||
|
|
||||||
|
map.with_options :controller => 'repositories' do |omap|
|
||||||
|
omap.repositories_show 'repositories/browse/:id/*path', :action => 'browse'
|
||||||
|
omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
|
||||||
|
omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
|
||||||
|
omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
|
||||||
|
end
|
||||||
|
|
||||||
# Allow downloading Web Service WSDL as a file with an extension
|
# Allow downloading Web Service WSDL as a file with an extension
|
||||||
# instead of a file named 'wsdl'
|
# instead of a file named 'wsdl'
|
||||||
map.connect ':controller/service.wsdl', :action => 'wsdl'
|
map.connect ':controller/service.wsdl', :action => 'wsdl'
|
||||||
|
|
Loading…
Reference in New Issue