@@ -1,4 +1,4 | |||
|
1 | <table class="list"> | |
|
1 | <table class="list" id="browser"> | |
|
2 | 2 | <thead> |
|
3 | 3 | <tr id="root"> |
|
4 | 4 | <th><%= l(:field_name) %></th> |
@@ -1,15 +1,15 | |||
|
1 | 1 | <% @entries.each do |entry| %> |
|
2 | 2 | <% tr_id = Digest::MD5.hexdigest(entry.path) |
|
3 | 3 | depth = params[:depth].to_i %> |
|
4 | <tr id="<%= tr_id %>"> | |
|
4 | <tr id="<%= tr_id %>" class="<%= params[:parent_id] %>"> | |
|
5 | 5 | <td> |
|
6 | 6 | <%= if entry.is_dir? |
|
7 | 7 | link_to_remote h(entry.name), |
|
8 | {:url => {:action => 'browse', :id => @project, :path => entry.path, :rev => @rev, :depth => (depth + 1)}, | |
|
8 | {:url => {:action => 'browse', :id => @project, :path => entry.path, :rev => @rev, :depth => (depth + 1), :parent_id => tr_id}, | |
|
9 | 9 | :update => tr_id, |
|
10 | 10 | :position => :after, |
|
11 |
:success => " |
|
|
12 |
:condition => " |
|
|
11 | :success => "scmEntryLoaded('#{tr_id}')", | |
|
12 | :condition => "scmEntryClick('#{tr_id}')" | |
|
13 | 13 | }, |
|
14 | 14 | {:href => url_for({:action => 'browse', :id => @project, :path => entry.path, :rev => @rev}), |
|
15 | 15 | :class => ('icon icon-folder'), |
@@ -59,6 +59,40 function checkBulkEdit(form) { | |||
|
59 | 59 | return false; |
|
60 | 60 | } |
|
61 | 61 | |
|
62 | function collapseScmEntry(id) { | |
|
63 | var els = document.getElementsByClassName(id, 'browser'); | |
|
64 | for (var i = 0; i < els.length; i++) { | |
|
65 | collapseScmEntry(els[i].id); | |
|
66 | Element.hide(els[i]); | |
|
67 | } | |
|
68 | $(id).removeClassName('open'); | |
|
69 | } | |
|
70 | ||
|
71 | function expandScmEntry(id) { | |
|
72 | var els = document.getElementsByClassName(id, 'browser'); | |
|
73 | for (var i = 0; i < els.length; i++) { | |
|
74 | Element.show(els[i]); | |
|
75 | } | |
|
76 | $(id).addClassName('open'); | |
|
77 | } | |
|
78 | ||
|
79 | function scmEntryClick(id) { | |
|
80 | el = $(id); | |
|
81 | if (el.hasClassName('open')) { | |
|
82 | collapseScmEntry(id); | |
|
83 | return false; | |
|
84 | } else if (el.hasClassName('loaded')) { | |
|
85 | expandScmEntry(id); | |
|
86 | return false; | |
|
87 | } | |
|
88 | return true; | |
|
89 | } | |
|
90 | ||
|
91 | function scmEntryLoaded(id) { | |
|
92 | Element.addClassName(id, 'open'); | |
|
93 | Element.addClassName(id, 'loaded'); | |
|
94 | } | |
|
95 | ||
|
62 | 96 | /* shows and hides ajax indicator */ |
|
63 | 97 | Ajax.Responders.register({ |
|
64 | 98 | onCreate: function(){ |
General Comments 0
You need to be logged in to leave comments.
Login now