@@ -17,6 +17,7 | |||
|
17 | 17 | |
|
18 | 18 | require 'SVG/Graph/Bar' |
|
19 | 19 | require 'SVG/Graph/BarHorizontal' |
|
20 | require 'digest/sha1' | |
|
20 | 21 | |
|
21 | 22 | class RepositoriesController < ApplicationController |
|
22 | 23 | layout 'base' |
@@ -73,10 +74,14 class RepositoriesController < ApplicationController | |||
|
73 | 74 | end |
|
74 | 75 | |
|
75 | 76 | def diff |
|
76 | @rev_to = params[:rev_to] || (@rev-1) | |
|
77 |
type = params[:type] |
|
|
78 | @diff = @repository.scm.diff(params[:path], @rev, @rev_to, type) | |
|
79 | show_error and return unless @diff | |
|
77 | @rev_to = (params[:rev_to] && params[:rev_to].to_i > 0) ? params[:rev_to].to_i : (@rev - 1) | |
|
78 | @diff_type = ('sbs' == params[:type]) ? 'sbs' : 'inline' | |
|
79 | ||
|
80 | @cache_key = "repositories/diff/#{@repository.id}/" + Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}") | |
|
81 | unless read_fragment(@cache_key) | |
|
82 | @diff = @repository.scm.diff(@path, @rev, @rev_to, type) | |
|
83 | show_error and return unless @diff | |
|
84 | end | |
|
80 | 85 | end |
|
81 | 86 | |
|
82 | 87 | def stats |
@@ -8,21 +8,22 | |||
|
8 | 8 | <% end %> |
|
9 | 9 | <% end %> |
|
10 | 10 | <p><label><%= l(:label_view_diff) %></label> |
|
11 | <%= select_tag 'type', options_for_select([[l(:label_diff_inline), "inline"], [l(:label_diff_side_by_side), "sbs"]], params[:type]), :onchange => "if (this.value != '') {this.form.submit()}" %> | |
|
12 | <%= submit_tag l(:button_apply) %></p> | |
|
11 | <%= select_tag 'type', options_for_select([[l(:label_diff_inline), "inline"], [l(:label_diff_side_by_side), "sbs"]], params[:type]), :onchange => "if (this.value != '') {this.form.submit()}" %></p> | |
|
13 | 12 | <% end %> |
|
13 | ||
|
14 | <% cache(@cache_key) do %> | |
|
14 | 15 | <% @diff.each do |table_file| %> |
|
15 |
<% if |
|
|
16 | <% if @diff_type == 'sbs' %> | |
|
16 | 17 | <table class="list"> |
|
17 | 18 | <thead> |
|
18 | 19 | <tr> |
|
19 | 20 | <th colspan="4" class="list-filename"> |
|
20 |
|
|
|
21 | <%= table_file.file_name %> | |
|
21 | 22 | </th> |
|
22 | 23 | </tr> |
|
23 | 24 | <tr> |
|
24 |
<th colspan="2"> |
|
|
25 |
<th colspan="2"> |
|
|
25 | <th colspan="2">@<%= @rev %></th> | |
|
26 | <th colspan="2">@<%= @rev_to %></th> | |
|
26 | 27 | </tr> |
|
27 | 28 | </thead> |
|
28 | 29 | <tbody> |
@@ -50,7 +51,7 | |||
|
50 | 51 | <thead> |
|
51 | 52 | <tr> |
|
52 | 53 | <th colspan="3" class="list-filename"> |
|
53 |
|
|
|
54 | <%= table_file.file_name %> | |
|
54 | 55 | </th> |
|
55 | 56 | </tr> |
|
56 | 57 | <tr> |
@@ -83,6 +84,7 | |||
|
83 | 84 | </table> |
|
84 | 85 | <% end %> |
|
85 | 86 | <% end %> |
|
87 | <% end %> | |
|
86 | 88 | |
|
87 | 89 | <% content_for :header_tags do %> |
|
88 | 90 | <%= stylesheet_link_tag "scm" %> |
General Comments 0
You need to be logged in to leave comments.
Login now