Project

General

Profile

Patch #1601 ยป consistent_repository_navigation.patch

Bradley Whittington, 2008-07-08 14:22

View differences:

lang/en.yml (working copy)
548 548
button_annotate: Annotate
549 549
button_update: Update
550 550
button_configure: Configure
551
button_history: History
551 552

  
552 553
status_active: active
553 554
status_registered: registered
app/controllers/repositories_controller.rb (working copy)
47 47
    @repository.destroy
48 48
    redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'repository'
49 49
  end
50
  
50

  
51 51
  def show
52 52
    # check if new revisions have been committed in the repository
53 53
    @repository.fetch_changesets if Setting.autofetch_changesets?
......
61 61
  end
62 62
  
63 63
  def browse
64
    @changeset = @repository.changesets.find_by_revision(@rev)
64 65
    @entries = @repository.entries(@path, @rev)
65 66
    if request.xhr?
66 67
      @entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
......
96 97
  end
97 98
  
98 99
  def entry
100
    @changeset = @repository.changesets.find_by_revision(@rev)
99 101
    @entry = @repository.scm.entry(@path, @rev)
100 102
    show_error_not_found and return unless @entry
101 103
    
......
116 118
  end
117 119
  
118 120
  def annotate
121
    @entry = @repository.scm.entry(@path, @rev)
119 122
    @annotate = @repository.scm.annotate(@path, @rev)
120 123
    render_error l(:error_scm_annotate) and return if @annotate.nil? || @annotate.empty?
121 124
  rescue Redmine::Scm::Adapters::CommandFailed => e
......
142 145
  end
143 146
  
144 147
  def diff
148
    @entry = @repository.scm.entry(@path, @rev)
145 149
    @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
146 150
    @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
147 151
    
app/views/repositories/_navigation.rhtml (working copy)
16 16
    / <%= link_to h(filename), :action => 'changes', :id => @project, :path => "#{link_path}/#{filename}", :rev => @rev %>
17 17
<% end %>
18 18

  
19
<%= "@ #{revision}" if revision %>
20

  
19
<% if revision %>
20
@ <%= link_to "#{revision}", :action => 'revision', :id => @project, :rev => @rev %>
21
<% end %>
21 22
<% html_title(with_leading_slash(path)) -%>
app/views/repositories/revision.rhtml (working copy)
1
<div class="contextual">
2
  &#171;
3
  <% unless @changeset.previous.nil? -%>
4
    <%= link_to l(:label_previous), :controller => 'repositories', :action => 'revision', :id => @project, :rev => @changeset.previous.revision %>
5
  <% else -%>
6
    <%= l(:label_previous) %>
7
  <% end -%>
8
|
9
  <% unless @changeset.next.nil? -%>
10
    <%= link_to l(:label_next), :controller => 'repositories', :action => 'revision', :id => @project, :rev => @changeset.next.revision %>
11
  <% else -%>
12
    <%= l(:label_next) %>
13
  <% end -%>
14
  &#187;&nbsp;
15
  
16
  <% form_tag do %>
17
    <%= text_field_tag 'rev', @rev, :size => 5 %>
18
    <%= submit_tag 'OK' %>
19
  <% end %>
