@@ -1,4 +1,4 | |||||
1 | <table class="list"> |
|
1 | <table class="list" id="browser"> | |
2 | <thead> |
|
2 | <thead> | |
3 | <tr id="root"> |
|
3 | <tr id="root"> | |
4 | <th><%= l(:field_name) %></th> |
|
4 | <th><%= l(:field_name) %></th> |
@@ -1,15 +1,15 | |||||
1 | <% @entries.each do |entry| %> |
|
1 | <% @entries.each do |entry| %> | |
2 | <% tr_id = Digest::MD5.hexdigest(entry.path) |
|
2 | <% tr_id = Digest::MD5.hexdigest(entry.path) | |
3 | depth = params[:depth].to_i %> |
|
3 | depth = params[:depth].to_i %> | |
4 | <tr id="<%= tr_id %>"> |
|
4 | <tr id="<%= tr_id %>" class="<%= params[:parent_id] %>"> | |
5 | <td> |
|
5 | <td> | |
6 | <%= if entry.is_dir? |
|
6 | <%= if entry.is_dir? | |
7 | link_to_remote h(entry.name), |
|
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 | :update => tr_id, |
|
9 | :update => tr_id, | |
10 | :position => :after, |
|
10 | :position => :after, | |
11 |
:success => " |
|
11 | :success => "scmEntryLoaded('#{tr_id}')", | |
12 |
:condition => " |
|
12 | :condition => "scmEntryClick('#{tr_id}')" | |
13 | }, |
|
13 | }, | |
14 | {:href => url_for({:action => 'browse', :id => @project, :path => entry.path, :rev => @rev}), |
|
14 | {:href => url_for({:action => 'browse', :id => @project, :path => entry.path, :rev => @rev}), | |
15 | :class => ('icon icon-folder'), |
|
15 | :class => ('icon icon-folder'), |
@@ -59,6 +59,40 function checkBulkEdit(form) { | |||||
59 | return false; |
|
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 | /* shows and hides ajax indicator */ |
|
96 | /* shows and hides ajax indicator */ | |
63 | Ajax.Responders.register({ |
|
97 | Ajax.Responders.register({ | |
64 | onCreate: function(){ |
|
98 | onCreate: function(){ |
General Comments 0
You need to be logged in to leave comments.
Login now