##// END OF EJS Templates
added sorting to bookmarks tags and branches
marcink -
r1782:eaf09acf beta
parent child Browse files
Show More
@@ -1,695 +1,713
1 /**
1 /**
2 RhodeCode JS Files
2 RhodeCode JS Files
3 **/
3 **/
4
4
5 if (typeof console == "undefined" || typeof console.log == "undefined"){
5 if (typeof console == "undefined" || typeof console.log == "undefined"){
6 console = { log: function() {} }
6 console = { log: function() {} }
7 }
7 }
8
8
9
9
10 var str_repeat = function(i, m) {
10 var str_repeat = function(i, m) {
11 for (var o = []; m > 0; o[--m] = i);
11 for (var o = []; m > 0; o[--m] = i);
12 return o.join('');
12 return o.join('');
13 };
13 };
14
14
15 /**
15 /**
16 * INJECT .format function into String
16 * INJECT .format function into String
17 * Usage: "My name is {0} {1}".format("Johny","Bravo")
17 * Usage: "My name is {0} {1}".format("Johny","Bravo")
18 * Return "My name is Johny Bravo"
18 * Return "My name is Johny Bravo"
19 * Inspired by https://gist.github.com/1049426
19 * Inspired by https://gist.github.com/1049426
20 */
20 */
21 String.prototype.format = function() {
21 String.prototype.format = function() {
22
22
23 function format() {
23 function format() {
24 var str = this;
24 var str = this;
25 var len = arguments.length+1;
25 var len = arguments.length+1;
26 var safe = undefined;
26 var safe = undefined;
27 var arg = undefined;
27 var arg = undefined;
28
28
29 // For each {0} {1} {n...} replace with the argument in that position. If
29 // For each {0} {1} {n...} replace with the argument in that position. If
30 // the argument is an object or an array it will be stringified to JSON.
30 // the argument is an object or an array it will be stringified to JSON.
31 for (var i=0; i < len; arg = arguments[i++]) {
31 for (var i=0; i < len; arg = arguments[i++]) {
32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg;
32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg;
33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe);
33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe);
34 }
34 }
35 return str;
35 return str;
36 }
36 }
37
37
38 // Save a reference of what may already exist under the property native.
38 // Save a reference of what may already exist under the property native.
39 // Allows for doing something like: if("".format.native) { /* use native */ }
39 // Allows for doing something like: if("".format.native) { /* use native */ }
40 format.native = String.prototype.format;
40 format.native = String.prototype.format;
41
41
42 // Replace the prototype property
42 // Replace the prototype property
43 return format;
43 return format;
44
44
45 }();
45 }();
46
46
47
47
48 /**
48 /**
49 * SmartColorGenerator
49 * SmartColorGenerator
50 *
50 *
51 *usage::
51 *usage::
52 * var CG = new ColorGenerator();
52 * var CG = new ColorGenerator();
53 * var col = CG.getColor(key); //returns array of RGB
53 * var col = CG.getColor(key); //returns array of RGB
54 * 'rgb({0})'.format(col.join(',')
54 * 'rgb({0})'.format(col.join(',')
55 *
55 *
56 * @returns {ColorGenerator}
56 * @returns {ColorGenerator}
57 */
57 */
58 var ColorGenerator = function(){
58 var ColorGenerator = function(){
59 this.GOLDEN_RATIO = 0.618033988749895;
59 this.GOLDEN_RATIO = 0.618033988749895;
60 this.CURRENT_RATIO = 0.22717784590367374 // this can be random
60 this.CURRENT_RATIO = 0.22717784590367374 // this can be random
61 this.HSV_1 = 0.75;//saturation
61 this.HSV_1 = 0.75;//saturation
62 this.HSV_2 = 0.95;
62 this.HSV_2 = 0.95;
63 this.color;
63 this.color;
64 this.cacheColorMap = {};
64 this.cacheColorMap = {};
65 };
65 };
66
66
67 ColorGenerator.prototype = {
67 ColorGenerator.prototype = {
68 getColor:function(key){
68 getColor:function(key){
69 if(this.cacheColorMap[key] !== undefined){
69 if(this.cacheColorMap[key] !== undefined){
70 return this.cacheColorMap[key];
70 return this.cacheColorMap[key];
71 }
71 }
72 else{
72 else{
73 this.cacheColorMap[key] = this.generateColor();
73 this.cacheColorMap[key] = this.generateColor();
74 return this.cacheColorMap[key];
74 return this.cacheColorMap[key];
75 }
75 }
76 },
76 },
77 _hsvToRgb:function(h,s,v){
77 _hsvToRgb:function(h,s,v){
78 if (s == 0.0)
78 if (s == 0.0)
79 return [v, v, v];
79 return [v, v, v];
80 i = parseInt(h * 6.0)
80 i = parseInt(h * 6.0)
81 f = (h * 6.0) - i
81 f = (h * 6.0) - i
82 p = v * (1.0 - s)
82 p = v * (1.0 - s)
83 q = v * (1.0 - s * f)
83 q = v * (1.0 - s * f)
84 t = v * (1.0 - s * (1.0 - f))
84 t = v * (1.0 - s * (1.0 - f))
85 i = i % 6
85 i = i % 6
86 if (i == 0)
86 if (i == 0)
87 return [v, t, p]
87 return [v, t, p]
88 if (i == 1)
88 if (i == 1)
89 return [q, v, p]
89 return [q, v, p]
90 if (i == 2)
90 if (i == 2)
91 return [p, v, t]
91 return [p, v, t]
92 if (i == 3)
92 if (i == 3)
93 return [p, q, v]
93 return [p, q, v]
94 if (i == 4)
94 if (i == 4)
95 return [t, p, v]
95 return [t, p, v]
96 if (i == 5)
96 if (i == 5)
97 return [v, p, q]
97 return [v, p, q]
98 },
98 },
99 generateColor:function(){
99 generateColor:function(){
100 this.CURRENT_RATIO = this.CURRENT_RATIO+this.GOLDEN_RATIO;
100 this.CURRENT_RATIO = this.CURRENT_RATIO+this.GOLDEN_RATIO;
101 this.CURRENT_RATIO = this.CURRENT_RATIO %= 1;
101 this.CURRENT_RATIO = this.CURRENT_RATIO %= 1;
102 HSV_tuple = [this.CURRENT_RATIO, this.HSV_1, this.HSV_2]
102 HSV_tuple = [this.CURRENT_RATIO, this.HSV_1, this.HSV_2]
103 RGB_tuple = this._hsvToRgb(HSV_tuple[0],HSV_tuple[1],HSV_tuple[2]);
103 RGB_tuple = this._hsvToRgb(HSV_tuple[0],HSV_tuple[1],HSV_tuple[2]);
104 function toRgb(v){
104 function toRgb(v){
105 return ""+parseInt(v*256)
105 return ""+parseInt(v*256)
106 }
106 }
107 return [toRgb(RGB_tuple[0]),toRgb(RGB_tuple[1]),toRgb(RGB_tuple[2])];
107 return [toRgb(RGB_tuple[0]),toRgb(RGB_tuple[1]),toRgb(RGB_tuple[2])];
108
108
109 }
109 }
110 }
110 }
111
111
112
112
113
113
114
114
115
115
116 /**
116 /**
117 * GLOBAL YUI Shortcuts
117 * GLOBAL YUI Shortcuts
118 */
118 */
119 var YUC = YAHOO.util.Connect;
119 var YUC = YAHOO.util.Connect;
120 var YUD = YAHOO.util.Dom;
120 var YUD = YAHOO.util.Dom;
121 var YUE = YAHOO.util.Event;
121 var YUE = YAHOO.util.Event;
122 var YUQ = YAHOO.util.Selector.query;
122 var YUQ = YAHOO.util.Selector.query;
123
123
124 // defines if push state is enabled for this browser ?
124 // defines if push state is enabled for this browser ?
125 var push_state_enabled = Boolean(
125 var push_state_enabled = Boolean(
126 window.history && window.history.pushState && window.history.replaceState
126 window.history && window.history.pushState && window.history.replaceState
127 && !( /* disable for versions of iOS before version 4.3 (8F190) */
127 && !( /* disable for versions of iOS before version 4.3 (8F190) */
128 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
128 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
129 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
129 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
130 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
130 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
131 )
131 )
132 );
132 );
133
133
134 var _run_callbacks = function(callbacks){
134 var _run_callbacks = function(callbacks){
135 if (callbacks !== undefined){
135 if (callbacks !== undefined){
136 var _l = callbacks.length;
136 var _l = callbacks.length;
137 for (var i=0;i<_l;i++){
137 for (var i=0;i<_l;i++){
138 var func = callbacks[i];
138 var func = callbacks[i];
139 if(typeof(func)=='function'){
139 if(typeof(func)=='function'){
140 try{
140 try{
141 func();
141 func();
142 }catch (err){};
142 }catch (err){};
143 }
143 }
144 }
144 }
145 }
145 }
146 }
146 }
147
147
148 /**
148 /**
149 * Partial Ajax Implementation
149 * Partial Ajax Implementation
150 *
150 *
151 * @param url: defines url to make partial request
151 * @param url: defines url to make partial request
152 * @param container: defines id of container to input partial result
152 * @param container: defines id of container to input partial result
153 * @param s_call: success callback function that takes o as arg
153 * @param s_call: success callback function that takes o as arg
154 * o.tId
154 * o.tId
155 * o.status
155 * o.status
156 * o.statusText
156 * o.statusText
157 * o.getResponseHeader[ ]
157 * o.getResponseHeader[ ]
158 * o.getAllResponseHeaders
158 * o.getAllResponseHeaders
159 * o.responseText
159 * o.responseText
160 * o.responseXML
160 * o.responseXML
161 * o.argument
161 * o.argument
162 * @param f_call: failure callback
162 * @param f_call: failure callback
163 * @param args arguments
163 * @param args arguments
164 */
164 */
165 function ypjax(url,container,s_call,f_call,args){
165 function ypjax(url,container,s_call,f_call,args){
166 var method='GET';
166 var method='GET';
167 if(args===undefined){
167 if(args===undefined){
168 args=null;
168 args=null;
169 }
169 }
170
170
171 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR
171 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR
172 YUC.initHeader('X-PARTIAL-XHR',true);
172 YUC.initHeader('X-PARTIAL-XHR',true);
173
173
174 // wrapper of passed callback
174 // wrapper of passed callback
175 var s_wrapper = (function(o){
175 var s_wrapper = (function(o){
176 return function(o){
176 return function(o){
177 YUD.get(container).innerHTML=o.responseText;
177 YUD.get(container).innerHTML=o.responseText;
178 YUD.setStyle(container,'opacity','1.0');
178 YUD.setStyle(container,'opacity','1.0');
179 //execute the given original callback
179 //execute the given original callback
180 if (s_call !== undefined){
180 if (s_call !== undefined){
181 s_call(o);
181 s_call(o);
182 }
182 }
183 }
183 }
184 })()
184 })()
185 YUD.setStyle(container,'opacity','0.3');
185 YUD.setStyle(container,'opacity','0.3');
186 YUC.asyncRequest(method,url,{
186 YUC.asyncRequest(method,url,{
187 success:s_wrapper,
187 success:s_wrapper,
188 failure:function(o){
188 failure:function(o){
189 console.log(o);
189 console.log(o);
190 YUD.get(container).innerHTML='ERROR';
190 YUD.get(container).innerHTML='ERROR';
191 YUD.setStyle(container,'opacity','1.0');
191 YUD.setStyle(container,'opacity','1.0');
192 YUD.setStyle(container,'color','red');
192 YUD.setStyle(container,'color','red');
193 }
193 }
194 },args);
194 },args);
195
195
196 };
196 };
197
197
198 /**
198 /**
199 * tooltip activate
199 * tooltip activate
200 */
200 */
201 var tooltip_activate = function(){
201 var tooltip_activate = function(){
202 function toolTipsId(){
202 function toolTipsId(){
203 var ids = [];
203 var ids = [];
204 var tts = YUQ('.tooltip');
204 var tts = YUQ('.tooltip');
205 for (var i = 0; i < tts.length; i++) {
205 for (var i = 0; i < tts.length; i++) {
206 // if element doesn't not have and id
206 // if element doesn't not have and id
207 // autogenerate one for tooltip
207 // autogenerate one for tooltip
208 if (!tts[i].id){
208 if (!tts[i].id){
209 tts[i].id='tt'+((i*100)+tts.length);
209 tts[i].id='tt'+((i*100)+tts.length);
210 }
210 }
211 ids.push(tts[i].id);
211 ids.push(tts[i].id);
212 }
212 }
213 return ids
213 return ids
214 };
214 };
215 var myToolTips = new YAHOO.widget.Tooltip("tooltip", {
215 var myToolTips = new YAHOO.widget.Tooltip("tooltip", {
216 context: [[toolTipsId()],"tl","bl",null,[0,5]],
216 context: [[toolTipsId()],"tl","bl",null,[0,5]],
217 monitorresize:false,
217 monitorresize:false,
218 xyoffset :[0,0],
218 xyoffset :[0,0],
219 autodismissdelay:300000,
219 autodismissdelay:300000,
220 hidedelay:5,
220 hidedelay:5,
221 showdelay:20,
221 showdelay:20,
222 });
222 });
223 };
223 };
224
224
225 /**
225 /**
226 * show more
226 * show more
227 */
227 */
228 var show_more_event = function(){
228 var show_more_event = function(){
229 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
229 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
230 var el = e.target;
230 var el = e.target;
231 YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
231 YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
232 YUD.setStyle(el.parentNode,'display','none');
232 YUD.setStyle(el.parentNode,'display','none');
233 });
233 });
234 };
234 };
235
235
236
236
237 /**
237 /**
238 * Quick filter widget
238 * Quick filter widget
239 *
239 *
240 * @param target: filter input target
240 * @param target: filter input target
241 * @param nodes: list of nodes in html we want to filter.
241 * @param nodes: list of nodes in html we want to filter.
242 * @param display_element function that takes current node from nodes and
242 * @param display_element function that takes current node from nodes and
243 * does hide or show based on the node
243 * does hide or show based on the node
244 *
244 *
245 */
245 */
246 var q_filter = function(target,nodes,display_element){
246 var q_filter = function(target,nodes,display_element){
247
247
248 var nodes = nodes;
248 var nodes = nodes;
249 var q_filter_field = YUD.get(target);
249 var q_filter_field = YUD.get(target);
250 var F = YAHOO.namespace(target);
250 var F = YAHOO.namespace(target);
251
251
252 YUE.on(q_filter_field,'click',function(){
252 YUE.on(q_filter_field,'click',function(){
253 q_filter_field.value = '';
253 q_filter_field.value = '';
254 });
254 });
255
255
256 YUE.on(q_filter_field,'keyup',function(e){
256 YUE.on(q_filter_field,'keyup',function(e){
257 clearTimeout(F.filterTimeout);
257 clearTimeout(F.filterTimeout);
258 F.filterTimeout = setTimeout(F.updateFilter,600);
258 F.filterTimeout = setTimeout(F.updateFilter,600);
259 });
259 });
260
260
261 F.filterTimeout = null;
261 F.filterTimeout = null;
262
262
263 var show_node = function(node){
263 var show_node = function(node){
264 YUD.setStyle(node,'display','')
264 YUD.setStyle(node,'display','')
265 }
265 }
266 var hide_node = function(node){
266 var hide_node = function(node){
267 YUD.setStyle(node,'display','none');
267 YUD.setStyle(node,'display','none');
268 }
268 }
269
269
270 F.updateFilter = function() {
270 F.updateFilter = function() {
271 // Reset timeout
271 // Reset timeout
272 F.filterTimeout = null;
272 F.filterTimeout = null;
273
273
274 var obsolete = [];
274 var obsolete = [];
275
275
276 var req = q_filter_field.value.toLowerCase();
276 var req = q_filter_field.value.toLowerCase();
277
277
278 var l = nodes.length;
278 var l = nodes.length;
279 var i;
279 var i;
280 var showing = 0;
280 var showing = 0;
281
281
282 for (i=0;i<l;i++ ){
282 for (i=0;i<l;i++ ){
283 var n = nodes[i];
283 var n = nodes[i];
284 var target_element = display_element(n)
284 var target_element = display_element(n)
285 if(req && n.innerHTML.toLowerCase().indexOf(req) == -1){
285 if(req && n.innerHTML.toLowerCase().indexOf(req) == -1){
286 hide_node(target_element);
286 hide_node(target_element);
287 }
287 }
288 else{
288 else{
289 show_node(target_element);
289 show_node(target_element);
290 showing+=1;
290 showing+=1;
291 }
291 }
292 }
292 }
293
293
294 // if repo_count is set update the number
294 // if repo_count is set update the number
295 var cnt = YUD.get('repo_count');
295 var cnt = YUD.get('repo_count');
296 if(cnt){
296 if(cnt){
297 YUD.get('repo_count').innerHTML = showing;
297 YUD.get('repo_count').innerHTML = showing;
298 }
298 }
299
299
300 }
300 }
301 };
301 };
302
302
303 var ajaxPOST = function(url,postData,success) {
303 var ajaxPOST = function(url,postData,success) {
304 var sUrl = url;
304 var sUrl = url;
305 var callback = {
305 var callback = {
306 success: success,
306 success: success,
307 failure: function (o) {
307 failure: function (o) {
308 alert("error");
308 alert("error");
309 },
309 },
310 };
310 };
311 var postData = postData;
311 var postData = postData;
312 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
312 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
313 };
313 };
314
314
315
315
316 /** comments **/
316 /** comments **/
317 var removeInlineForm = function(form) {
317 var removeInlineForm = function(form) {
318 form.parentNode.removeChild(form);
318 form.parentNode.removeChild(form);
319 };
319 };
320
320
321 var tableTr = function(cls,body){
321 var tableTr = function(cls,body){
322 var form = document.createElement('tr');
322 var form = document.createElement('tr');
323 YUD.addClass(form, cls);
323 YUD.addClass(form, cls);
324 form.innerHTML = '<td class="lineno-inline new-inline"></td>'+
324 form.innerHTML = '<td class="lineno-inline new-inline"></td>'+
325 '<td class="lineno-inline old-inline"></td>'+
325 '<td class="lineno-inline old-inline"></td>'+
326 '<td>{0}</td>'.format(body);
326 '<td>{0}</td>'.format(body);
327 return form;
327 return form;
328 };
328 };
329
329
330 var createInlineForm = function(parent_tr, f_path, line) {
330 var createInlineForm = function(parent_tr, f_path, line) {
331 var tmpl = YUD.get('comment-inline-form-template').innerHTML;
331 var tmpl = YUD.get('comment-inline-form-template').innerHTML;
332 tmpl = tmpl.format(f_path, line);
332 tmpl = tmpl.format(f_path, line);
333 var form = tableTr('comment-form-inline',tmpl)
333 var form = tableTr('comment-form-inline',tmpl)
334
334
335 // create event for hide button
335 // create event for hide button
336 form = new YAHOO.util.Element(form);
336 form = new YAHOO.util.Element(form);
337 var form_hide_button = new YAHOO.util.Element(form.getElementsByClassName('hide-inline-form')[0]);
337 var form_hide_button = new YAHOO.util.Element(form.getElementsByClassName('hide-inline-form')[0]);
338 form_hide_button.on('click', function(e) {
338 form_hide_button.on('click', function(e) {
339 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode;
339 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode;
340 removeInlineForm(newtr);
340 removeInlineForm(newtr);
341 YUD.removeClass(parent_tr, 'form-open');
341 YUD.removeClass(parent_tr, 'form-open');
342 });
342 });
343 return form
343 return form
344 };
344 };
345 var injectInlineForm = function(tr){
345 var injectInlineForm = function(tr){
346 if(YUD.hasClass(tr,'form-open') || YUD.hasClass(tr,'context')){
346 if(YUD.hasClass(tr,'form-open') || YUD.hasClass(tr,'context')){
347 return
347 return
348 }
348 }
349 YUD.addClass(tr,'form-open');
349 YUD.addClass(tr,'form-open');
350 var node = tr.parentNode.parentNode.parentNode.getElementsByClassName('full_f_path')[0];
350 var node = tr.parentNode.parentNode.parentNode.getElementsByClassName('full_f_path')[0];
351 var f_path = YUD.getAttribute(node,'path');
351 var f_path = YUD.getAttribute(node,'path');
352 var lineno = getLineNo(tr);
352 var lineno = getLineNo(tr);
353 var form = createInlineForm(tr, f_path, lineno);
353 var form = createInlineForm(tr, f_path, lineno);
354 var target_tr = tr;
354 var target_tr = tr;
355 if(YUD.hasClass(YUD.getNextSibling(tr),'inline-comments')){
355 if(YUD.hasClass(YUD.getNextSibling(tr),'inline-comments')){
356 target_tr = YUD.getNextSibling(tr);
356 target_tr = YUD.getNextSibling(tr);
357 }
357 }
358 YUD.insertAfter(form,target_tr);
358 YUD.insertAfter(form,target_tr);
359 YUD.get('text_'+lineno).focus();
359 YUD.get('text_'+lineno).focus();
360 tooltip_activate();
360 tooltip_activate();
361 };
361 };
362
362
363 var createInlineAddButton = function(tr,label){
363 var createInlineAddButton = function(tr,label){
364 var html = '<div class="add-comment"><span class="ui-btn">{0}</span></div>'.format(label);
364 var html = '<div class="add-comment"><span class="ui-btn">{0}</span></div>'.format(label);
365
365
366 var add = new YAHOO.util.Element(tableTr('inline-comments-button',html));
366 var add = new YAHOO.util.Element(tableTr('inline-comments-button',html));
367 add.on('click', function(e) {
367 add.on('click', function(e) {
368 injectInlineForm(tr);
368 injectInlineForm(tr);
369 });
369 });
370 return add;
370 return add;
371 };
371 };
372
372
373 var getLineNo = function(tr) {
373 var getLineNo = function(tr) {
374 var line;
374 var line;
375 var o = tr.children[0].id.split('_');
375 var o = tr.children[0].id.split('_');
376 var n = tr.children[1].id.split('_');
376 var n = tr.children[1].id.split('_');
377
377
378 if (n.length >= 2) {
378 if (n.length >= 2) {
379 line = n[n.length-1];
379 line = n[n.length-1];
380 } else if (o.length >= 2) {
380 } else if (o.length >= 2) {
381 line = o[o.length-1];
381 line = o[o.length-1];
382 }
382 }
383
383
384 return line
384 return line
385 };
385 };
386
386
387
387
388 var fileBrowserListeners = function(current_url, node_list_url, url_base,
388 var fileBrowserListeners = function(current_url, node_list_url, url_base,
389 truncated_lbl, nomatch_lbl){
389 truncated_lbl, nomatch_lbl){
390 var current_url_branch = +"?branch=__BRANCH__";
390 var current_url_branch = +"?branch=__BRANCH__";
391 var url = url_base;
391 var url = url_base;
392 var node_url = node_list_url;
392 var node_url = node_list_url;
393
393
394 YUE.on('stay_at_branch','click',function(e){
394 YUE.on('stay_at_branch','click',function(e){
395 if(e.target.checked){
395 if(e.target.checked){
396 var uri = current_url_branch;
396 var uri = current_url_branch;
397 uri = uri.replace('__BRANCH__',e.target.value);
397 uri = uri.replace('__BRANCH__',e.target.value);
398 window.location = uri;
398 window.location = uri;
399 }
399 }
400 else{
400 else{
401 window.location = current_url;
401 window.location = current_url;
402 }
402 }
403 })
403 })
404
404
405 var n_filter = YUD.get('node_filter');
405 var n_filter = YUD.get('node_filter');
406 var F = YAHOO.namespace('node_filter');
406 var F = YAHOO.namespace('node_filter');
407
407
408 F.filterTimeout = null;
408 F.filterTimeout = null;
409 var nodes = null;
409 var nodes = null;
410
410
411 F.initFilter = function(){
411 F.initFilter = function(){
412 YUD.setStyle('node_filter_box_loading','display','');
412 YUD.setStyle('node_filter_box_loading','display','');
413 YUD.setStyle('search_activate_id','display','none');
413 YUD.setStyle('search_activate_id','display','none');
414 YUD.setStyle('add_node_id','display','none');
414 YUD.setStyle('add_node_id','display','none');
415 YUC.initHeader('X-PARTIAL-XHR',true);
415 YUC.initHeader('X-PARTIAL-XHR',true);
416 YUC.asyncRequest('GET',url,{
416 YUC.asyncRequest('GET',url,{
417 success:function(o){
417 success:function(o){
418 nodes = JSON.parse(o.responseText);
418 nodes = JSON.parse(o.responseText);
419 YUD.setStyle('node_filter_box_loading','display','none');
419 YUD.setStyle('node_filter_box_loading','display','none');
420 YUD.setStyle('node_filter_box','display','');
420 YUD.setStyle('node_filter_box','display','');
421 },
421 },
422 failure:function(o){
422 failure:function(o){
423 console.log('failed to load');
423 console.log('failed to load');
424 }
424 }
425 },null);
425 },null);
426 }
426 }
427
427
428 F.updateFilter = function(e) {
428 F.updateFilter = function(e) {
429
429
430 return function(){
430 return function(){
431 // Reset timeout
431 // Reset timeout
432 F.filterTimeout = null;
432 F.filterTimeout = null;
433 var query = e.target.value;
433 var query = e.target.value;
434 var match = [];
434 var match = [];
435 var matches = 0;
435 var matches = 0;
436 var matches_max = 20;
436 var matches_max = 20;
437 if (query != ""){
437 if (query != ""){
438 for(var i=0;i<nodes.length;i++){
438 for(var i=0;i<nodes.length;i++){
439 var pos = nodes[i].toLowerCase().indexOf(query)
439 var pos = nodes[i].toLowerCase().indexOf(query)
440 if(query && pos != -1){
440 if(query && pos != -1){
441
441
442 matches++
442 matches++
443 //show only certain amount to not kill browser
443 //show only certain amount to not kill browser
444 if (matches > matches_max){
444 if (matches > matches_max){
445 break;
445 break;
446 }
446 }
447
447
448 var n = nodes[i];
448 var n = nodes[i];
449 var n_hl = n.substring(0,pos)
449 var n_hl = n.substring(0,pos)
450 +"<b>{0}</b>".format(n.substring(pos,pos+query.length))
450 +"<b>{0}</b>".format(n.substring(pos,pos+query.length))
451 +n.substring(pos+query.length)
451 +n.substring(pos+query.length)
452 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));
452 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));
453 }
453 }
454 if(match.length >= matches_max){
454 if(match.length >= matches_max){
455 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(truncated_lbl));
455 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(truncated_lbl));
456 }
456 }
457
457
458 }
458 }
459 }
459 }
460 if(query != ""){
460 if(query != ""){
461 YUD.setStyle('tbody','display','none');
461 YUD.setStyle('tbody','display','none');
462 YUD.setStyle('tbody_filtered','display','');
462 YUD.setStyle('tbody_filtered','display','');
463
463
464 if (match.length==0){
464 if (match.length==0){
465 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(nomatch_lbl));
465 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(nomatch_lbl));
466 }
466 }
467
467
468 YUD.get('tbody_filtered').innerHTML = match.join("");
468 YUD.get('tbody_filtered').innerHTML = match.join("");
469 }
469 }
470 else{
470 else{
471 YUD.setStyle('tbody','display','');
471 YUD.setStyle('tbody','display','');
472 YUD.setStyle('tbody_filtered','display','none');
472 YUD.setStyle('tbody_filtered','display','none');
473 }
473 }
474
474
475 }
475 }
476 };
476 };
477
477
478 YUE.on(YUD.get('filter_activate'),'click',function(){
478 YUE.on(YUD.get('filter_activate'),'click',function(){
479 F.initFilter();
479 F.initFilter();
480 })
480 })
481 YUE.on(n_filter,'click',function(){
481 YUE.on(n_filter,'click',function(){
482 n_filter.value = '';
482 n_filter.value = '';
483 });
483 });
484 YUE.on(n_filter,'keyup',function(e){
484 YUE.on(n_filter,'keyup',function(e){
485 clearTimeout(F.filterTimeout);
485 clearTimeout(F.filterTimeout);
486 F.filterTimeout = setTimeout(F.updateFilter(e),600);
486 F.filterTimeout = setTimeout(F.updateFilter(e),600);
487 });
487 });
488 };
488 };
489
489
490
490
491 var initCodeMirror = function(textAreadId,resetUrl){
491 var initCodeMirror = function(textAreadId,resetUrl){
492 var myCodeMirror = CodeMirror.fromTextArea(YUD.get(textAreadId),{
492 var myCodeMirror = CodeMirror.fromTextArea(YUD.get(textAreadId),{
493 mode: "null",
493 mode: "null",
494 lineNumbers:true
494 lineNumbers:true
495 });
495 });
496 YUE.on('reset','click',function(e){
496 YUE.on('reset','click',function(e){
497 window.location=resetUrl
497 window.location=resetUrl
498 });
498 });
499
499
500 YUE.on('file_enable','click',function(){
500 YUE.on('file_enable','click',function(){
501 YUD.setStyle('editor_container','display','');
501 YUD.setStyle('editor_container','display','');
502 YUD.setStyle('upload_file_container','display','none');
502 YUD.setStyle('upload_file_container','display','none');
503 YUD.setStyle('filename_container','display','');
503 YUD.setStyle('filename_container','display','');
504 });
504 });
505
505
506 YUE.on('upload_file_enable','click',function(){
506 YUE.on('upload_file_enable','click',function(){
507 YUD.setStyle('editor_container','display','none');
507 YUD.setStyle('editor_container','display','none');
508 YUD.setStyle('upload_file_container','display','');
508 YUD.setStyle('upload_file_container','display','');
509 YUD.setStyle('filename_container','display','none');
509 YUD.setStyle('filename_container','display','none');
510 });
510 });
511 };
511 };
512
512
513
513
514
514
515 var getIdentNode = function(n){
515 var getIdentNode = function(n){
516 //iterate thru nodes untill matched interesting node !
516 //iterate thru nodes untill matched interesting node !
517
517
518 if (typeof n == 'undefined'){
518 if (typeof n == 'undefined'){
519 return -1
519 return -1
520 }
520 }
521
521
522 if(typeof n.id != "undefined" && n.id.match('L[0-9]+')){
522 if(typeof n.id != "undefined" && n.id.match('L[0-9]+')){
523 return n
523 return n
524 }
524 }
525 else{
525 else{
526 return getIdentNode(n.parentNode);
526 return getIdentNode(n.parentNode);
527 }
527 }
528 };
528 };
529
529
530 var getSelectionLink = function(selection_link_label) {
530 var getSelectionLink = function(selection_link_label) {
531 return function(){
531 return function(){
532 //get selection from start/to nodes
532 //get selection from start/to nodes
533 if (typeof window.getSelection != "undefined") {
533 if (typeof window.getSelection != "undefined") {
534 s = window.getSelection();
534 s = window.getSelection();
535
535
536 from = getIdentNode(s.anchorNode);
536 from = getIdentNode(s.anchorNode);
537 till = getIdentNode(s.focusNode);
537 till = getIdentNode(s.focusNode);
538
538
539 f_int = parseInt(from.id.replace('L',''));
539 f_int = parseInt(from.id.replace('L',''));
540 t_int = parseInt(till.id.replace('L',''));
540 t_int = parseInt(till.id.replace('L',''));
541
541
542 if (f_int > t_int){
542 if (f_int > t_int){
543 //highlight from bottom
543 //highlight from bottom
544 offset = -35;
544 offset = -35;
545 ranges = [t_int,f_int];
545 ranges = [t_int,f_int];
546
546
547 }
547 }
548 else{
548 else{
549 //highligth from top
549 //highligth from top
550 offset = 35;
550 offset = 35;
551 ranges = [f_int,t_int];
551 ranges = [f_int,t_int];
552 }
552 }
553
553
554 if (ranges[0] != ranges[1]){
554 if (ranges[0] != ranges[1]){
555 if(YUD.get('linktt') == null){
555 if(YUD.get('linktt') == null){
556 hl_div = document.createElement('div');
556 hl_div = document.createElement('div');
557 hl_div.id = 'linktt';
557 hl_div.id = 'linktt';
558 }
558 }
559 anchor = '#L'+ranges[0]+'-'+ranges[1];
559 anchor = '#L'+ranges[0]+'-'+ranges[1];
560 hl_div.innerHTML = '';
560 hl_div.innerHTML = '';
561 l = document.createElement('a');
561 l = document.createElement('a');
562 l.href = location.href.substring(0,location.href.indexOf('#'))+anchor;
562 l.href = location.href.substring(0,location.href.indexOf('#'))+anchor;
563 l.innerHTML = selection_link_label;
563 l.innerHTML = selection_link_label;
564 hl_div.appendChild(l);
564 hl_div.appendChild(l);
565
565
566 YUD.get('body').appendChild(hl_div);
566 YUD.get('body').appendChild(hl_div);
567
567
568 xy = YUD.getXY(till.id);
568 xy = YUD.getXY(till.id);
569
569
570 YUD.addClass('linktt','yui-tt');
570 YUD.addClass('linktt','yui-tt');
571 YUD.setStyle('linktt','top',xy[1]+offset+'px');
571 YUD.setStyle('linktt','top',xy[1]+offset+'px');
572 YUD.setStyle('linktt','left',xy[0]+'px');
572 YUD.setStyle('linktt','left',xy[0]+'px');
573 YUD.setStyle('linktt','visibility','visible');
573 YUD.setStyle('linktt','visibility','visible');
574 }
574 }
575 else{
575 else{
576 YUD.setStyle('linktt','visibility','hidden');
576 YUD.setStyle('linktt','visibility','hidden');
577 }
577 }
578 }
578 }
579 }
579 }
580 };
580 };
581
581
582 var deleteNotification = function(url, notification_id,callbacks){
582 var deleteNotification = function(url, notification_id,callbacks){
583 var callback = {
583 var callback = {
584 success:function(o){
584 success:function(o){
585 var obj = YUD.get(String("notification_"+notification_id));
585 var obj = YUD.get(String("notification_"+notification_id));
586 if(obj.parentNode !== undefined){
586 if(obj.parentNode !== undefined){
587 obj.parentNode.removeChild(obj);
587 obj.parentNode.removeChild(obj);
588 }
588 }
589 _run_callbacks(callbacks);
589 _run_callbacks(callbacks);
590 },
590 },
591 failure:function(o){
591 failure:function(o){
592 alert("error");
592 alert("error");
593 },
593 },
594 };
594 };
595 var postData = '_method=delete';
595 var postData = '_method=delete';
596 var sUrl = url.replace('__NOTIFICATION_ID__',notification_id);
596 var sUrl = url.replace('__NOTIFICATION_ID__',notification_id);
597 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl,
597 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl,
598 callback, postData);
598 callback, postData);
599 };
599 };
600
600
601
601
602 /**
602 /**
603 * QUICK REPO MENU
603 * QUICK REPO MENU
604 */
604 */
605 var quick_repo_menu = function(){
605 var quick_repo_menu = function(){
606 YUE.on(YUQ('.quick_repo_menu'),'click',function(e){
606 YUE.on(YUQ('.quick_repo_menu'),'click',function(e){
607 var menu = e.currentTarget.firstElementChild.firstElementChild;
607 var menu = e.currentTarget.firstElementChild.firstElementChild;
608 if(YUD.hasClass(menu,'hidden')){
608 if(YUD.hasClass(menu,'hidden')){
609 YUD.addClass(e.currentTarget,'active');
609 YUD.addClass(e.currentTarget,'active');
610 YUD.removeClass(menu,'hidden');
610 YUD.removeClass(menu,'hidden');
611 }else{
611 }else{
612 YUD.removeClass(e.currentTarget,'active');
612 YUD.removeClass(e.currentTarget,'active');
613 YUD.addClass(menu,'hidden');
613 YUD.addClass(menu,'hidden');
614 }
614 }
615 })
615 })
616 };
616 };
617
617
618
618
619 /**
619 /**
620 * TABLE SORTING
620 * TABLE SORTING
621 */
621 */
622
622
623 // returns a node from given html;
623 // returns a node from given html;
624 var fromHTML = function(html){
624 var fromHTML = function(html){
625 var _html = document.createElement('element');
625 var _html = document.createElement('element');
626 _html.innerHTML = html;
626 _html.innerHTML = html;
627 return _html;
627 return _html;
628 }
628 }
629 var get_rev = function(node){
629 var get_rev = function(node){
630 var n = node.firstElementChild.firstElementChild;
630 var n = node.firstElementChild.firstElementChild;
631
631
632 if (n===null){
632 if (n===null){
633 return -1
633 return -1
634 }
634 }
635 else{
635 else{
636 out = n.firstElementChild.innerHTML.split(':')[0].replace('r','');
636 out = n.firstElementChild.innerHTML.split(':')[0].replace('r','');
637 return parseInt(out);
637 return parseInt(out);
638 }
638 }
639 }
639 }
640
640
641 var get_name = function(node){
641 var get_name = function(node){
642 var name = node.firstElementChild.children[2].innerHTML;
642 var name = node.firstElementChild.children[2].innerHTML;
643 return name
643 return name
644 }
644 }
645 var get_group_name = function(node){
645 var get_group_name = function(node){
646 var name = node.firstElementChild.children[1].innerHTML;
646 var name = node.firstElementChild.children[1].innerHTML;
647 return name
647 return name
648 }
648 }
649 var get_date = function(node){
650 console.log(node.firstElementChild)
651 var date_ = node.firstElementChild.innerHTML;
652 return date_
653 }
654
649 var revisionSort = function(a, b, desc, field) {
655 var revisionSort = function(a, b, desc, field) {
650
656
651 var a_ = fromHTML(a.getData(field));
657 var a_ = fromHTML(a.getData(field));
652 var b_ = fromHTML(b.getData(field));
658 var b_ = fromHTML(b.getData(field));
653
659
654 // extract revisions from string nodes
660 // extract revisions from string nodes
655 a_ = get_rev(a_)
661 a_ = get_rev(a_)
656 b_ = get_rev(b_)
662 b_ = get_rev(b_)
657
663
658 var comp = YAHOO.util.Sort.compare;
664 var comp = YAHOO.util.Sort.compare;
659 var compState = comp(a_, b_, desc);
665 var compState = comp(a_, b_, desc);
660 return compState;
666 return compState;
661 };
667 };
662 var ageSort = function(a, b, desc, field) {
668 var ageSort = function(a, b, desc, field) {
663 var a_ = a.getData(field);
669 var a_ = a.getData(field);
664 var b_ = b.getData(field);
670 var b_ = b.getData(field);
665
671
666 var comp = YAHOO.util.Sort.compare;
672 var comp = YAHOO.util.Sort.compare;
667 var compState = comp(a_, b_, desc);
673 var compState = comp(a_, b_, desc);
668 return compState;
674 return compState;
669 };
675 };
670
676
671 var nameSort = function(a, b, desc, field) {
677 var nameSort = function(a, b, desc, field) {
672 var a_ = fromHTML(a.getData(field));
678 var a_ = fromHTML(a.getData(field));
673 var b_ = fromHTML(b.getData(field));
679 var b_ = fromHTML(b.getData(field));
674
680
675 // extract name from table
681 // extract name from table
676 a_ = get_name(a_)
682 a_ = get_name(a_)
677 b_ = get_name(b_)
683 b_ = get_name(b_)
678
684
679 var comp = YAHOO.util.Sort.compare;
685 var comp = YAHOO.util.Sort.compare;
680 var compState = comp(a_, b_, desc);
686 var compState = comp(a_, b_, desc);
681 return compState;
687 return compState;
682 };
688 };
683
689
684 var groupNameSort = function(a, b, desc, field) {
690 var groupNameSort = function(a, b, desc, field) {
685 var a_ = fromHTML(a.getData(field));
691 var a_ = fromHTML(a.getData(field));
686 var b_ = fromHTML(b.getData(field));
692 var b_ = fromHTML(b.getData(field));
687
693
688 // extract name from table
694 // extract name from table
689 a_ = get_group_name(a_)
695 a_ = get_group_name(a_)
690 b_ = get_group_name(b_)
696 b_ = get_group_name(b_)
691
697
692 var comp = YAHOO.util.Sort.compare;
698 var comp = YAHOO.util.Sort.compare;
693 var compState = comp(a_, b_, desc);
699 var compState = comp(a_, b_, desc);
694 return compState;
700 return compState;
701 };
702 var dateSort = function(a, b, desc, field) {
703 var a_ = fromHTML(a.getData(field));
704 var b_ = fromHTML(b.getData(field));
705
706 // extract name from table
707 a_ = get_date(a_)
708 b_ = get_date(b_)
709
710 var comp = YAHOO.util.Sort.compare;
711 var compState = comp(a_, b_, desc);
712 return compState;
695 }; No newline at end of file
713 };
@@ -1,40 +1,78
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${c.repo_name} ${_('Bookmarks')} - ${c.rhodecode_name}
5 ${c.repo_name} ${_('Bookmarks')} - ${c.rhodecode_name}
6 </%def>
6 </%def>
7
7
8
8
9 <%def name="breadcrumbs_links()">
9 <%def name="breadcrumbs_links()">
10 <input class="q_filter_box" id="q_filter_bookmarks" size="15" type="text" name="filter" value="${_('quick filter...')}"/>
10 <input class="q_filter_box" id="q_filter_bookmarks" size="15" type="text" name="filter" value="${_('quick filter...')}"/>
11 ${h.link_to(u'Home',h.url('/'))}
11 ${h.link_to(u'Home',h.url('/'))}
12 &raquo;
12 &raquo;
13 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
13 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
14 &raquo;
14 &raquo;
15 ${_('bookmarks')}
15 ${_('bookmarks')}
16 </%def>
16 </%def>
17
17
18 <%def name="page_nav()">
18 <%def name="page_nav()">
19 ${self.menu('bookmarks')}
19 ${self.menu('bookmarks')}
20 </%def>
20 </%def>
21 <%def name="main()">
21 <%def name="main()">
22 <div class="box">
22 <div class="box">
23 <!-- box / title -->
23 <!-- box / title -->
24 <div class="title">
24 <div class="title">
25 ${self.breadcrumbs()}
25 ${self.breadcrumbs()}
26 </div>
26 </div>
27 <!-- end box / title -->
27 <!-- end box / title -->
28 <div class="table">
28 <div class="table">
29 <%include file='bookmarks_data.html'/>
29 <%include file='bookmarks_data.html'/>
30 </div>
30 </div>
31 </div>
31 </div>
32 <script type="text/javascript">
32 <script type="text/javascript">
33 var nodes = YUQ('div.table tr td .logtags .tagtag a');
33
34 var target = 'q_filter_bookmarks';
34 // main table sorting
35 var func = function(node){
35 var myColumnDefs = [
36 return node.parentNode.parentNode.parentNode.parentNode;
36 {key:"name",label:"${_('Name')}",sortable:true},
37 }
37 {key:"date",label:"${_('Date')}",sortable:true,
38 q_filter(target,nodes,func);
38 sortOptions: { sortFunction: dateSort }},
39 {key:"author",label:"${_('Author')}",sortable:true},
40 {key:"revision",label:"${_('Revision')}",sortable:true,
41 sortOptions: { sortFunction: revisionSort }},
42 ];
43
44 var myDataSource = new YAHOO.util.DataSource(YUD.get("bookmarks_data"));
45
46 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
47
48 myDataSource.responseSchema = {
49 fields: [
50 {key:"name"},
51 {key:"date"},
52 {key:"author"},
53 {key:"revision"},
54 ]
55 };
56
57 var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
58 {
59 sortedBy:{key:"name",dir:"asc"},
60 MSG_SORTASC:"${_('Click to sort ascending')}",
61 MSG_SORTDESC:"${_('Click to sort descending')}",
62 MSG_EMPTY:"${_('No records found.')}",
63 MSG_ERROR:"${_('Data error.')}",
64 MSG_LOADING:"${_('Loading...')}",
65 }
66 );
67 myDataTable.subscribe('postRenderEvent',function(oArgs) {
68 tooltip_activate();
69 var func = function(node){
70 return node.parentNode.parentNode.parentNode.parentNode.parentNode;
71 }
72 q_filter('q_filter_bookmarks',YUQ('div.table tr td .logbooks .bookbook a'),func);
73 });
74
39 </script>
75 </script>
76
77
40 </%def> No newline at end of file
78 </%def>
@@ -1,29 +1,33
1 %if c.repo_bookmarks:
1 %if c.repo_bookmarks:
2 <table class="table_disp">
2 <div id="table_wrap" class="yui-skin-sam">
3 <table id="bookmarks_data">
4 <thead>
3 <tr>
5 <tr>
4 <th class="left">${_('name')}</th>
6 <th class="left">${_('Name')}</th>
5 <th class="left">${_('date')}</th>
7 <th class="left">${_('Date')}</th>
6 <th class="left">${_('author')}</th>
8 <th class="left">${_('Author')}</th>
7 <th class="left">${_('revision')}</th>
9 <th class="left">${_('Revision')}</th>
8 </tr>
10 </tr>
11 </thead>
9 %for cnt,book in enumerate(c.repo_bookmarks.items()):
12 %for cnt,book in enumerate(c.repo_bookmarks.items()):
10 <tr class="parity${cnt%2}">
13 <tr class="parity${cnt%2}">
11 <td>
14 <td>
12 <span class="logbooks">
15 <span class="logbooks">
13 <span class="bookbook">${h.link_to(book[0],
16 <span class="bookbook">${h.link_to(book[0],
14 h.url('files_home',repo_name=c.repo_name,revision=book[1].raw_id))}</span>
17 h.url('files_home',repo_name=c.repo_name,revision=book[1].raw_id))}</span>
15 </span>
18 </span>
16 </td>
19 </td>
17 <td><span class="tooltip" title="${h.age(book[1].date)}">${book[1].date}</span></td>
20 <td><span class="tooltip" title="${h.age(book[1].date)}">${book[1].date}</span></td>
18 <td title="${book[1].author}">${h.person(book[1].author)}</td>
21 <td title="${book[1].author}">${h.person(book[1].author)}</td>
19 <td>
22 <td>
20 <div>
23 <div>
21 <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=book[1].raw_id)}">r${book[1].revision}:${h.short_id(book[1].raw_id)}</a></pre>
24 <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=book[1].raw_id)}">r${book[1].revision}:${h.short_id(book[1].raw_id)}</a></pre>
22 </div>
25 </div>
23 </td>
26 </td>
24 </tr>
27 </tr>
25 %endfor
28 %endfor
26 </table>
29 </table>
30 </div>
27 %else:
31 %else:
28 ${_('There are no bookmarks yet')}
32 ${_('There are no bookmarks yet')}
29 %endif No newline at end of file
33 %endif
@@ -1,40 +1,77
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${c.repo_name} ${_('Branches')} - ${c.rhodecode_name}
5 ${c.repo_name} ${_('Branches')} - ${c.rhodecode_name}
6 </%def>
6 </%def>
7
7
8 <%def name="breadcrumbs_links()">
8 <%def name="breadcrumbs_links()">
9 <input class="q_filter_box" id="q_filter_branches" size="15" type="text" name="filter" value="${_('quick filter...')}"/>
9 <input class="q_filter_box" id="q_filter_branches" size="15" type="text" name="filter" value="${_('quick filter...')}"/>
10 ${h.link_to(u'Home',h.url('/'))}
10 ${h.link_to(u'Home',h.url('/'))}
11 &raquo;
11 &raquo;
12 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
12 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
13 &raquo;
13 &raquo;
14 ${_('branches')}
14 ${_('branches')}
15 </%def>
15 </%def>
16
16
17 <%def name="page_nav()">
17 <%def name="page_nav()">
18 ${self.menu('branches')}
18 ${self.menu('branches')}
19 </%def>
19 </%def>
20
20
21 <%def name="main()">
21 <%def name="main()">
22 <div class="box">
22 <div class="box">
23 <!-- box / title -->
23 <!-- box / title -->
24 <div class="title">
24 <div class="title">
25 ${self.breadcrumbs()}
25 ${self.breadcrumbs()}
26 </div>
26 </div>
27 <!-- end box / title -->
27 <!-- end box / title -->
28 <div class="table">
28 <div class="table">
29 <%include file='branches_data.html'/>
29 <%include file='branches_data.html'/>
30 </div>
30 </div>
31 </div>
31 </div>
32 <script type="text/javascript">
32 <script type="text/javascript">
33 var nodes = YUQ('div.table tr td .logtags .branchtag a');
33
34 var target = 'q_filter_branches';
34 // main table sorting
35 var func = function(node){
35 var myColumnDefs = [
36 return node.parentNode.parentNode.parentNode.parentNode;
36 {key:"name",label:"${_('Name')}",sortable:true},
37 }
37 {key:"date",label:"${_('Date')}",sortable:true,
38 q_filter(target,nodes,func);
38 sortOptions: { sortFunction: dateSort }},
39 {key:"author",label:"${_('Author')}",sortable:true},
40 {key:"revision",label:"${_('Revision')}",sortable:true,
41 sortOptions: { sortFunction: revisionSort }},
42 ];
43
44 var myDataSource = new YAHOO.util.DataSource(YUD.get("branches_data"));
45
46 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
47
48 myDataSource.responseSchema = {
49 fields: [
50 {key:"name"},
51 {key:"date"},
52 {key:"author"},
53 {key:"revision"},
54 ]
55 };
56
57 var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
58 {
59 sortedBy:{key:"name",dir:"asc"},
60 MSG_SORTASC:"${_('Click to sort ascending')}",
61 MSG_SORTDESC:"${_('Click to sort descending')}",
62 MSG_EMPTY:"${_('No records found.')}",
63 MSG_ERROR:"${_('Data error.')}",
64 MSG_LOADING:"${_('Loading...')}",
65 }
66 );
67 myDataTable.subscribe('postRenderEvent',function(oArgs) {
68 tooltip_activate();
69 var func = function(node){
70 return node.parentNode.parentNode.parentNode.parentNode.parentNode;
71 }
72 q_filter('q_filter_branches',YUQ('div.table tr td .logtags .branchtag a'),func);
73 });
74
39 </script>
75 </script>
76
40 </%def> No newline at end of file
77 </%def>
@@ -1,48 +1,52
1 %if c.repo_branches:
1 %if c.repo_branches:
2 <table class="table_disp">
2 <div id="table_wrap" class="yui-skin-sam">
3 <table id="branches_data">
4 <thead>
3 <tr>
5 <tr>
4 <th class="left">${_('name')}</th>
6 <th class="left">${_('name')}</th>
5 <th class="left">${_('date')}</th>
7 <th class="left">${_('date')}</th>
6 <th class="left">${_('author')}</th>
8 <th class="left">${_('author')}</th>
7 <th class="left">${_('revision')}</th>
9 <th class="left">${_('revision')}</th>
8 </tr>
10 </tr>
11 </thead>
9 %for cnt,branch in enumerate(c.repo_branches.items()):
12 %for cnt,branch in enumerate(c.repo_branches.items()):
10 <tr class="parity${cnt%2}">
13 <tr class="parity${cnt%2}">
11 <td>
14 <td>
12 <span class="logtags">
15 <span class="logtags">
13 <span class="branchtag">${h.link_to(branch[0],
16 <span class="branchtag">${h.link_to(branch[0],
14 h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
17 h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
15 </span>
18 </span>
16 </td>
19 </td>
17 <td><span class="tooltip" title="${h.age(branch[1].date)}">${branch[1].date}</span></td>
20 <td><span class="tooltip" title="${h.age(branch[1].date)}">${branch[1].date}</span></td>
18 <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
21 <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
19 <td>
22 <td>
20 <div>
23 <div>
21 <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id)}">r${branch[1].revision}:${h.short_id(branch[1].raw_id)}</a></pre>
24 <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id)}">r${branch[1].revision}:${h.short_id(branch[1].raw_id)}</a></pre>
22 </div>
25 </div>
23 </td>
26 </td>
24 </tr>
27 </tr>
25 %endfor
28 %endfor
26 % if hasattr(c,'repo_closed_branches') and c.repo_closed_branches:
29 % if hasattr(c,'repo_closed_branches') and c.repo_closed_branches:
27 %for cnt,branch in enumerate(c.repo_closed_branches.items()):
30 %for cnt,branch in enumerate(c.repo_closed_branches.items()):
28 <tr class="parity${cnt%2}">
31 <tr class="parity${cnt%2}">
29 <td>
32 <td>
30 <span class="logtags">
33 <span class="logtags">
31 <span class="branchtag">${h.link_to(branch[0]+' [closed]',
34 <span class="branchtag">${h.link_to(branch[0]+' [closed]',
32 h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
35 h.url('changeset_home',repo_name=c.repo_name,revision=branch[1].raw_id))}</span>
33 </span>
36 </span>
34 </td>
37 </td>
35 <td><span class="tooltip" title="${h.age(branch[1].date)}">${branch[1].date}</span></td>
38 <td><span class="tooltip" title="${h.age(branch[1].date)}">${branch[1].date}</span></td>
36 <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
39 <td title="${branch[1].author}">${h.person(branch[1].author)}</td>
37 <td>
40 <td>
38 <div>
41 <div>
39 <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id)}">r${branch[1].revision}:${h.short_id(branch[1].raw_id)}</a></pre>
42 <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=branch[1].raw_id)}">r${branch[1].revision}:${h.short_id(branch[1].raw_id)}</a></pre>
40 </div>
43 </div>
41 </td>
44 </td>
42 </tr>
45 </tr>
43 %endfor
46 %endfor
44 %endif
47 %endif
45 </table>
48 </table>
49 </div>
46 %else:
50 %else:
47 ${_('There are no branches yet')}
51 ${_('There are no branches yet')}
48 %endif No newline at end of file
52 %endif
@@ -1,40 +1,76
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${c.repo_name} ${_('Tags')} - ${c.rhodecode_name}
5 ${c.repo_name} ${_('Tags')} - ${c.rhodecode_name}
6 </%def>
6 </%def>
7
7
8
8
9 <%def name="breadcrumbs_links()">
9 <%def name="breadcrumbs_links()">
10 <input class="q_filter_box" id="q_filter_tags" size="15" type="text" name="filter" value="${_('quick filter...')}"/>
10 <input class="q_filter_box" id="q_filter_tags" size="15" type="text" name="filter" value="${_('quick filter...')}"/>
11 ${h.link_to(u'Home',h.url('/'))}
11 ${h.link_to(u'Home',h.url('/'))}
12 &raquo;
12 &raquo;
13 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
13 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
14 &raquo;
14 &raquo;
15 ${_('tags')}
15 ${_('tags')}
16 </%def>
16 </%def>
17
17
18 <%def name="page_nav()">
18 <%def name="page_nav()">
19 ${self.menu('tags')}
19 ${self.menu('tags')}
20 </%def>
20 </%def>
21 <%def name="main()">
21 <%def name="main()">
22 <div class="box">
22 <div class="box">
23 <!-- box / title -->
23 <!-- box / title -->
24 <div class="title">
24 <div class="title">
25 ${self.breadcrumbs()}
25 ${self.breadcrumbs()}
26 </div>
26 </div>
27 <!-- end box / title -->
27 <!-- end box / title -->
28 <div class="table">
28 <div class="table">
29 <%include file='tags_data.html'/>
29 <%include file='tags_data.html'/>
30 </div>
30 </div>
31 </div>
31 </div>
32 <script type="text/javascript">
32 <script type="text/javascript">
33 var nodes = YUQ('div.table tr td .logtags .tagtag a');
33
34 var target = 'q_filter_tags';
34 // main table sorting
35 var func = function(node){
35 var myColumnDefs = [
36 return node.parentNode.parentNode.parentNode.parentNode;
36 {key:"name",label:"${_('Name')}",sortable:true},
37 }
37 {key:"date",label:"${_('Date')}",sortable:true,
38 q_filter(target,nodes,func);
38 sortOptions: { sortFunction: dateSort }},
39 {key:"author",label:"${_('Author')}",sortable:true},
40 {key:"revision",label:"${_('Revision')}",sortable:true,
41 sortOptions: { sortFunction: revisionSort }},
42 ];
43
44 var myDataSource = new YAHOO.util.DataSource(YUD.get("tags_data"));
45
46 myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
47
48 myDataSource.responseSchema = {
49 fields: [
50 {key:"name"},
51 {key:"date"},
52 {key:"author"},
53 {key:"revision"},
54 ]
55 };
56
57 var myDataTable = new YAHOO.widget.DataTable("table_wrap", myColumnDefs, myDataSource,
58 {
59 sortedBy:{key:"name",dir:"asc"},
60 MSG_SORTASC:"${_('Click to sort ascending')}",
61 MSG_SORTDESC:"${_('Click to sort descending')}",
62 MSG_EMPTY:"${_('No records found.')}",
63 MSG_ERROR:"${_('Data error.')}",
64 MSG_LOADING:"${_('Loading...')}",
65 }
66 );
67 myDataTable.subscribe('postRenderEvent',function(oArgs) {
68 tooltip_activate();
69 var func = function(node){
70 return node.parentNode.parentNode.parentNode.parentNode.parentNode;
71 }
72 q_filter('q_filter_tags',YUQ('div.table tr td .logtags .tagtag a'),func);
73 });
74
39 </script>
75 </script>
40 </%def> No newline at end of file
76 </%def>
@@ -1,30 +1,34
1 %if c.repo_tags:
1 %if c.repo_tags:
2 <table class="table_disp">
2 <div id="table_wrap" class="yui-skin-sam">
3 <table id="tags_data">
4 <thead>
3 <tr>
5 <tr>
4 <th class="left">${_('name')}</th>
6 <th class="left">${_('Name')}</th>
5 <th class="left">${_('date')}</th>
7 <th class="left">${_('Date')}</th>
6 <th class="left">${_('author')}</th>
8 <th class="left">${_('Author')}</th>
7 <th class="left">${_('revision')}</th>
9 <th class="left">${_('Revision')}</th>
8 </tr>
10 </tr>
11 </thead>
9 %for cnt,tag in enumerate(c.repo_tags.items()):
12 %for cnt,tag in enumerate(c.repo_tags.items()):
10 <tr class="parity${cnt%2}">
13 <tr class="parity${cnt%2}">
11 <td>
14 <td>
12 <span class="logtags">
15 <span class="logtags">
13 <span class="tagtag">${h.link_to(tag[0],
16 <span class="tagtag">${h.link_to(tag[0],
14 h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
17 h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id))}
15 </span>
18 </span>
16 </span>
19 </span>
17 </td>
20 </td>
18 <td><span class="tooltip" title="${h.age(tag[1].date)}">${tag[1].date}</span></td>
21 <td><span class="tooltip" title="${h.age(tag[1].date)}">${tag[1].date}</span></td>
19 <td title="${tag[1].author}">${h.person(tag[1].author)}</td>
22 <td title="${tag[1].author}">${h.person(tag[1].author)}</td>
20 <td>
23 <td>
21 <div>
24 <div>
22 <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id)}">r${tag[1].revision}:${h.short_id(tag[1].raw_id)}</a></pre>
25 <pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=tag[1].raw_id)}">r${tag[1].revision}:${h.short_id(tag[1].raw_id)}</a></pre>
23 </div>
26 </div>
24 </td>
27 </td>
25 </tr>
28 </tr>
26 %endfor
29 %endfor
27 </table>
30 </table>
31 </div>
28 %else:
32 %else:
29 ${_('There are no tags yet')}
33 ${_('There are no tags yet')}
30 %endif No newline at end of file
34 %endif
General Comments 0
You need to be logged in to leave comments. Login now