##// END OF EJS Templates
Added a bit of AJAX on the SCM browser (tree view)....
Jean-Philippe Lang -
r849:8ca4d35dcc46
parent child
Show More
@@ -0,0 +1,32
1 <% @entries.each do |entry| %>
2 <% tr_id = Digest::MD5.hexdigest(entry.path)
3 depth = params[:depth].to_i %>
4 <tr id="<%= tr_id %>">
5 <td>
6 <%= if entry.is_dir?
7 link_to_remote h(entry.name),
8 {:url => {:action => 'browse', :id => @project, :path => entry.path, :rev => @rev, :depth => (depth + 1)},
9 :update => tr_id,
10 :position => :after,
11 :success => "Element.addClassName('#{tr_id}', 'open');",
12 :condition => "!Element.hasClassName('#{tr_id}', 'open')"
13 },
14 {:href => url_for({:action => 'browse', :id => @project, :path => entry.path, :rev => @rev}),
15 :class => ('icon icon-folder'),
16 :style => "margin-left: #{18 * depth}px;"
17 }
18 else
19 link_to h(entry.name),
20 {:action => (entry.is_dir? ? 'browse' : 'changes'), :id => @project, :path => entry.path, :rev => @rev},
21 :class => 'icon icon-file',
22 :style => "margin-left: #{18 * depth}px;"
23 end %>
24 </td>
25 <td align="right"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
26 <td align="right"><%= link_to(entry.lastrev.name, :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %></td>
27 <td align="center"><%= format_time(entry.lastrev.time) if entry.lastrev %></td>
28 <td align="center"><em><%=h(entry.lastrev.author) if entry.lastrev %></em></td>
29 <% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev %>
30 <td><%=h truncate(changeset.comments, 50) unless changeset.nil? %></td>
31 </tr>
32 <% end %>
1 NO CONTENT: new file 100644, binary diff hidden
@@ -56,7 +56,11 class RepositoriesController < ApplicationController
56 56
57 57 def browse
58 58 @entries = @repository.entries(@path, @rev)
59 show_error and return unless @entries
59 if request.xhr?
60 @entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
61 else
62 show_error unless @entries
63 end
60 64 end
61 65
62 66 def changes
@@ -1,26 +1,15
1 1 <table class="list">
2 <thead><tr>
2 <thead>
3 <tr id="root">
3 4 <th><%= l(:field_name) %></th>
4 5 <th><%= l(:field_filesize) %></th>
5 6 <th><%= l(:label_revision) %></th>
6 7 <th><%= l(:label_date) %></th>
7 8 <th><%= l(:field_author) %></th>
8 9 <th><%= l(:field_comments) %></th>
9 </tr></thead>
10 <tbody>
11 <% total_size = 0
12 @entries.each do |entry| %>
13 <tr class="<%= cycle 'odd', 'even' %>">
14 <td><%= link_to h(entry.name), { :action => (entry.is_dir? ? 'browse' : 'changes'), :id => @project, :path => entry.path, :rev => @rev }, :class => ("icon " + (entry.is_dir? ? 'icon-folder' : 'icon-file')) %></td>
15 <td align="right"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
16 <td align="right"><%= link_to(entry.lastrev.name, :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %></td>
17 <td align="center"><%= format_time(entry.lastrev.time) if entry.lastrev %></td>
18 <td align="center"><em><%=h(entry.lastrev.author) if entry.lastrev %></em></td>
19 <% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev %>
20 <td><%=h truncate(changeset.comments, 100) unless changeset.nil? %></td>
21 10 </tr>
22 <% total_size += entry.size if entry.size
23 end %>
11 </thead>
12 <tbody>
13 <%= render :partial => 'dir_list_content' %>
24 14 </tbody>
25 15 </table>
26 <p class="textright"><em><%= l(:label_total) %>: <%= number_to_human_size(total_size) %></em></p> No newline at end of file
1 NO CONTENT: modified file, binary diff hidden
@@ -1629,7 +1629,7 Abstract.Insertion.prototype = {
1629 1629 } catch (e) {
1630 1630 var tagName = this.element.tagName.toUpperCase();
1631 1631 if (['TBODY', 'TR'].include(tagName)) {
1632 this.insertContent(this.contentFromAnonymousTable());
1632 this.insertContent(this.contentFromAnonymousTable()._reverse());
1633 1633 } else {
1634 1634 throw e;
1635 1635 }
@@ -432,6 +432,7 vertical-align: middle;
432 432 .icon-txt { background-image: url(../images/txt.png); }
433 433 .icon-file { background-image: url(../images/file.png); }
434 434 .icon-folder { background-image: url(../images/folder.png); }
435 .open .icon-folder { background-image: url(../images/folder_open.png); }
435 436 .icon-package { background-image: url(../images/package.png); }
436 437 .icon-home { background-image: url(../images/home.png); }
437 438 .icon-user { background-image: url(../images/user.png); }
General Comments 0
You need to be logged in to leave comments. Login now