Mercurial > kallithea
comparison rhodecode/templates/files/files_browser.html @ 2031:82a88013a3fd
merge 1.3 into stable
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 26 Feb 2012 17:25:09 +0200 |
parents | 752b0a7b7679 f91d3f9b7230 |
children | ecd59c28f432 |
comparison
equal
deleted
inserted
replaced
2005:ab0e122b38a7 | 2031:82a88013a3fd |
---|---|
8 <div id="body" class="browserblock"> | 8 <div id="body" class="browserblock"> |
9 <div class="browser-header"> | 9 <div class="browser-header"> |
10 <div class="browser-nav"> | 10 <div class="browser-nav"> |
11 ${h.form(h.url.current())} | 11 ${h.form(h.url.current())} |
12 <div class="info_box"> | 12 <div class="info_box"> |
13 <span class="rev">${_('view')}@rev</span> | 13 <span class="rev">${_('view')}@rev</span> |
14 <a class="ui-button-small" href="${c.url_prev}" title="${_('previous revision')}">«</a> | 14 <a class="ui-btn" href="${c.url_prev}" title="${_('previous revision')}">«</a> |
15 ${h.text('at_rev',value=c.changeset.revision,size=5)} | 15 ${h.text('at_rev',value=c.changeset.revision,size=5)} |
16 <a class="ui-button-small" href="${c.url_next}" title="${_('next revision')}">»</a> | 16 <a class="ui-btn" href="${c.url_next}" title="${_('next revision')}">»</a> |
17 ## ${h.submit('view',_('view'),class_="ui-button-small")} | 17 ## ${h.submit('view',_('view'),class_="ui-btn")} |
18 </div> | 18 </div> |
19 ${h.end_form()} | 19 ${h.end_form()} |
20 </div> | 20 </div> |
21 <div class="browser-branch"> | 21 <div class="browser-branch"> |
22 ${h.checkbox('stay_at_branch',c.changeset.branch,c.changeset.branch==c.branch)} | 22 ${h.checkbox('stay_at_branch',c.changeset.branch,c.changeset.branch==c.branch)} |
23 <label>${_('follow current branch')}</label> | 23 <label>${_('follow current branch')}</label> |
24 </div> | 24 </div> |
25 <div class="browser-search"> | 25 <div class="browser-search"> |
26 <div id="search_activate_id" class="search_activate"> | 26 <div id="search_activate_id" class="search_activate"> |
27 <a class="ui-button-small" id="filter_activate" href="#">${_('search file list')}</a> | 27 <a class="ui-btn" id="filter_activate" href="#">${_('search file list')}</a> |
28 </div> | 28 </div> |
29 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): | 29 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): |
30 <div id="add_node_id" class="add_node"> | 30 <div id="add_node_id" class="add_node"> |
31 <a class="ui-button-small" href="${h.url('files_add_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path)}">${_('add new file')}</a> | 31 <a class="ui-btn" href="${h.url('files_add_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path)}">${_('add new file')}</a> |
32 </div> | 32 </div> |
33 % endif | 33 % endif |
34 <div> | 34 <div> |
35 <div id="node_filter_box_loading" style="display:none">${_('Loading file list...')}</div> | 35 <div id="node_filter_box_loading" style="display:none">${_('Loading file list...')}</div> |
36 <div id="node_filter_box" style="display:none"> | 36 <div id="node_filter_box" style="display:none"> |
37 ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)}/<input type="text" value="type to search..." name="filter" size="25" id="node_filter" autocomplete="off"> | 37 ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.file.path)}/<input class="init" type="text" value="type to search..." name="filter" size="25" id="node_filter" autocomplete="off"> |
38 | 38 </div> |
39 <script type="text/javascript"> | 39 </div> |
40 | 40 </div> |
41 YUE.on('stay_at_branch','click',function(e){ | 41 </div> |
42 if(e.target.checked){ | |
43 var uri = "${h.url.current(branch='__BRANCH__')}" | |
44 uri = uri.replace('__BRANCH__',e.target.value); | |
45 window.location = uri; | |
46 } | |
47 else{ | |
48 window.location = "${h.url.current()}"; | |
49 } | |
50 | |
51 }) | |
52 | |
53 var n_filter = YUD.get('node_filter'); | |
54 var F = YAHOO.namespace('node_filter'); | |
55 | |
56 var url = '${h.url("files_nodelist_home",repo_name="__REPO__",revision="__REVISION__",f_path="__FPATH__")}'; | |
57 var node_url = '${h.url("files_home",repo_name="__REPO__",revision="__REVISION__",f_path="__FPATH__")}'; | |
58 | |
59 url = url.replace('__REPO__','${c.repo_name}'); | |
60 url = url.replace('__REVISION__','${c.changeset.raw_id}'); | |
61 url = url.replace('__FPATH__','${c.files_list.path}'); | |
62 | 42 |
63 node_url = node_url.replace('__REPO__','${c.repo_name}'); | |
64 node_url = node_url.replace('__REVISION__','${c.changeset.raw_id}'); | |
65 | |
66 | |
67 F.filterTimeout = null; | |
68 var nodes = null; | |
69 | |
70 | |
71 F.initFilter = function(){ | |
72 YUD.setStyle('node_filter_box_loading','display',''); | |
73 YUD.setStyle('search_activate_id','display','none'); | |
74 YUD.setStyle('add_node_id','display','none'); | |
75 YUC.initHeader('X-PARTIAL-XHR',true); | |
76 YUC.asyncRequest('GET',url,{ | |
77 success:function(o){ | |
78 nodes = JSON.parse(o.responseText); | |
79 YUD.setStyle('node_filter_box_loading','display','none'); | |
80 YUD.setStyle('node_filter_box','display',''); | |
81 }, | |
82 failure:function(o){ | |
83 console.log('failed to load'); | |
84 } | |
85 },null); | |
86 } | |
87 | |
88 F.updateFilter = function(e) { | |
89 | |
90 return function(){ | |
91 // Reset timeout | |
92 F.filterTimeout = null; | |
93 var query = e.target.value; | |
94 var match = []; | |
95 var matches = 0; | |
96 var matches_max = 20; | |
97 if (query != ""){ | |
98 for(var i=0;i<nodes.length;i++){ | |
99 var pos = nodes[i].toLowerCase().indexOf(query) | |
100 if(query && pos != -1){ | |
101 | |
102 matches++ | |
103 //show only certain amount to not kill browser | |
104 if (matches > matches_max){ | |
105 break; | |
106 } | |
107 | |
108 var n = nodes[i]; | |
109 var n_hl = n.substring(0,pos) | |
110 +"<b>{0}</b>".format(n.substring(pos,pos+query.length)) | |
111 +n.substring(pos+query.length) | |
112 match.push('<tr><td><a class="browser-file" href="{0}">{1}</a></td><td colspan="5"></td></tr>'.format(node_url.replace('__FPATH__',n),n_hl)); | |
113 } | |
114 if(match.length >= matches_max){ | |
115 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format("${_('search truncated')}")); | |
116 } | |
117 | |
118 } | |
119 } | |
120 | |
121 if(query != ""){ | |
122 YUD.setStyle('tbody','display','none'); | |
123 YUD.setStyle('tbody_filtered','display',''); | |
124 | |
125 if (match.length==0){ | |
126 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format("${_('no matching files')}")); | |
127 } | |
128 | |
129 YUD.get('tbody_filtered').innerHTML = match.join(""); | |
130 } | |
131 else{ | |
132 YUD.setStyle('tbody','display',''); | |
133 YUD.setStyle('tbody_filtered','display','none'); | |
134 } | |
135 | |
136 } | |
137 } | |
138 | |
139 | |
140 YUE.on(YUD.get('filter_activate'),'click',function(){ | |
141 F.initFilter(); | |
142 }) | |
143 YUE.on(n_filter,'click',function(){ | |
144 n_filter.value = ''; | |
145 }); | |
146 YUE.on(n_filter,'keyup',function(e){ | |
147 clearTimeout(F.filterTimeout); | |
148 F.filterTimeout = setTimeout(F.updateFilter(e),600); | |
149 }); | |
150 </script> | |
151 | |
152 </div> | |
153 </div> | |
154 </div> | |
155 </div> | |
156 | |
157 <div class="browser-body"> | 43 <div class="browser-body"> |
158 <table class="code-browser"> | 44 <table class="code-browser"> |
159 <thead> | 45 <thead> |
160 <tr> | 46 <tr> |
161 <th>${_('Name')}</th> | 47 <th>${_('Name')}</th> |
164 <th>${_('Revision')}</th> | 50 <th>${_('Revision')}</th> |
165 <th>${_('Last modified')}</th> | 51 <th>${_('Last modified')}</th> |
166 <th>${_('Last commiter')}</th> | 52 <th>${_('Last commiter')}</th> |
167 </tr> | 53 </tr> |
168 </thead> | 54 </thead> |
169 | 55 |
170 <tbody id="tbody"> | 56 <tbody id="tbody"> |
171 %if c.files_list.parent: | 57 %if c.file.parent: |
172 <tr class="parity0"> | 58 <tr class="parity0"> |
173 <td> | 59 <td> |
174 ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.files_list.parent.path),class_="browser-dir")} | 60 ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.file.parent.path),class_="browser-dir ypjax-link")} |
175 </td> | 61 </td> |
176 <td></td> | 62 <td></td> |
177 <td></td> | 63 <td></td> |
178 <td></td> | 64 <td></td> |
179 <td></td> | 65 <td></td> |
180 <td></td> | 66 <td></td> |
181 </tr> | 67 </tr> |
182 %endif | 68 %endif |
183 | 69 |
184 %for cnt,node in enumerate(c.files_list): | 70 %for cnt,node in enumerate(c.file): |
185 <tr class="parity${cnt%2}"> | 71 <tr class="parity${cnt%2}"> |
186 <td> | 72 <td> |
187 ${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=h.safe_unicode(node.path)),class_=file_class(node))} | 73 ${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=h.safe_unicode(node.path)),class_=file_class(node)+" ypjax-link")} |
188 </td> | 74 </td> |
189 <td> | 75 <td> |
190 %if node.is_file(): | 76 %if node.is_file(): |
191 ${h.format_byte_size(node.size,binary=True)} | 77 ${h.format_byte_size(node.size,binary=True)} |
192 %endif | 78 %endif |
193 </td> | 79 </td> |
194 <td> | 80 <td> |
195 %if node.is_file(): | 81 %if node.is_file(): |
196 ${node.mimetype} | 82 ${node.mimetype} |
197 %endif | 83 %endif |
198 </td> | 84 </td> |
199 <td> | 85 <td> |
200 %if node.is_file(): | 86 %if node.is_file(): |
201 <span class="tooltip" title="${node.last_changeset.raw_id}"> | 87 <div class="tooltip" title="${node.last_changeset.message}"> |
202 ${'r%s:%s' % (node.last_changeset.revision,node.last_changeset.short_id)}</span> | 88 <pre>${'r%s:%s' % (node.last_changeset.revision,node.last_changeset.short_id)}</pre> |
89 </div> | |
203 %endif | 90 %endif |
204 </td> | 91 </td> |
205 <td> | 92 <td> |
206 %if node.is_file(): | 93 %if node.is_file(): |
207 <span class="tooltip" title="${node.last_changeset.date}"> | 94 <span class="tooltip" title="${node.last_changeset.date}"> |
208 ${h.age(node.last_changeset.date)}</span> | 95 ${h.age(node.last_changeset.date)}</span> |
209 %endif | 96 %endif |
210 </td> | 97 </td> |
211 <td> | 98 <td> |
212 %if node.is_file(): | 99 %if node.is_file(): |
213 ${node.last_changeset.author} | 100 <span title="${node.last_changeset.author}"> |
214 %endif | 101 ${h.person(node.last_changeset.author)} |
102 </span> | |
103 %endif | |
215 </td> | 104 </td> |
216 </tr> | 105 </tr> |
217 %endfor | 106 %endfor |
218 </tbody> | 107 </tbody> |
219 <tbody id="tbody_filtered" style="display:none"> | 108 <tbody id="tbody_filtered" style="display:none"> |
220 </tbody> | 109 </tbody> |
221 </table> | 110 </table> |
222 </div> | 111 </div> |
223 </div> | 112 </div> |