scm: git: show only filename and filesize if setting of reporting last commit is disable (#8365, #7047).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5775 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-05-13 03:55:21 +00:00
parent 625b7d9051
commit d65c3d438d
5 changed files with 20 additions and 5 deletions

View File

@ -80,6 +80,10 @@ class Repository < ActiveRecord::Base
write_attribute(:extra_info, h) write_attribute(:extra_info, h)
end end
def report_last_commit
true
end
def supports_cat? def supports_cat?
scm.supports_cat? scm.supports_cat?
end end

View File

@ -38,6 +38,10 @@ class Repository::Git < Repository
'Git' 'Git'
end end
def report_last_commit
extra_report_last_commit
end
def extra_report_last_commit def extra_report_last_commit
return false if extra_info.nil? return false if extra_info.nil?
v = extra_info["extra_report_last_commit"] v = extra_info["extra_report_last_commit"]

View File

@ -3,10 +3,12 @@
<tr id="root"> <tr id="root">
<th><%= l(:field_name) %></th> <th><%= l(:field_name) %></th>
<th><%= l(:field_filesize) %></th> <th><%= l(:field_filesize) %></th>
<% if @repository.report_last_commit %>
<th><%= l(:label_revision) %></th> <th><%= l(:label_revision) %></th>
<th><%= l(:label_age) %></th> <th><%= l(:label_age) %></th>
<th><%= l(:field_author) %></th> <th><%= l(:field_author) %></th>
<th><%= l(:field_comments) %></th> <th><%= l(:field_comments) %></th>
<% end %>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -4,7 +4,8 @@
<% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(entry.path) %> <% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(entry.path) %>
<% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %> <% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %>
<tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>"> <tr id="<%= tr_id %>" class="<%= h params[:parent_id] %> entry <%= entry.kind %>">
<td style="padding-left: <%=18 * depth%>px;" class="filename"> <td style="padding-left: <%=18 * depth%>px;" class="<%=
@repository.report_last_commit ? "filename" : "filename_no_report" %>";>
<% if entry.is_dir? %> <% if entry.is_dir? %>
<span class="expander" onclick="<%= remote_function :url => {:action => 'show', :id => @project, :path => to_path_param(ent_path), :rev => @rev, :depth => (depth + 1), :parent_id => tr_id}, <span class="expander" onclick="<%= remote_function :url => {:action => 'show', :id => @project, :path => to_path_param(ent_path), :rev => @rev, :depth => (depth + 1), :parent_id => tr_id},
:method => :get, :method => :get,
@ -19,9 +20,11 @@
</td> </td>
<td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td> <td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
<% changeset = @project.repository.find_changeset_by_name(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %> <% changeset = @project.repository.find_changeset_by_name(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
<% if @repository.report_last_commit %>
<td class="revision"><%= link_to_revision(changeset, @project) if changeset %></td> <td class="revision"><%= link_to_revision(changeset, @project) if changeset %></td>
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td> <td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
<td class="author"><%= changeset.nil? ? h(Redmine::CodesetUtil.replace_invalid_utf8(entry.lastrev.author.to_s.split('<').first)) : changeset.author if entry.lastrev %></td> <td class="author"><%= changeset.nil? ? h(Redmine::CodesetUtil.replace_invalid_utf8(entry.lastrev.author.to_s.split('<').first)) : changeset.author if entry.lastrev %></td>
<td class="comments"><%=h truncate(changeset.comments, :length => 50) unless changeset.nil? %></td> <td class="comments"><%=h truncate(changeset.comments, :length => 50) unless changeset.nil? %></td>
<% end %>
</tr> </tr>
<% end %> <% end %>

View File

@ -145,10 +145,12 @@ tr.issue.idnt-9 td.subject {padding-left: 12.5em;}
tr.entry { border: 1px solid #f8f8f8; } tr.entry { border: 1px solid #f8f8f8; }
tr.entry td { white-space: nowrap; } tr.entry td { white-space: nowrap; }
tr.entry td.filename { width: 30%; } tr.entry td.filename { width: 30%; }
tr.entry td.filename_no_report { width: 70%; }
tr.entry td.size { text-align: right; font-size: 90%; } tr.entry td.size { text-align: right; font-size: 90%; }
tr.entry td.revision, tr.entry td.author { text-align: center; } tr.entry td.revision, tr.entry td.author { text-align: center; }
tr.entry td.age { text-align: right; } tr.entry td.age { text-align: right; }
tr.entry.file td.filename a { margin-left: 16px; } tr.entry.file td.filename a { margin-left: 16px; }
tr.entry.file td.filename_no_report a { margin-left: 16px; }
tr span.expander {background-image: url(../images/bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;} tr span.expander {background-image: url(../images/bullet_toggle_plus.png); padding-left: 8px; margin-left: 0; cursor: pointer;}
tr.open span.expander {background-image: url(../images/bullet_toggle_minus.png);} tr.open span.expander {background-image: url(../images/bullet_toggle_minus.png);}