20
</div>
1
<%= render :partial => 'changeset_nav', :locals => {:changeset => @changeset,:rev => @rev, :action => 'revision'} %>
21 2

  
22 3
<h2><%= l(:label_revision) %> <%= format_revision(@changeset.revision) %></h2>
23 4

  
......
46 27
<tbody>
47 28
<% @changes.each do |change| %>
48 29
<tr class="<%= cycle 'odd', 'even' %>">
49
<td><div class="square action_<%= change.action %>"></div> <%= change.path %> <%= "(#{change.revision})" unless change.revision.blank?  %></td>
30
<td><div class="square action_<%= change.action %>"></div> <%= link_to change.path, :action => 'entry', :id => @project, :path => without_leading_slash(change.relative_path) %> <%= "(#{change.revision})" unless change.revision.blank?  %></td>
50 31
<td align="right">
51 32
<% if change.action == "M" %>
52 33
<%= link_to l(:label_view_diff), :action => 'diff', :id => @project, :path => without_leading_slash(change.relative_path), :rev => @changeset.revision %>
34
| <%= link_to l(:button_history), :action => 'changes', :id => @project, :path => without_leading_slash(change.relative_path), :rev => @changeset.revision %>
35
| <%= link_to l(:button_annotate), :action => 'annotate', :id => @project, :path => without_leading_slash(change.relative_path), :rev => @changeset.revision  %>
53 36
<% end %>
54 37
</td>
55 38
</tr>
app/views/repositories/browse.rhtml (working copy)
1
<div class="contextual">
2
<% form_tag do %>
3
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
4
<% end %>
5
</div>
1
<%= render :partial => 'changeset_nav', :locals => {:changeset => @changeset,:rev => @rev, :project => @project, :action => 'browse'} %>
6 2

  
7 3
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'dir', :revision => @rev } %></h2>
8 4

  
app/views/repositories/entry.rhtml (working copy)
1
<div class="contextual">
2
<% form_tag do %>
3
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
4
<% end %>
5
</div>
6

  
1 7
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
2 8

  
9
<%= render :partial => 'entry_nav', :locals => {:entry => @entry,:current_view => 'view'} %>
10

  
3 11
<div class="autoscroll">
4 12
<table class="filecontent CodeRay">
5 13
<tbody>
app/views/repositories/_entry_nav.rhtml (revision 0)
1
<h3><%=h @entry.name %></h3>
2

  
3
<p>
4
<% if current_view != 'history' %><%= link_to l(:button_history), {:action => 'changes', :id => @project, :path => @path, :rev => @rev } %> |<%end%>
5
<% if current_view != 'view' %>
6
 <% if @repository.supports_cat? %>
7
     <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
8
 <% end %>
9
<% end %>
10

  
11
<% if current_view != 'annotate' %>
12
 <% if @repository.supports_annotate? %>
13
     <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => @path, :rev => @rev } %> |
14
 <% end %>
15
<% end %>
16
<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
17
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
18
</p>
19

  
app/views/repositories/_changeset_nav.rhtml (revision 0)
1
<div class="contextual">
2
<% if @changeset %>  &#171;
3
  <% unless @changeset.previous.nil? -%>
4
    <%= link_to l(:label_previous), :controller => 'repositories', :action => action, :id => @project, :rev => @changeset.previous.revision %>
5
  <% else -%>
6
    <%= l(:label_previous) %>
7
  <% end -%>
8
|
9
  <% unless @changeset.next.nil? -%>
10
    <%= link_to l(:label_next), :controller => 'repositories', :action => action, :id => @project, :rev => @changeset.next.revision %>
11
  <% else -%>
12
    <%= l(:label_next) %>
13
  <% end -%>
14
  &#187;&nbsp;
15
<% end %>
16
  <% form_tag do %>
17
    <%= text_field_tag 'rev', @rev, :size => 5 %>
18
    <%= submit_tag 'OK' %>
19
  <% end %>
20
</div>
app/views/repositories/changes.rhtml (working copy)
1
<div class="contextual">
2
<% form_tag do %>
3
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
4
<% end %>
5
</div>
6

  
1 7
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2>
2 8

  
3
<h3><%=h @entry.name %></h3>
9
<%= render :partial => 'entry_nav', :locals => {:entry => @entry,:current_view => 'history'} %>
4 10

  
5
<p>
6
<% if @repository.supports_cat? %>
7
    <%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
8
<% end %>
9
<% if @repository.supports_annotate? %>
10
    <%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => @path, :rev => @rev } %> |
11
<% end %>
12
<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
13
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
14
</p>
15

  
16 11
<%= render(:partial => 'revisions', 
17 12
           :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }) unless @changesets.empty? %>
18 13

  
app/views/repositories/diff.rhtml (working copy)
1
<h2><%= l(:label_revision) %> <%= format_revision(@rev) %> <%= @path.gsub(/^.*\//, '') %></h2>
1
<div class="contextual">
2
<% form_tag do %>
3
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
4
<% end %>
5
</div>
2 6

  
7

  
8
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %></h2>
9

  
10
<%= render :partial => 'entry_nav', :locals => {:entry => @entry} %>
11

  
12

  
3 13
<!-- Choose view type -->
4 14
<% form_tag({ :controller => 'repositories', :action => 'diff'}, :method => 'get') do %>
5 15
  <% params.each do |k, p| %>
app/views/repositories/annotate.rhtml (working copy)
1
<div class="contextual">
2
<% form_tag do %>
3
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
4
<% end %>
5
</div>
6

  
1 7
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
2 8

  
9
<%= render :partial => 'entry_nav', :locals => {:entry => @entry,:current_view => 'annotate'} %>
10

  
3 11
<% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
4 12

  
5 13
<div class="autoscroll">
    (1-1/1)