##// END OF EJS Templates
tooltips: remove all occurences of explicit tooltip activation
ergo -
r385:4c58728c default
parent child Browse files
Show More
@@ -1,655 +1,653 b''
1 // # Copyright (C) 2010-2016 RhodeCode GmbH
1 // # Copyright (C) 2010-2016 RhodeCode GmbH
2 // #
2 // #
3 // # This program is free software: you can redistribute it and/or modify
3 // # This program is free software: you can redistribute it and/or modify
4 // # it under the terms of the GNU Affero General Public License, version 3
4 // # it under the terms of the GNU Affero General Public License, version 3
5 // # (only), as published by the Free Software Foundation.
5 // # (only), as published by the Free Software Foundation.
6 // #
6 // #
7 // # This program is distributed in the hope that it will be useful,
7 // # This program is distributed in the hope that it will be useful,
8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // # GNU General Public License for more details.
10 // # GNU General Public License for more details.
11 // #
11 // #
12 // # You should have received a copy of the GNU Affero General Public License
12 // # You should have received a copy of the GNU Affero General Public License
13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 // #
14 // #
15 // # This program is dual-licensed. If you wish to learn more about the
15 // # This program is dual-licensed. If you wish to learn more about the
16 // # RhodeCode Enterprise Edition, including its added features, Support services,
16 // # RhodeCode Enterprise Edition, including its added features, Support services,
17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 var firefoxAnchorFix = function() {
19 var firefoxAnchorFix = function() {
20 // hack to make anchor links behave properly on firefox, in our inline
20 // hack to make anchor links behave properly on firefox, in our inline
21 // comments generation when comments are injected firefox is misbehaving
21 // comments generation when comments are injected firefox is misbehaving
22 // when jumping to anchor links
22 // when jumping to anchor links
23 if (location.href.indexOf('#') > -1) {
23 if (location.href.indexOf('#') > -1) {
24 location.href += '';
24 location.href += '';
25 }
25 }
26 };
26 };
27
27
28 // returns a node from given html;
28 // returns a node from given html;
29 var fromHTML = function(html){
29 var fromHTML = function(html){
30 var _html = document.createElement('element');
30 var _html = document.createElement('element');
31 _html.innerHTML = html;
31 _html.innerHTML = html;
32 return _html;
32 return _html;
33 };
33 };
34
34
35 var tableTr = function(cls, body){
35 var tableTr = function(cls, body){
36 var _el = document.createElement('div');
36 var _el = document.createElement('div');
37 var _body = $(body).attr('id');
37 var _body = $(body).attr('id');
38 var comment_id = fromHTML(body).children[0].id.split('comment-')[1];
38 var comment_id = fromHTML(body).children[0].id.split('comment-')[1];
39 var id = 'comment-tr-{0}'.format(comment_id);
39 var id = 'comment-tr-{0}'.format(comment_id);
40 var _html = ('<table><tbody><tr id="{0}" class="{1}">'+
40 var _html = ('<table><tbody><tr id="{0}" class="{1}">'+
41 '<td class="add-comment-line"><span class="add-comment-content"></span></td>'+
41 '<td class="add-comment-line"><span class="add-comment-content"></span></td>'+
42 '<td></td>'+
42 '<td></td>'+
43 '<td></td>'+
43 '<td></td>'+
44 '<td>{2}</td>'+
44 '<td>{2}</td>'+
45 '</tr></tbody></table>').format(id, cls, body);
45 '</tr></tbody></table>').format(id, cls, body);
46 $(_el).html(_html);
46 $(_el).html(_html);
47 return _el.children[0].children[0].children[0];
47 return _el.children[0].children[0].children[0];
48 };
48 };
49
49
50 var removeInlineForm = function(form) {
50 var removeInlineForm = function(form) {
51 form.parentNode.removeChild(form);
51 form.parentNode.removeChild(form);
52 };
52 };
53
53
54 var createInlineForm = function(parent_tr, f_path, line) {
54 var createInlineForm = function(parent_tr, f_path, line) {
55 var tmpl = $('#comment-inline-form-template').html();
55 var tmpl = $('#comment-inline-form-template').html();
56 tmpl = tmpl.format(f_path, line);
56 tmpl = tmpl.format(f_path, line);
57 var form = tableTr('comment-form-inline', tmpl);
57 var form = tableTr('comment-form-inline', tmpl);
58 var form_hide_button = $(form).find('.hide-inline-form');
58 var form_hide_button = $(form).find('.hide-inline-form');
59
59
60 $(form_hide_button).click(function(e) {
60 $(form_hide_button).click(function(e) {
61 $('.inline-comments').removeClass('hide-comment-button');
61 $('.inline-comments').removeClass('hide-comment-button');
62 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode;
62 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode;
63 if ($(newtr.nextElementSibling).hasClass('inline-comments-button')) {
63 if ($(newtr.nextElementSibling).hasClass('inline-comments-button')) {
64 $(newtr.nextElementSibling).show();
64 $(newtr.nextElementSibling).show();
65 }
65 }
66 $(newtr).parents('.comment-form-inline').remove();
66 $(newtr).parents('.comment-form-inline').remove();
67 $(parent_tr).removeClass('form-open');
67 $(parent_tr).removeClass('form-open');
68 $(parent_tr).removeClass('hl-comment');
68 $(parent_tr).removeClass('hl-comment');
69 });
69 });
70
70
71 return form;
71 return form;
72 };
72 };
73
73
74 var getLineNo = function(tr) {
74 var getLineNo = function(tr) {
75 var line;
75 var line;
76 // Try to get the id and return "" (empty string) if it doesn't exist
76 // Try to get the id and return "" (empty string) if it doesn't exist
77 var o = ($(tr).find('.lineno.old').attr('id')||"").split('_');
77 var o = ($(tr).find('.lineno.old').attr('id')||"").split('_');
78 var n = ($(tr).find('.lineno.new').attr('id')||"").split('_');
78 var n = ($(tr).find('.lineno.new').attr('id')||"").split('_');
79 if (n.length >= 2) {
79 if (n.length >= 2) {
80 line = n[n.length-1];
80 line = n[n.length-1];
81 } else if (o.length >= 2) {
81 } else if (o.length >= 2) {
82 line = o[o.length-1];
82 line = o[o.length-1];
83 }
83 }
84 return line;
84 return line;
85 };
85 };
86
86
87 /**
87 /**
88 * make a single inline comment and place it inside
88 * make a single inline comment and place it inside
89 */
89 */
90 var renderInlineComment = function(json_data, show_add_button) {
90 var renderInlineComment = function(json_data, show_add_button) {
91 show_add_button = typeof show_add_button !== 'undefined' ? show_add_button : true;
91 show_add_button = typeof show_add_button !== 'undefined' ? show_add_button : true;
92 try {
92 try {
93 var html = json_data.rendered_text;
93 var html = json_data.rendered_text;
94 var lineno = json_data.line_no;
94 var lineno = json_data.line_no;
95 var target_id = json_data.target_id;
95 var target_id = json_data.target_id;
96 placeInline(target_id, lineno, html, show_add_button);
96 placeInline(target_id, lineno, html, show_add_button);
97 } catch (e) {
97 } catch (e) {
98 console.error(e);
98 console.error(e);
99 }
99 }
100 };
100 };
101
101
102 function bindDeleteCommentButtons() {
102 function bindDeleteCommentButtons() {
103 $('.delete-comment').one('click', function() {
103 $('.delete-comment').one('click', function() {
104 var comment_id = $(this).data("comment-id");
104 var comment_id = $(this).data("comment-id");
105
105
106 if (comment_id){
106 if (comment_id){
107 deleteComment(comment_id);
107 deleteComment(comment_id);
108 }
108 }
109 });
109 });
110 }
110 }
111
111
112 /**
112 /**
113 * Inject inline comment for on given TR this tr should be always an .line
113 * Inject inline comment for on given TR this tr should be always an .line
114 * tr containing the line. Code will detect comment, and always put the comment
114 * tr containing the line. Code will detect comment, and always put the comment
115 * block at the very bottom
115 * block at the very bottom
116 */
116 */
117 var injectInlineForm = function(tr){
117 var injectInlineForm = function(tr){
118 if (!$(tr).hasClass('line')) {
118 if (!$(tr).hasClass('line')) {
119 return;
119 return;
120 }
120 }
121
121
122 var _td = $(tr).find('.code').get(0);
122 var _td = $(tr).find('.code').get(0);
123 if ($(tr).hasClass('form-open') ||
123 if ($(tr).hasClass('form-open') ||
124 $(tr).hasClass('context') ||
124 $(tr).hasClass('context') ||
125 $(_td).hasClass('no-comment')) {
125 $(_td).hasClass('no-comment')) {
126 return;
126 return;
127 }
127 }
128 $(tr).addClass('form-open');
128 $(tr).addClass('form-open');
129 $(tr).addClass('hl-comment');
129 $(tr).addClass('hl-comment');
130 var node = $(tr.parentNode.parentNode.parentNode).find('.full_f_path').get(0);
130 var node = $(tr.parentNode.parentNode.parentNode).find('.full_f_path').get(0);
131 var f_path = $(node).attr('path');
131 var f_path = $(node).attr('path');
132 var lineno = getLineNo(tr);
132 var lineno = getLineNo(tr);
133 var form = createInlineForm(tr, f_path, lineno);
133 var form = createInlineForm(tr, f_path, lineno);
134
134
135 var parent = tr;
135 var parent = tr;
136 while (1) {
136 while (1) {
137 var n = parent.nextElementSibling;
137 var n = parent.nextElementSibling;
138 // next element are comments !
138 // next element are comments !
139 if ($(n).hasClass('inline-comments')) {
139 if ($(n).hasClass('inline-comments')) {
140 parent = n;
140 parent = n;
141 }
141 }
142 else {
142 else {
143 break;
143 break;
144 }
144 }
145 }
145 }
146 var _parent = $(parent).get(0);
146 var _parent = $(parent).get(0);
147 $(_parent).after(form);
147 $(_parent).after(form);
148 $('.comment-form-inline').prev('.inline-comments').addClass('hide-comment-button');
148 $('.comment-form-inline').prev('.inline-comments').addClass('hide-comment-button');
149 var f = $(form).get(0);
149 var f = $(form).get(0);
150
150
151 var _form = $(f).find('.inline-form').get(0);
151 var _form = $(f).find('.inline-form').get(0);
152
152
153 var pullRequestId = templateContext.pull_request_data.pull_request_id;
153 var pullRequestId = templateContext.pull_request_data.pull_request_id;
154 var commitId = templateContext.commit_data.commit_id;
154 var commitId = templateContext.commit_data.commit_id;
155
155
156 var commentForm = new CommentForm(_form, commitId, pullRequestId, lineno, false);
156 var commentForm = new CommentForm(_form, commitId, pullRequestId, lineno, false);
157 var cm = commentForm.getCmInstance();
157 var cm = commentForm.getCmInstance();
158
158
159 // set a CUSTOM submit handler for inline comments.
159 // set a CUSTOM submit handler for inline comments.
160 commentForm.setHandleFormSubmit(function(o) {
160 commentForm.setHandleFormSubmit(function(o) {
161 var text = commentForm.cm.getValue();
161 var text = commentForm.cm.getValue();
162
162
163 if (text === "") {
163 if (text === "") {
164 return;
164 return;
165 }
165 }
166
166
167 if (lineno === undefined) {
167 if (lineno === undefined) {
168 alert('missing line !');
168 alert('missing line !');
169 return;
169 return;
170 }
170 }
171 if (f_path === undefined) {
171 if (f_path === undefined) {
172 alert('missing file path !');
172 alert('missing file path !');
173 return;
173 return;
174 }
174 }
175
175
176 var excludeCancelBtn = false;
176 var excludeCancelBtn = false;
177 var submitEvent = true;
177 var submitEvent = true;
178 commentForm.setActionButtonsDisabled(true, excludeCancelBtn, submitEvent);
178 commentForm.setActionButtonsDisabled(true, excludeCancelBtn, submitEvent);
179 commentForm.cm.setOption("readOnly", true);
179 commentForm.cm.setOption("readOnly", true);
180 var postData = {
180 var postData = {
181 'text': text,
181 'text': text,
182 'f_path': f_path,
182 'f_path': f_path,
183 'line': lineno,
183 'line': lineno,
184 'csrf_token': CSRF_TOKEN
184 'csrf_token': CSRF_TOKEN
185 };
185 };
186 var submitSuccessCallback = function(o) {
186 var submitSuccessCallback = function(o) {
187 $(tr).removeClass('form-open');
187 $(tr).removeClass('form-open');
188 removeInlineForm(f);
188 removeInlineForm(f);
189 renderInlineComment(o);
189 renderInlineComment(o);
190 $('.inline-comments').removeClass('hide-comment-button');
190 $('.inline-comments').removeClass('hide-comment-button');
191
191
192 // re trigger the linkification of next/prev navigation
192 // re trigger the linkification of next/prev navigation
193 linkifyComments($('.inline-comment-injected'));
193 linkifyComments($('.inline-comment-injected'));
194 timeagoActivate();
194 timeagoActivate();
195 tooltip_activate();
196 bindDeleteCommentButtons();
195 bindDeleteCommentButtons();
197 commentForm.setActionButtonsDisabled(false);
196 commentForm.setActionButtonsDisabled(false);
198
197
199 };
198 };
200 var submitFailCallback = function(){
199 var submitFailCallback = function(){
201 commentForm.resetCommentFormState(text)
200 commentForm.resetCommentFormState(text)
202 };
201 };
203 commentForm.submitAjaxPOST(
202 commentForm.submitAjaxPOST(
204 commentForm.submitUrl, postData, submitSuccessCallback, submitFailCallback);
203 commentForm.submitUrl, postData, submitSuccessCallback, submitFailCallback);
205 });
204 });
206
205
207 setTimeout(function() {
206 setTimeout(function() {
208 // callbacks
207 // callbacks
209 if (cm !== undefined) {
208 if (cm !== undefined) {
210 cm.focus();
209 cm.focus();
211 }
210 }
212 }, 10);
211 }, 10);
213
212
214 $.Topic('/ui/plugins/code/comment_form_built').prepare({
213 $.Topic('/ui/plugins/code/comment_form_built').prepare({
215 form:_form,
214 form:_form,
216 parent:_parent}
215 parent:_parent}
217 );
216 );
218 };
217 };
219
218
220 var deleteComment = function(comment_id) {
219 var deleteComment = function(comment_id) {
221 var url = AJAX_COMMENT_DELETE_URL.replace('__COMMENT_ID__', comment_id);
220 var url = AJAX_COMMENT_DELETE_URL.replace('__COMMENT_ID__', comment_id);
222 var postData = {
221 var postData = {
223 '_method': 'delete',
222 '_method': 'delete',
224 'csrf_token': CSRF_TOKEN
223 'csrf_token': CSRF_TOKEN
225 };
224 };
226
225
227 var success = function(o) {
226 var success = function(o) {
228 window.location.reload();
227 window.location.reload();
229 };
228 };
230 ajaxPOST(url, postData, success);
229 ajaxPOST(url, postData, success);
231 };
230 };
232
231
233 var createInlineAddButton = function(tr){
232 var createInlineAddButton = function(tr){
234 var label = _gettext('Add another comment');
233 var label = _gettext('Add another comment');
235 var html_el = document.createElement('div');
234 var html_el = document.createElement('div');
236 $(html_el).addClass('add-comment');
235 $(html_el).addClass('add-comment');
237 html_el.innerHTML = '<span class="btn btn-secondary">{0}</span>'.format(label);
236 html_el.innerHTML = '<span class="btn btn-secondary">{0}</span>'.format(label);
238 var add = new $(html_el);
237 var add = new $(html_el);
239 add.on('click', function(e) {
238 add.on('click', function(e) {
240 injectInlineForm(tr);
239 injectInlineForm(tr);
241 });
240 });
242 return add;
241 return add;
243 };
242 };
244
243
245 var placeAddButton = function(target_tr){
244 var placeAddButton = function(target_tr){
246 if(!target_tr){
245 if(!target_tr){
247 return;
246 return;
248 }
247 }
249 var last_node = target_tr;
248 var last_node = target_tr;
250 // scan
249 // scan
251 while (1){
250 while (1){
252 var n = last_node.nextElementSibling;
251 var n = last_node.nextElementSibling;
253 // next element are comments !
252 // next element are comments !
254 if($(n).hasClass('inline-comments')){
253 if($(n).hasClass('inline-comments')){
255 last_node = n;
254 last_node = n;
256 // also remove the comment button from previous
255 // also remove the comment button from previous
257 var comment_add_buttons = $(last_node).find('.add-comment');
256 var comment_add_buttons = $(last_node).find('.add-comment');
258 for(var i=0; i<comment_add_buttons.length; i++){
257 for(var i=0; i<comment_add_buttons.length; i++){
259 var b = comment_add_buttons[i];
258 var b = comment_add_buttons[i];
260 b.parentNode.removeChild(b);
259 b.parentNode.removeChild(b);
261 }
260 }
262 }
261 }
263 else{
262 else{
264 break;
263 break;
265 }
264 }
266 }
265 }
267 var add = createInlineAddButton(target_tr);
266 var add = createInlineAddButton(target_tr);
268 // get the comment div
267 // get the comment div
269 var comment_block = $(last_node).find('.comment')[0];
268 var comment_block = $(last_node).find('.comment')[0];
270 // attach add button
269 // attach add button
271 $(add).insertAfter(comment_block);
270 $(add).insertAfter(comment_block);
272 };
271 };
273
272
274 /**
273 /**
275 * Places the inline comment into the changeset block in proper line position
274 * Places the inline comment into the changeset block in proper line position
276 */
275 */
277 var placeInline = function(target_container, lineno, html, show_add_button) {
276 var placeInline = function(target_container, lineno, html, show_add_button) {
278 show_add_button = typeof show_add_button !== 'undefined' ? show_add_button : true;
277 show_add_button = typeof show_add_button !== 'undefined' ? show_add_button : true;
279
278
280 var lineid = "{0}_{1}".format(target_container, lineno);
279 var lineid = "{0}_{1}".format(target_container, lineno);
281 var target_line = $('#' + lineid).get(0);
280 var target_line = $('#' + lineid).get(0);
282 var comment = new $(tableTr('inline-comments', html));
281 var comment = new $(tableTr('inline-comments', html));
283 // check if there are comments already !
282 // check if there are comments already !
284 var parent_node = target_line.parentNode;
283 var parent_node = target_line.parentNode;
285 var root_parent = parent_node;
284 var root_parent = parent_node;
286 while (1) {
285 while (1) {
287 var n = parent_node.nextElementSibling;
286 var n = parent_node.nextElementSibling;
288 // next element are comments !
287 // next element are comments !
289 if ($(n).hasClass('inline-comments')) {
288 if ($(n).hasClass('inline-comments')) {
290 parent_node = n;
289 parent_node = n;
291 }
290 }
292 else {
291 else {
293 break;
292 break;
294 }
293 }
295 }
294 }
296 // put in the comment at the bottom
295 // put in the comment at the bottom
297 $(comment).insertAfter(parent_node);
296 $(comment).insertAfter(parent_node);
298 $(comment).find('.comment-inline').addClass('inline-comment-injected');
297 $(comment).find('.comment-inline').addClass('inline-comment-injected');
299 // scan nodes, and attach add button to last one
298 // scan nodes, and attach add button to last one
300 if (show_add_button) {
299 if (show_add_button) {
301 placeAddButton(root_parent);
300 placeAddButton(root_parent);
302 }
301 }
303
302
304 return target_line;
303 return target_line;
305 };
304 };
306
305
307 var linkifyComments = function(comments) {
306 var linkifyComments = function(comments) {
308
307
309 for (var i = 0; i < comments.length; i++) {
308 for (var i = 0; i < comments.length; i++) {
310 var comment_id = $(comments[i]).data('comment-id');
309 var comment_id = $(comments[i]).data('comment-id');
311 var prev_comment_id = $(comments[i - 1]).data('comment-id');
310 var prev_comment_id = $(comments[i - 1]).data('comment-id');
312 var next_comment_id = $(comments[i + 1]).data('comment-id');
311 var next_comment_id = $(comments[i + 1]).data('comment-id');
313
312
314 // place next/prev links
313 // place next/prev links
315 if (prev_comment_id) {
314 if (prev_comment_id) {
316 $('#prev_c_' + comment_id).show();
315 $('#prev_c_' + comment_id).show();
317 $('#prev_c_' + comment_id + " a.arrow_comment_link").attr(
316 $('#prev_c_' + comment_id + " a.arrow_comment_link").attr(
318 'href', '#comment-' + prev_comment_id).removeClass('disabled');
317 'href', '#comment-' + prev_comment_id).removeClass('disabled');
319 }
318 }
320 if (next_comment_id) {
319 if (next_comment_id) {
321 $('#next_c_' + comment_id).show();
320 $('#next_c_' + comment_id).show();
322 $('#next_c_' + comment_id + " a.arrow_comment_link").attr(
321 $('#next_c_' + comment_id + " a.arrow_comment_link").attr(
323 'href', '#comment-' + next_comment_id).removeClass('disabled');
322 'href', '#comment-' + next_comment_id).removeClass('disabled');
324 }
323 }
325 // place a first link to the total counter
324 // place a first link to the total counter
326 if (i === 0) {
325 if (i === 0) {
327 $('#inline-comments-counter').attr('href', '#comment-' + comment_id);
326 $('#inline-comments-counter').attr('href', '#comment-' + comment_id);
328 }
327 }
329 }
328 }
330
329
331 };
330 };
332
331
333 /**
332 /**
334 * Iterates over all the inlines, and places them inside proper blocks of data
333 * Iterates over all the inlines, and places them inside proper blocks of data
335 */
334 */
336 var renderInlineComments = function(file_comments, show_add_button) {
335 var renderInlineComments = function(file_comments, show_add_button) {
337 show_add_button = typeof show_add_button !== 'undefined' ? show_add_button : true;
336 show_add_button = typeof show_add_button !== 'undefined' ? show_add_button : true;
338
337
339 for (var i = 0; i < file_comments.length; i++) {
338 for (var i = 0; i < file_comments.length; i++) {
340 var box = file_comments[i];
339 var box = file_comments[i];
341
340
342 var target_id = $(box).attr('target_id');
341 var target_id = $(box).attr('target_id');
343
342
344 // actually comments with line numbers
343 // actually comments with line numbers
345 var comments = box.children;
344 var comments = box.children;
346
345
347 for (var j = 0; j < comments.length; j++) {
346 for (var j = 0; j < comments.length; j++) {
348 var data = {
347 var data = {
349 'rendered_text': comments[j].outerHTML,
348 'rendered_text': comments[j].outerHTML,
350 'line_no': $(comments[j]).attr('line'),
349 'line_no': $(comments[j]).attr('line'),
351 'target_id': target_id
350 'target_id': target_id
352 };
351 };
353 renderInlineComment(data, show_add_button);
352 renderInlineComment(data, show_add_button);
354 }
353 }
355 }
354 }
356
355
357 // since order of injection is random, we're now re-iterating
356 // since order of injection is random, we're now re-iterating
358 // from correct order and filling in links
357 // from correct order and filling in links
359 linkifyComments($('.inline-comment-injected'));
358 linkifyComments($('.inline-comment-injected'));
360 bindDeleteCommentButtons();
359 bindDeleteCommentButtons();
361 firefoxAnchorFix();
360 firefoxAnchorFix();
362 };
361 };
363
362
364
363
365 /* Comment form for main and inline comments */
364 /* Comment form for main and inline comments */
366 var CommentForm = (function() {
365 var CommentForm = (function() {
367 "use strict";
366 "use strict";
368
367
369 function CommentForm(formElement, commitId, pullRequestId, lineNo, initAutocompleteActions) {
368 function CommentForm(formElement, commitId, pullRequestId, lineNo, initAutocompleteActions) {
370
369
371 this.withLineNo = function(selector) {
370 this.withLineNo = function(selector) {
372 var lineNo = this.lineNo;
371 var lineNo = this.lineNo;
373 if (lineNo === undefined) {
372 if (lineNo === undefined) {
374 return selector
373 return selector
375 } else {
374 } else {
376 return selector + '_' + lineNo;
375 return selector + '_' + lineNo;
377 }
376 }
378 };
377 };
379
378
380 this.commitId = commitId;
379 this.commitId = commitId;
381 this.pullRequestId = pullRequestId;
380 this.pullRequestId = pullRequestId;
382 this.lineNo = lineNo;
381 this.lineNo = lineNo;
383 this.initAutocompleteActions = initAutocompleteActions;
382 this.initAutocompleteActions = initAutocompleteActions;
384
383
385 this.previewButton = this.withLineNo('#preview-btn');
384 this.previewButton = this.withLineNo('#preview-btn');
386 this.previewContainer = this.withLineNo('#preview-container');
385 this.previewContainer = this.withLineNo('#preview-container');
387
386
388 this.previewBoxSelector = this.withLineNo('#preview-box');
387 this.previewBoxSelector = this.withLineNo('#preview-box');
389
388
390 this.editButton = this.withLineNo('#edit-btn');
389 this.editButton = this.withLineNo('#edit-btn');
391 this.editContainer = this.withLineNo('#edit-container');
390 this.editContainer = this.withLineNo('#edit-container');
392
391
393 this.cancelButton = this.withLineNo('#cancel-btn');
392 this.cancelButton = this.withLineNo('#cancel-btn');
394
393
395 this.statusChange = '#change_status';
394 this.statusChange = '#change_status';
396 this.cmBox = this.withLineNo('#text');
395 this.cmBox = this.withLineNo('#text');
397 this.cm = initCommentBoxCodeMirror(this.cmBox, this.initAutocompleteActions);
396 this.cm = initCommentBoxCodeMirror(this.cmBox, this.initAutocompleteActions);
398
397
399 this.submitForm = formElement;
398 this.submitForm = formElement;
400 this.submitButton = $(this.submitForm).find('input[type="submit"]');
399 this.submitButton = $(this.submitForm).find('input[type="submit"]');
401 this.submitButtonText = this.submitButton.val();
400 this.submitButtonText = this.submitButton.val();
402
401
403 this.previewUrl = pyroutes.url('changeset_comment_preview',
402 this.previewUrl = pyroutes.url('changeset_comment_preview',
404 {'repo_name': templateContext.repo_name});
403 {'repo_name': templateContext.repo_name});
405
404
406 // based on commitId, or pullReuqestId decide where do we submit
405 // based on commitId, or pullReuqestId decide where do we submit
407 // out data
406 // out data
408 if (this.commitId){
407 if (this.commitId){
409 this.submitUrl = pyroutes.url('changeset_comment',
408 this.submitUrl = pyroutes.url('changeset_comment',
410 {'repo_name': templateContext.repo_name,
409 {'repo_name': templateContext.repo_name,
411 'revision': this.commitId});
410 'revision': this.commitId});
412
411
413 } else if (this.pullRequestId) {
412 } else if (this.pullRequestId) {
414 this.submitUrl = pyroutes.url('pullrequest_comment',
413 this.submitUrl = pyroutes.url('pullrequest_comment',
415 {'repo_name': templateContext.repo_name,
414 {'repo_name': templateContext.repo_name,
416 'pull_request_id': this.pullRequestId});
415 'pull_request_id': this.pullRequestId});
417
416
418 } else {
417 } else {
419 throw new Error(
418 throw new Error(
420 'CommentForm requires pullRequestId, or commitId to be specified.')
419 'CommentForm requires pullRequestId, or commitId to be specified.')
421 }
420 }
422
421
423 this.getCmInstance = function(){
422 this.getCmInstance = function(){
424 return this.cm
423 return this.cm
425 };
424 };
426
425
427 var self = this;
426 var self = this;
428
427
429 this.getCommentStatus = function() {
428 this.getCommentStatus = function() {
430 return $(this.submitForm).find(this.statusChange).val();
429 return $(this.submitForm).find(this.statusChange).val();
431 };
430 };
432
431
433 this.isAllowedToSubmit = function() {
432 this.isAllowedToSubmit = function() {
434 return !$(this.submitButton).prop('disabled');
433 return !$(this.submitButton).prop('disabled');
435 };
434 };
436
435
437 this.initStatusChangeSelector = function(){
436 this.initStatusChangeSelector = function(){
438 var formatChangeStatus = function(state, escapeMarkup) {
437 var formatChangeStatus = function(state, escapeMarkup) {
439 var originalOption = state.element;
438 var originalOption = state.element;
440 return '<div class="flag_status ' + $(originalOption).data('status') + ' pull-left"></div>' +
439 return '<div class="flag_status ' + $(originalOption).data('status') + ' pull-left"></div>' +
441 '<span>' + escapeMarkup(state.text) + '</span>';
440 '<span>' + escapeMarkup(state.text) + '</span>';
442 };
441 };
443 var formatResult = function(result, container, query, escapeMarkup) {
442 var formatResult = function(result, container, query, escapeMarkup) {
444 return formatChangeStatus(result, escapeMarkup);
443 return formatChangeStatus(result, escapeMarkup);
445 };
444 };
446
445
447 var formatSelection = function(data, container, escapeMarkup) {
446 var formatSelection = function(data, container, escapeMarkup) {
448 return formatChangeStatus(data, escapeMarkup);
447 return formatChangeStatus(data, escapeMarkup);
449 };
448 };
450
449
451 $(this.submitForm).find(this.statusChange).select2({
450 $(this.submitForm).find(this.statusChange).select2({
452 placeholder: _gettext('Status Review'),
451 placeholder: _gettext('Status Review'),
453 formatResult: formatResult,
452 formatResult: formatResult,
454 formatSelection: formatSelection,
453 formatSelection: formatSelection,
455 containerCssClass: "drop-menu status_box_menu",
454 containerCssClass: "drop-menu status_box_menu",
456 dropdownCssClass: "drop-menu-dropdown",
455 dropdownCssClass: "drop-menu-dropdown",
457 dropdownAutoWidth: true,
456 dropdownAutoWidth: true,
458 minimumResultsForSearch: -1
457 minimumResultsForSearch: -1
459 });
458 });
460 $(this.submitForm).find(this.statusChange).on('change', function() {
459 $(this.submitForm).find(this.statusChange).on('change', function() {
461 var status = self.getCommentStatus();
460 var status = self.getCommentStatus();
462 if (status && !self.lineNo) {
461 if (status && !self.lineNo) {
463 $(self.submitButton).prop('disabled', false);
462 $(self.submitButton).prop('disabled', false);
464 }
463 }
465 //todo, fix this name
464 //todo, fix this name
466 var placeholderText = _gettext('Comment text will be set automatically based on currently selected status ({0}) ...').format(status);
465 var placeholderText = _gettext('Comment text will be set automatically based on currently selected status ({0}) ...').format(status);
467 self.cm.setOption('placeholder', placeholderText);
466 self.cm.setOption('placeholder', placeholderText);
468 })
467 })
469 };
468 };
470
469
471 // reset the comment form into it's original state
470 // reset the comment form into it's original state
472 this.resetCommentFormState = function(content) {
471 this.resetCommentFormState = function(content) {
473 content = content || '';
472 content = content || '';
474
473
475 $(this.editContainer).show();
474 $(this.editContainer).show();
476 $(this.editButton).hide();
475 $(this.editButton).hide();
477
476
478 $(this.previewContainer).hide();
477 $(this.previewContainer).hide();
479 $(this.previewButton).show();
478 $(this.previewButton).show();
480
479
481 this.setActionButtonsDisabled(true);
480 this.setActionButtonsDisabled(true);
482 self.cm.setValue(content);
481 self.cm.setValue(content);
483 self.cm.setOption("readOnly", false);
482 self.cm.setOption("readOnly", false);
484 };
483 };
485
484
486 this.submitAjaxPOST = function(url, postData, successHandler, failHandler) {
485 this.submitAjaxPOST = function(url, postData, successHandler, failHandler) {
487 failHandler = failHandler || function() {};
486 failHandler = failHandler || function() {};
488 var postData = toQueryString(postData);
487 var postData = toQueryString(postData);
489 var request = $.ajax({
488 var request = $.ajax({
490 url: url,
489 url: url,
491 type: 'POST',
490 type: 'POST',
492 data: postData,
491 data: postData,
493 headers: {'X-PARTIAL-XHR': true}
492 headers: {'X-PARTIAL-XHR': true}
494 })
493 })
495 .done(function(data) {
494 .done(function(data) {
496 successHandler(data);
495 successHandler(data);
497 })
496 })
498 .fail(function(data, textStatus, errorThrown){
497 .fail(function(data, textStatus, errorThrown){
499 alert(
498 alert(
500 "Error while submitting comment.\n" +
499 "Error while submitting comment.\n" +
501 "Error code {0} ({1}).".format(data.status, data.statusText));
500 "Error code {0} ({1}).".format(data.status, data.statusText));
502 failHandler()
501 failHandler()
503 });
502 });
504 return request;
503 return request;
505 };
504 };
506
505
507 // overwrite a submitHandler, we need to do it for inline comments
506 // overwrite a submitHandler, we need to do it for inline comments
508 this.setHandleFormSubmit = function(callback) {
507 this.setHandleFormSubmit = function(callback) {
509 this.handleFormSubmit = callback;
508 this.handleFormSubmit = callback;
510 };
509 };
511
510
512 // default handler for for submit for main comments
511 // default handler for for submit for main comments
513 this.handleFormSubmit = function() {
512 this.handleFormSubmit = function() {
514 var text = self.cm.getValue();
513 var text = self.cm.getValue();
515 var status = self.getCommentStatus();
514 var status = self.getCommentStatus();
516
515
517 if (text === "" && !status) {
516 if (text === "" && !status) {
518 return;
517 return;
519 }
518 }
520
519
521 var excludeCancelBtn = false;
520 var excludeCancelBtn = false;
522 var submitEvent = true;
521 var submitEvent = true;
523 self.setActionButtonsDisabled(true, excludeCancelBtn, submitEvent);
522 self.setActionButtonsDisabled(true, excludeCancelBtn, submitEvent);
524 self.cm.setOption("readOnly", true);
523 self.cm.setOption("readOnly", true);
525 var postData = {
524 var postData = {
526 'text': text,
525 'text': text,
527 'changeset_status': status,
526 'changeset_status': status,
528 'csrf_token': CSRF_TOKEN
527 'csrf_token': CSRF_TOKEN
529 };
528 };
530
529
531 var submitSuccessCallback = function(o) {
530 var submitSuccessCallback = function(o) {
532 if (status) {
531 if (status) {
533 location.reload(true);
532 location.reload(true);
534 } else {
533 } else {
535 $('#injected_page_comments').append(o.rendered_text);
534 $('#injected_page_comments').append(o.rendered_text);
536 self.resetCommentFormState();
535 self.resetCommentFormState();
537 bindDeleteCommentButtons();
536 bindDeleteCommentButtons();
538 timeagoActivate();
537 timeagoActivate();
539 tooltip_activate();
540 }
538 }
541 };
539 };
542 var submitFailCallback = function(){
540 var submitFailCallback = function(){
543 self.resetCommentFormState(text)
541 self.resetCommentFormState(text)
544 };
542 };
545 self.submitAjaxPOST(
543 self.submitAjaxPOST(
546 self.submitUrl, postData, submitSuccessCallback, submitFailCallback);
544 self.submitUrl, postData, submitSuccessCallback, submitFailCallback);
547 };
545 };
548
546
549 this.previewSuccessCallback = function(o) {
547 this.previewSuccessCallback = function(o) {
550 $(self.previewBoxSelector).html(o);
548 $(self.previewBoxSelector).html(o);
551 $(self.previewBoxSelector).removeClass('unloaded');
549 $(self.previewBoxSelector).removeClass('unloaded');
552
550
553 // swap buttons
551 // swap buttons
554 $(self.previewButton).hide();
552 $(self.previewButton).hide();
555 $(self.editButton).show();
553 $(self.editButton).show();
556
554
557 // unlock buttons
555 // unlock buttons
558 self.setActionButtonsDisabled(false);
556 self.setActionButtonsDisabled(false);
559 };
557 };
560
558
561 this.setActionButtonsDisabled = function(state, excludeCancelBtn, submitEvent) {
559 this.setActionButtonsDisabled = function(state, excludeCancelBtn, submitEvent) {
562 excludeCancelBtn = excludeCancelBtn || false;
560 excludeCancelBtn = excludeCancelBtn || false;
563 submitEvent = submitEvent || false;
561 submitEvent = submitEvent || false;
564
562
565 $(this.editButton).prop('disabled', state);
563 $(this.editButton).prop('disabled', state);
566 $(this.previewButton).prop('disabled', state);
564 $(this.previewButton).prop('disabled', state);
567
565
568 if (!excludeCancelBtn) {
566 if (!excludeCancelBtn) {
569 $(this.cancelButton).prop('disabled', state);
567 $(this.cancelButton).prop('disabled', state);
570 }
568 }
571
569
572 var submitState = state;
570 var submitState = state;
573 if (!submitEvent && this.getCommentStatus() && !this.lineNo) {
571 if (!submitEvent && this.getCommentStatus() && !this.lineNo) {
574 // if the value of commit review status is set, we allow
572 // if the value of commit review status is set, we allow
575 // submit button, but only on Main form, lineNo means inline
573 // submit button, but only on Main form, lineNo means inline
576 submitState = false
574 submitState = false
577 }
575 }
578 $(this.submitButton).prop('disabled', submitState);
576 $(this.submitButton).prop('disabled', submitState);
579 if (submitEvent) {
577 if (submitEvent) {
580 $(this.submitButton).val(_gettext('Submitting...'));
578 $(this.submitButton).val(_gettext('Submitting...'));
581 } else {
579 } else {
582 $(this.submitButton).val(this.submitButtonText);
580 $(this.submitButton).val(this.submitButtonText);
583 }
581 }
584
582
585 };
583 };
586
584
587 // lock preview/edit/submit buttons on load, but exclude cancel button
585 // lock preview/edit/submit buttons on load, but exclude cancel button
588 var excludeCancelBtn = true;
586 var excludeCancelBtn = true;
589 this.setActionButtonsDisabled(true, excludeCancelBtn);
587 this.setActionButtonsDisabled(true, excludeCancelBtn);
590
588
591 // anonymous users don't have access to initialized CM instance
589 // anonymous users don't have access to initialized CM instance
592 if (this.cm !== undefined){
590 if (this.cm !== undefined){
593 this.cm.on('change', function(cMirror) {
591 this.cm.on('change', function(cMirror) {
594 if (cMirror.getValue() === "") {
592 if (cMirror.getValue() === "") {
595 self.setActionButtonsDisabled(true, excludeCancelBtn)
593 self.setActionButtonsDisabled(true, excludeCancelBtn)
596 } else {
594 } else {
597 self.setActionButtonsDisabled(false, excludeCancelBtn)
595 self.setActionButtonsDisabled(false, excludeCancelBtn)
598 }
596 }
599 });
597 });
600 }
598 }
601
599
602 $(this.editButton).on('click', function(e) {
600 $(this.editButton).on('click', function(e) {
603 e.preventDefault();
601 e.preventDefault();
604
602
605 $(self.previewButton).show();
603 $(self.previewButton).show();
606 $(self.previewContainer).hide();
604 $(self.previewContainer).hide();
607 $(self.editButton).hide();
605 $(self.editButton).hide();
608 $(self.editContainer).show();
606 $(self.editContainer).show();
609
607
610 });
608 });
611
609
612 $(this.previewButton).on('click', function(e) {
610 $(this.previewButton).on('click', function(e) {
613 e.preventDefault();
611 e.preventDefault();
614 var text = self.cm.getValue();
612 var text = self.cm.getValue();
615
613
616 if (text === "") {
614 if (text === "") {
617 return;
615 return;
618 }
616 }
619
617
620 var postData = {
618 var postData = {
621 'text': text,
619 'text': text,
622 'renderer': DEFAULT_RENDERER,
620 'renderer': DEFAULT_RENDERER,
623 'csrf_token': CSRF_TOKEN
621 'csrf_token': CSRF_TOKEN
624 };
622 };
625
623
626 // lock ALL buttons on preview
624 // lock ALL buttons on preview
627 self.setActionButtonsDisabled(true);
625 self.setActionButtonsDisabled(true);
628
626
629 $(self.previewBoxSelector).addClass('unloaded');
627 $(self.previewBoxSelector).addClass('unloaded');
630 $(self.previewBoxSelector).html(_gettext('Loading ...'));
628 $(self.previewBoxSelector).html(_gettext('Loading ...'));
631 $(self.editContainer).hide();
629 $(self.editContainer).hide();
632 $(self.previewContainer).show();
630 $(self.previewContainer).show();
633
631
634 // by default we reset state of comment preserving the text
632 // by default we reset state of comment preserving the text
635 var previewFailCallback = function(){
633 var previewFailCallback = function(){
636 self.resetCommentFormState(text)
634 self.resetCommentFormState(text)
637 };
635 };
638 self.submitAjaxPOST(
636 self.submitAjaxPOST(
639 self.previewUrl, postData, self.previewSuccessCallback, previewFailCallback);
637 self.previewUrl, postData, self.previewSuccessCallback, previewFailCallback);
640
638
641 });
639 });
642
640
643 $(this.submitForm).submit(function(e) {
641 $(this.submitForm).submit(function(e) {
644 e.preventDefault();
642 e.preventDefault();
645 var allowedToSubmit = self.isAllowedToSubmit();
643 var allowedToSubmit = self.isAllowedToSubmit();
646 if (!allowedToSubmit){
644 if (!allowedToSubmit){
647 return false;
645 return false;
648 }
646 }
649 self.handleFormSubmit();
647 self.handleFormSubmit();
650 });
648 });
651
649
652 }
650 }
653
651
654 return CommentForm;
652 return CommentForm;
655 })();
653 })();
@@ -1,103 +1,94 b''
1 // # Copyright (C) 2010-2016 RhodeCode GmbH
1 // # Copyright (C) 2010-2016 RhodeCode GmbH
2 // #
2 // #
3 // # This program is free software: you can redistribute it and/or modify
3 // # This program is free software: you can redistribute it and/or modify
4 // # it under the terms of the GNU Affero General Public License, version 3
4 // # it under the terms of the GNU Affero General Public License, version 3
5 // # (only), as published by the Free Software Foundation.
5 // # (only), as published by the Free Software Foundation.
6 // #
6 // #
7 // # This program is distributed in the hope that it will be useful,
7 // # This program is distributed in the hope that it will be useful,
8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // # GNU General Public License for more details.
10 // # GNU General Public License for more details.
11 // #
11 // #
12 // # You should have received a copy of the GNU Affero General Public License
12 // # You should have received a copy of the GNU Affero General Public License
13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 // #
14 // #
15 // # This program is dual-licensed. If you wish to learn more about the
15 // # This program is dual-licensed. If you wish to learn more about the
16 // # RhodeCode Enterprise Edition, including its added features, Support services,
16 // # RhodeCode Enterprise Edition, including its added features, Support services,
17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 /**
19 /**
20 * TOOLTIP IMPL.
20 * TOOLTIP IMPL.
21 */
21 */
22
22
23 var TTIP = {};
23 var TTIP = {};
24
24
25 TTIP.main = {
25 TTIP.main = {
26 offset: [15,15],
26 offset: [15,15],
27 maxWidth: 600,
27 maxWidth: 600,
28
28
29 setDeferredListeners: function(){
29 setDeferredListeners: function(){
30 $('body').on('mouseover', '.tooltip', yt.show_tip);
30 $('body').on('mouseover', '.tooltip', yt.show_tip);
31 $('body').on('mousemove', '.tooltip', yt.move_tip);
31 $('body').on('mousemove', '.tooltip', yt.move_tip);
32 $('body').on('mouseout', '.tooltip', yt.close_tip);
32 $('body').on('mouseout', '.tooltip', yt.close_tip);
33 },
33 },
34
34
35 init: function(){
35 init: function(){
36 $('#tip-box').remove();
36 $('#tip-box').remove();
37 yt.tipBox = document.createElement('div');
37 yt.tipBox = document.createElement('div');
38 document.body.appendChild(yt.tipBox);
38 document.body.appendChild(yt.tipBox);
39 yt.tipBox.id = 'tip-box';
39 yt.tipBox.id = 'tip-box';
40
40
41 $(yt.tipBox).hide();
41 $(yt.tipBox).hide();
42 $(yt.tipBox).css('position', 'absolute');
42 $(yt.tipBox).css('position', 'absolute');
43 if(yt.maxWidth !== null){
43 if(yt.maxWidth !== null){
44 $(yt.tipBox).css('max-width', yt.maxWidth+'px');
44 $(yt.tipBox).css('max-width', yt.maxWidth+'px');
45 }
45 }
46 yt.setDeferredListeners();
46 yt.setDeferredListeners();
47 },
47 },
48
48
49 show_tip: function(e, el){
49 show_tip: function(e, el){
50 e.stopPropagation();
50 e.stopPropagation();
51 e.preventDefault();
51 e.preventDefault();
52 var el = e.data || e.currentTarget || el;
52 var el = e.data || e.currentTarget || el;
53 if(el.tagName.toLowerCase() === 'img'){
53 if(el.tagName.toLowerCase() === 'img'){
54 yt.tipText = el.alt ? el.alt : '';
54 yt.tipText = el.alt ? el.alt : '';
55 } else {
55 } else {
56 yt.tipText = el.title ? el.title : '';
56 yt.tipText = el.title ? el.title : '';
57 }
57 }
58
58
59 if(yt.tipText !== ''){
59 if(yt.tipText !== ''){
60 // save org title
60 // save org title
61 $(el).attr('tt_title', yt.tipText);
61 $(el).attr('tt_title', yt.tipText);
62 // reset title to not show org tooltips
62 // reset title to not show org tooltips
63 $(el).attr('title', '');
63 $(el).attr('title', '');
64
64
65 yt.tipBox.innerHTML = yt.tipText;
65 yt.tipBox.innerHTML = yt.tipText;
66 $(yt.tipBox).show();
66 $(yt.tipBox).show();
67 }
67 }
68 },
68 },
69
69
70 move_tip: function(e, el){
70 move_tip: function(e, el){
71 e.stopPropagation();
71 e.stopPropagation();
72 e.preventDefault();
72 e.preventDefault();
73 var el = e.data || e.currentTarget || el;
73 var el = e.data || e.currentTarget || el;
74 var movePos = [e.pageX, e.pageY];
74 var movePos = [e.pageX, e.pageY];
75 $(yt.tipBox).css('top', (movePos[1] + yt.offset[1]) + 'px')
75 $(yt.tipBox).css('top', (movePos[1] + yt.offset[1]) + 'px')
76 $(yt.tipBox).css('left', (movePos[0] + yt.offset[0]) + 'px')
76 $(yt.tipBox).css('left', (movePos[0] + yt.offset[0]) + 'px')
77 },
77 },
78
78
79 close_tip: function(e, el){
79 close_tip: function(e, el){
80 e.stopPropagation();
80 e.stopPropagation();
81 e.preventDefault();
81 e.preventDefault();
82 var el = e.data || e.currentTarget || el;
82 var el = e.data || e.currentTarget || el;
83 $(yt.tipBox).hide();
83 $(yt.tipBox).hide();
84 $(el).attr('title', $(el).attr('tt_title'));
84 $(el).attr('title', $(el).attr('tt_title'));
85 $('#tip-box').hide();
85 $('#tip-box').hide();
86 }
86 }
87 };
87 };
88
88
89 /**
89 // activate tooltips
90 * tooltip activate
90 yt = TTIP.main;
91 */
91 if ($(document).data('activated-tooltips') !== '1'){
92 var tooltip_activate = function(){
92 $(document).ready(yt.init);
93 yt = TTIP.main;
93 $(document).data('activated-tooltips', '1');
94 if ($(document).data('activated-tooltips') !== '1'){
94 }
95 $(document).ready(yt.init);
96 $(document).data('activated-tooltips', '1');
97 }
98 };
99
100 /**
101 * show changeset tooltip
102 */
103 var show_changeset_tooltip = function(){};
@@ -1,60 +1,58 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 %if c.users_log:
2 %if c.users_log:
3 <table class="rctable admin_log">
3 <table class="rctable admin_log">
4 <tr>
4 <tr>
5 <th>${_('Username')}</th>
5 <th>${_('Username')}</th>
6 <th>${_('Action')}</th>
6 <th>${_('Action')}</th>
7 <th>${_('Repository')}</th>
7 <th>${_('Repository')}</th>
8 <th>${_('Date')}</th>
8 <th>${_('Date')}</th>
9 <th>${_('From IP')}</th>
9 <th>${_('From IP')}</th>
10 </tr>
10 </tr>
11
11
12 %for cnt,l in enumerate(c.users_log):
12 %for cnt,l in enumerate(c.users_log):
13 <tr class="parity${cnt%2}">
13 <tr class="parity${cnt%2}">
14 <td class="td-user">
14 <td class="td-user">
15 %if l.user is not None:
15 %if l.user is not None:
16 ${h.link_to(l.user.username,h.url('edit_user', user_id=l.user.user_id))}
16 ${h.link_to(l.user.username,h.url('edit_user', user_id=l.user.user_id))}
17 %else:
17 %else:
18 ${l.username}
18 ${l.username}
19 %endif
19 %endif
20 </td>
20 </td>
21 <td class="td-journalaction">${h.action_parser(l)[0]()}
21 <td class="td-journalaction">${h.action_parser(l)[0]()}
22 <div class="journal_action_params">
22 <div class="journal_action_params">
23 ${h.literal(h.action_parser(l)[1]())}
23 ${h.literal(h.action_parser(l)[1]())}
24 </div>
24 </div>
25 </td>
25 </td>
26 <td class="td-componentname">
26 <td class="td-componentname">
27 %if l.repository is not None:
27 %if l.repository is not None:
28 ${h.link_to(l.repository.repo_name,h.url('summary_home',repo_name=l.repository.repo_name))}
28 ${h.link_to(l.repository.repo_name,h.url('summary_home',repo_name=l.repository.repo_name))}
29 %else:
29 %else:
30 ${l.repository_name}
30 ${l.repository_name}
31 %endif
31 %endif
32 </td>
32 </td>
33
33
34 <td class="td-time">${h.format_date(l.action_date)}</td>
34 <td class="td-time">${h.format_date(l.action_date)}</td>
35 <td class="td-ip">${l.user_ip}</td>
35 <td class="td-ip">${l.user_ip}</td>
36 </tr>
36 </tr>
37 %endfor
37 %endfor
38 </table>
38 </table>
39
39
40 <div class="pagination-wh pagination-left">
40 <div class="pagination-wh pagination-left">
41 ${c.users_log.pager('$link_previous ~2~ $link_next')}
41 ${c.users_log.pager('$link_previous ~2~ $link_next')}
42 </div>
42 </div>
43 %else:
43 %else:
44 ${_('No actions yet')}
44 ${_('No actions yet')}
45 %endif
45 %endif
46
46
47 <script type="text/javascript">
47 <script type="text/javascript">
48 $(function(){
48 $(function(){
49 //because this is loaded on every pjax request, it must run only once
49 //because this is loaded on every pjax request, it must run only once
50 //therefore the .one method
50 //therefore the .one method
51 $(document).on('pjax:complete',function(){
51 $(document).on('pjax:complete',function(){
52 show_more_event();
52 show_more_event();
53 tooltip_activate();
54 show_changeset_tooltip();
55 });
53 });
56
54
57 $(document).pjax('#user_log .pager_link', '#user_log');
55 $(document).pjax('#user_log .pager_link', '#user_log');
58 });
56 });
59 </script>
57 </script>
60
58
@@ -1,151 +1,149 b''
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 %if c.show_private:
5 %if c.show_private:
6 ${_('Private Gists for user %s') % c.rhodecode_user.username}
6 ${_('Private Gists for user %s') % c.rhodecode_user.username}
7 %elif c.show_public:
7 %elif c.show_public:
8 ${_('Public Gists for user %s') % c.rhodecode_user.username}
8 ${_('Public Gists for user %s') % c.rhodecode_user.username}
9 %else:
9 %else:
10 ${_('Public Gists')}
10 ${_('Public Gists')}
11 %endif
11 %endif
12 %if c.rhodecode_name:
12 %if c.rhodecode_name:
13 &middot; ${h.branding(c.rhodecode_name)}
13 &middot; ${h.branding(c.rhodecode_name)}
14 %endif
14 %endif
15 </%def>
15 </%def>
16
16
17 <%def name="breadcrumbs_links()">
17 <%def name="breadcrumbs_links()">
18 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
18 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
19 %if c.show_private and not c.show_public:
19 %if c.show_private and not c.show_public:
20 ${_('Private Gists for user %s') % c.rhodecode_user.username}
20 ${_('Private Gists for user %s') % c.rhodecode_user.username}
21 %elif c.show_public and not c.show_private:
21 %elif c.show_public and not c.show_private:
22 ${_('Public Gists for user %s') % c.rhodecode_user.username}
22 ${_('Public Gists for user %s') % c.rhodecode_user.username}
23 %elif c.show_public and c.show_private:
23 %elif c.show_public and c.show_private:
24 ${_('All Gists for user %s') % c.rhodecode_user.username}
24 ${_('All Gists for user %s') % c.rhodecode_user.username}
25 %else:
25 %else:
26 ${_('All Public Gists')}
26 ${_('All Public Gists')}
27 %endif
27 %endif
28 - <span id="gists_count">0</span>
28 - <span id="gists_count">0</span>
29 </%def>
29 </%def>
30
30
31 <%def name="menu_bar_nav()">
31 <%def name="menu_bar_nav()">
32 ${self.menu_items(active='gists')}
32 ${self.menu_items(active='gists')}
33 </%def>
33 </%def>
34
34
35
35
36
36
37 <%def name="main()">
37 <%def name="main()">
38 <div class="box">
38 <div class="box">
39 <div class="title">
39 <div class="title">
40 ${self.breadcrumbs(class_="breadcrumbs block-left")}
40 ${self.breadcrumbs(class_="breadcrumbs block-left")}
41 %if c.rhodecode_user.username != h.DEFAULT_USER:
41 %if c.rhodecode_user.username != h.DEFAULT_USER:
42 <ul class="links block-right">
42 <ul class="links block-right">
43 <li>
43 <li>
44 <a href="${h.url('new_gist')}" class="btn btn-primary">${_(u'Create New Gist')}</a>
44 <a href="${h.url('new_gist')}" class="btn btn-primary">${_(u'Create New Gist')}</a>
45 </li>
45 </li>
46 </ul>
46 </ul>
47 %endif
47 %endif
48 </div>
48 </div>
49
49
50
50
51 <div class="sidebar-col-wrapper scw-small">
51 <div class="sidebar-col-wrapper scw-small">
52 ##main
52 ##main
53 <div class="sidebar">
53 <div class="sidebar">
54 <ul class="nav nav-pills nav-stacked">
54 <ul class="nav nav-pills nav-stacked">
55 % if h.HasPermissionAll('hg.admin')('access admin gists page'):
55 % if h.HasPermissionAll('hg.admin')('access admin gists page'):
56 <li class="${'active' if c.active=='all' else ''}"><a href="${h.url('gists', all=1)}">${_('All gists')}</a></li>
56 <li class="${'active' if c.active=='all' else ''}"><a href="${h.url('gists', all=1)}">${_('All gists')}</a></li>
57 %endif
57 %endif
58 <li class="${'active' if c.active=='public' else ''}"><a href="${h.url('gists')}">${_('All public')}</a></li>
58 <li class="${'active' if c.active=='public' else ''}"><a href="${h.url('gists')}">${_('All public')}</a></li>
59 %if c.rhodecode_user.username != h.DEFAULT_USER:
59 %if c.rhodecode_user.username != h.DEFAULT_USER:
60 <li class="${'active' if c.active=='my_all' else ''}"><a href="${h.url('gists', public=1, private=1)}">${_('My gists')}</a></li>
60 <li class="${'active' if c.active=='my_all' else ''}"><a href="${h.url('gists', public=1, private=1)}">${_('My gists')}</a></li>
61 <li class="${'active' if c.active=='my_private' else ''}"><a href="${h.url('gists', private=1)}">${_('My private')}</a></li>
61 <li class="${'active' if c.active=='my_private' else ''}"><a href="${h.url('gists', private=1)}">${_('My private')}</a></li>
62 <li class="${'active' if c.active=='my_public' else ''}"><a href="${h.url('gists', public=1)}">${_('My public')}</a></li>
62 <li class="${'active' if c.active=='my_public' else ''}"><a href="${h.url('gists', public=1)}">${_('My public')}</a></li>
63 %endif
63 %endif
64 </ul>
64 </ul>
65 </div>
65 </div>
66
66
67 <div class="main-content">
67 <div class="main-content">
68 <div id="repos_list_wrap">
68 <div id="repos_list_wrap">
69 <table id="gist_list_table" class="display"></table>
69 <table id="gist_list_table" class="display"></table>
70 </div>
70 </div>
71 </div>
71 </div>
72 </div>
72 </div>
73 </div>
73 </div>
74 <script>
74 <script>
75 $(document).ready(function() {
75 $(document).ready(function() {
76
76
77 var get_datatable_count = function(){
77 var get_datatable_count = function(){
78 var api = $('#gist_list_table').dataTable().api();
78 var api = $('#gist_list_table').dataTable().api();
79 $('#gists_count').text(api.page.info().recordsDisplay);
79 $('#gists_count').text(api.page.info().recordsDisplay);
80 };
80 };
81
81
82
82
83 // custom filter that filters by access_id, description or author
83 // custom filter that filters by access_id, description or author
84 $.fn.dataTable.ext.search.push(
84 $.fn.dataTable.ext.search.push(
85 function( settings, data, dataIndex ) {
85 function( settings, data, dataIndex ) {
86 var query = $('#q_filter').val();
86 var query = $('#q_filter').val();
87 var author = data[0].strip();
87 var author = data[0].strip();
88 var access_id = data[2].strip();
88 var access_id = data[2].strip();
89 var description = data[3].strip();
89 var description = data[3].strip();
90
90
91 var query_str = (access_id + " " + author + " " + description).toLowerCase();
91 var query_str = (access_id + " " + author + " " + description).toLowerCase();
92
92
93 if(query_str.indexOf(query.toLowerCase()) !== -1){
93 if(query_str.indexOf(query.toLowerCase()) !== -1){
94 return true;
94 return true;
95 }
95 }
96 return false;
96 return false;
97 }
97 }
98 );
98 );
99
99
100 // gists list
100 // gists list
101 $('#gist_list_table').DataTable({
101 $('#gist_list_table').DataTable({
102 data: ${c.data|n},
102 data: ${c.data|n},
103 dom: 'rtp',
103 dom: 'rtp',
104 pageLength: ${c.visual.dashboard_items},
104 pageLength: ${c.visual.dashboard_items},
105 order: [[ 4, "desc" ]],
105 order: [[ 4, "desc" ]],
106 columns: [
106 columns: [
107 { data: {"_": "author",
107 { data: {"_": "author",
108 "sort": "author_raw"}, title: "${_("Author")}", width: "250px", className: "td-user" },
108 "sort": "author_raw"}, title: "${_("Author")}", width: "250px", className: "td-user" },
109 { data: {"_": "type",
109 { data: {"_": "type",
110 "sort": "type"}, title: "${_("Type")}", width: "70px", className: "td-tags" },
110 "sort": "type"}, title: "${_("Type")}", width: "70px", className: "td-tags" },
111 { data: {"_": "access_id",
111 { data: {"_": "access_id",
112 "sort": "access_id"}, title: "${_("Name")}", width:"150px", className: "td-componentname" },
112 "sort": "access_id"}, title: "${_("Name")}", width:"150px", className: "td-componentname" },
113 { data: {"_": "description",
113 { data: {"_": "description",
114 "sort": "description"}, title: "${_("Description")}", width: "250px", className: "td-description" },
114 "sort": "description"}, title: "${_("Description")}", width: "250px", className: "td-description" },
115 { data: {"_": "created_on",
115 { data: {"_": "created_on",
116 "sort": "created_on_raw"}, title: "${_("Created on")}", className: "td-time" },
116 "sort": "created_on_raw"}, title: "${_("Created on")}", className: "td-time" },
117 { data: {"_": "expires",
117 { data: {"_": "expires",
118 "sort": "expires"}, title: "${_("Expires")}", className: "td-exp" }
118 "sort": "expires"}, title: "${_("Expires")}", className: "td-exp" }
119 ],
119 ],
120 language: {
120 language: {
121 paginate: DEFAULT_GRID_PAGINATION
121 paginate: DEFAULT_GRID_PAGINATION
122 },
122 },
123 "initComplete": function( settings, json ) {
123 "initComplete": function( settings, json ) {
124 timeagoActivate();
124 timeagoActivate();
125 tooltip_activate();
126 get_datatable_count();
125 get_datatable_count();
127 }
126 }
128 });
127 });
129
128
130 // update the counter when things change
129 // update the counter when things change
131 $('#gist_list_table').on('draw.dt', function() {
130 $('#gist_list_table').on('draw.dt', function() {
132 timeagoActivate();
131 timeagoActivate();
133 tooltip_activate();
134 get_datatable_count();
132 get_datatable_count();
135 });
133 });
136
134
137 // filter, filter both grids
135 // filter, filter both grids
138 $('#q_filter').on( 'keyup', function () {
136 $('#q_filter').on( 'keyup', function () {
139 var repo_api = $('#gist_list_table').dataTable().api();
137 var repo_api = $('#gist_list_table').dataTable().api();
140 repo_api
138 repo_api
141 .draw();
139 .draw();
142 });
140 });
143
141
144 // refilter table if page load via back button
142 // refilter table if page load via back button
145 $("#q_filter").trigger('keyup');
143 $("#q_filter").trigger('keyup');
146
144
147 });
145 });
148
146
149 </script>
147 </script>
150 </%def>
148 </%def>
151
149
@@ -1,68 +1,67 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Repositories You Own')}</h3>
3 <h3 class="panel-title">${_('Repositories You Own')}</h3>
4 </div>
4 </div>
5
5
6 <div class="panel-body">
6 <div class="panel-body">
7 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
7 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
8
8
9 <div id="repos_list_wrap">
9 <div id="repos_list_wrap">
10 <table id="repo_list_table" class="display"></table>
10 <table id="repo_list_table" class="display"></table>
11 </div>
11 </div>
12 </div>
12 </div>
13 </div>
13 </div>
14
14
15 <script>
15 <script>
16 $(document).ready(function() {
16 $(document).ready(function() {
17
17
18 var get_datatable_count = function(){
18 var get_datatable_count = function(){
19 var api = $('#repo_list_table').dataTable().api();
19 var api = $('#repo_list_table').dataTable().api();
20 $('#repo_count').text(api.page.info().recordsDisplay);
20 $('#repo_count').text(api.page.info().recordsDisplay);
21 };
21 };
22
22
23 // repo list
23 // repo list
24 $('#repo_list_table').DataTable({
24 $('#repo_list_table').DataTable({
25 data: ${c.data|n},
25 data: ${c.data|n},
26 dom: 'rtp',
26 dom: 'rtp',
27 pageLength: ${c.visual.admin_grid_items},
27 pageLength: ${c.visual.admin_grid_items},
28 order: [[ 0, "asc" ]],
28 order: [[ 0, "asc" ]],
29 columns: [
29 columns: [
30 { data: {"_": "name",
30 { data: {"_": "name",
31 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
31 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
32 { data: 'menu', className: "quick_repo_menu" },
32 { data: 'menu', className: "quick_repo_menu" },
33 { data: {"_": "last_changeset",
33 { data: {"_": "last_changeset",
34 "sort": "last_changeset_raw",
34 "sort": "last_changeset_raw",
35 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
35 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
36 { data: {"_": "action",
36 { data: {"_": "action",
37 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
37 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
38 ],
38 ],
39 language: {
39 language: {
40 paginate: DEFAULT_GRID_PAGINATION
40 paginate: DEFAULT_GRID_PAGINATION
41 },
41 },
42 "initComplete": function( settings, json ) {
42 "initComplete": function( settings, json ) {
43 get_datatable_count();
43 get_datatable_count();
44 tooltip_activate();
45 quick_repo_menu();
44 quick_repo_menu();
46 }
45 }
47 });
46 });
48
47
49 // update the counter when doing search
48 // update the counter when doing search
50 $('#repo_list_table').on( 'search.dt', function (e,settings) {
49 $('#repo_list_table').on( 'search.dt', function (e,settings) {
51 get_datatable_count();
50 get_datatable_count();
52 });
51 });
53
52
54 // filter, filter both grids
53 // filter, filter both grids
55 $('#q_filter').on( 'keyup', function () {
54 $('#q_filter').on( 'keyup', function () {
56 var repo_api = $('#repo_list_table').dataTable().api();
55 var repo_api = $('#repo_list_table').dataTable().api();
57 repo_api
56 repo_api
58 .columns(0)
57 .columns(0)
59 .search(this.value)
58 .search(this.value)
60 .draw();
59 .draw();
61 });
60 });
62
61
63 // refilter table if page load via back button
62 // refilter table if page load via back button
64 $("#q_filter").trigger('keyup');
63 $("#q_filter").trigger('keyup');
65
64
66 });
65 });
67
66
68 </script>
67 </script>
@@ -1,66 +1,65 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Your Watched Repositories')}</h3>
3 <h3 class="panel-title">${_('Your Watched Repositories')}</h3>
4 </div>
4 </div>
5
5
6 <div class="panel-body">
6 <div class="panel-body">
7 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
7 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
8
8
9 <div id="repos_list_wrap">
9 <div id="repos_list_wrap">
10 <table id="repo_list_table" class="display"></table>
10 <table id="repo_list_table" class="display"></table>
11 </div>
11 </div>
12 </div>
12 </div>
13 </div>
13 </div>
14
14
15 <script>
15 <script>
16 $(document).ready(function() {
16 $(document).ready(function() {
17
17
18 var get_datatable_count = function(){
18 var get_datatable_count = function(){
19 var api = $('#repo_list_table').dataTable().api();
19 var api = $('#repo_list_table').dataTable().api();
20 $('#repo_count').text(api.page.info().recordsDisplay);
20 $('#repo_count').text(api.page.info().recordsDisplay);
21 };
21 };
22
22
23 // repo list
23 // repo list
24 $('#repo_list_table').DataTable({
24 $('#repo_list_table').DataTable({
25 data: ${c.data|n},
25 data: ${c.data|n},
26 dom: 'rtp',
26 dom: 'rtp',
27 pageLength: ${c.visual.admin_grid_items},
27 pageLength: ${c.visual.admin_grid_items},
28 order: [[ 0, "asc" ]],
28 order: [[ 0, "asc" ]],
29 columns: [
29 columns: [
30 { data: {"_": "name",
30 { data: {"_": "name",
31 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
31 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
32 { data: 'menu', className: "quick_repo_menu" },
32 { data: 'menu', className: "quick_repo_menu" },
33 { data: {"_": "last_changeset",
33 { data: {"_": "last_changeset",
34 "sort": "last_changeset_raw",
34 "sort": "last_changeset_raw",
35 "type": Number}, title: "${_('Commit')}", className: "td-hash" }
35 "type": Number}, title: "${_('Commit')}", className: "td-hash" }
36 ],
36 ],
37 language: {
37 language: {
38 paginate: DEFAULT_GRID_PAGINATION
38 paginate: DEFAULT_GRID_PAGINATION
39 },
39 },
40 "initComplete": function( settings, json ) {
40 "initComplete": function( settings, json ) {
41 get_datatable_count();
41 get_datatable_count();
42 tooltip_activate();
43 quick_repo_menu();
42 quick_repo_menu();
44 }
43 }
45 });
44 });
46
45
47 // update the counter when doing search
46 // update the counter when doing search
48 $('#repo_list_table').on( 'search.dt', function (e,settings) {
47 $('#repo_list_table').on( 'search.dt', function (e,settings) {
49 get_datatable_count();
48 get_datatable_count();
50 });
49 });
51
50
52 // filter, filter both grids
51 // filter, filter both grids
53 $('#q_filter').on( 'keyup', function () {
52 $('#q_filter').on( 'keyup', function () {
54 var repo_api = $('#repo_list_table').dataTable().api();
53 var repo_api = $('#repo_list_table').dataTable().api();
55 repo_api
54 repo_api
56 .columns(0)
55 .columns(0)
57 .search(this.value)
56 .search(this.value)
58 .draw();
57 .draw();
59 });
58 });
60
59
61 // refilter table if page load via back button
60 // refilter table if page load via back button
62 $("#q_filter").trigger('keyup');
61 $("#q_filter").trigger('keyup');
63
62
64 });
63 });
65
64
66 </script>
65 </script>
@@ -1,94 +1,93 b''
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 ${_('Repository groups administration')}
5 ${_('Repository groups administration')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="repo_group_count">0</span> ${_('repository groups')}
13 ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="repo_group_count">0</span> ${_('repository groups')}
14 </%def>
14 </%def>
15
15
16 <%def name="menu_bar_nav()">
16 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='admin')}
17 ${self.menu_items(active='admin')}
18 </%def>
18 </%def>
19
19
20 <%def name="main()">
20 <%def name="main()">
21 <div class="box">
21 <div class="box">
22 <div class="title">
22 <div class="title">
23 ${self.breadcrumbs()}
23 ${self.breadcrumbs()}
24 <ul class="links">
24 <ul class="links">
25 %if h.HasPermissionAny('hg.admin','hg.repogroup.create.true')():
25 %if h.HasPermissionAny('hg.admin','hg.repogroup.create.true')():
26 <li>
26 <li>
27 <a href="${h.url('new_repo_group')}" class="btn btn-small btn-success">${_(u'Add Repository Group')}</a>
27 <a href="${h.url('new_repo_group')}" class="btn btn-small btn-success">${_(u'Add Repository Group')}</a>
28 </li>
28 </li>
29 %endif
29 %endif
30 </ul>
30 </ul>
31 </div>
31 </div>
32 <div id="repos_list_wrap">
32 <div id="repos_list_wrap">
33 <table id="group_list_table" class="display"></table>
33 <table id="group_list_table" class="display"></table>
34 </div>
34 </div>
35 </div>
35 </div>
36
36
37 <script>
37 <script>
38 $(document).ready(function() {
38 $(document).ready(function() {
39
39
40 var get_datatable_count = function(){
40 var get_datatable_count = function(){
41 var api = $('#group_list_table').dataTable().api();
41 var api = $('#group_list_table').dataTable().api();
42 $('#repo_group_count').text(api.page.info().recordsDisplay);
42 $('#repo_group_count').text(api.page.info().recordsDisplay);
43 };
43 };
44
44
45 // repo group list
45 // repo group list
46 $('#group_list_table').DataTable({
46 $('#group_list_table').DataTable({
47 data: ${c.data|n},
47 data: ${c.data|n},
48 dom: 'rtp',
48 dom: 'rtp',
49 pageLength: ${c.visual.admin_grid_items},
49 pageLength: ${c.visual.admin_grid_items},
50 order: [[ 0, "asc" ]],
50 order: [[ 0, "asc" ]],
51 columns: [
51 columns: [
52 { data: {"_": "name",
52 { data: {"_": "name",
53 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
53 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
54 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
54 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
55 { data: {"_": "desc",
55 { data: {"_": "desc",
56 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
56 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
57 { data: {"_": "top_level_repos",
57 { data: {"_": "top_level_repos",
58 "sort": "top_level_repos"}, title: "${_('Number of top level repositories')}" },
58 "sort": "top_level_repos"}, title: "${_('Number of top level repositories')}" },
59 { data: {"_": "owner",
59 { data: {"_": "owner",
60 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
60 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
61 { data: {"_": "action",
61 { data: {"_": "action",
62 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
62 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
63 ],
63 ],
64 language: {
64 language: {
65 paginate: DEFAULT_GRID_PAGINATION
65 paginate: DEFAULT_GRID_PAGINATION
66 },
66 },
67 "initComplete": function( settings, json ) {
67 "initComplete": function( settings, json ) {
68 get_datatable_count();
68 get_datatable_count();
69 tooltip_activate();
70 quick_repo_menu();
69 quick_repo_menu();
71 }
70 }
72 });
71 });
73
72
74 // update the counter when doing search
73 // update the counter when doing search
75 $('#group_list_table').on( 'search.dt', function (e,settings) {
74 $('#group_list_table').on( 'search.dt', function (e,settings) {
76 get_datatable_count();
75 get_datatable_count();
77 });
76 });
78
77
79 // filter, filter both grids
78 // filter, filter both grids
80 $('#q_filter').on( 'keyup', function () {
79 $('#q_filter').on( 'keyup', function () {
81
80
82 var repo_group_api = $('#group_list_table').dataTable().api();
81 var repo_group_api = $('#group_list_table').dataTable().api();
83 repo_group_api
82 repo_group_api
84 .columns(0)
83 .columns(0)
85 .search(this.value)
84 .search(this.value)
86 .draw();
85 .draw();
87 });
86 });
88
87
89 // refilter table if page load via back button
88 // refilter table if page load via back button
90 $("#q_filter").trigger('keyup');
89 $("#q_filter").trigger('keyup');
91 });
90 });
92 </script>
91 </script>
93 </%def>
92 </%def>
94
93
@@ -1,101 +1,100 b''
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 ${_('Repositories administration')}
5 ${_('Repositories administration')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="repo_count">0</span> ${_('repositories')}
13 ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="repo_count">0</span> ${_('repositories')}
14 </%def>
14 </%def>
15
15
16 <%def name="menu_bar_nav()">
16 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='admin')}
17 ${self.menu_items(active='admin')}
18 </%def>
18 </%def>
19
19
20 <%def name="main()">
20 <%def name="main()">
21 <div class="box">
21 <div class="box">
22 <div class="title">
22 <div class="title">
23 ${self.breadcrumbs()}
23 ${self.breadcrumbs()}
24 <ul class="links">
24 <ul class="links">
25 %if h.HasPermissionAny('hg.admin','hg.create.repository')():
25 %if h.HasPermissionAny('hg.admin','hg.create.repository')():
26 <li>
26 <li>
27 <a href="${h.url('new_repo')}" class="btn btn-small btn-success">${_(u'Add Repository')}</a>
27 <a href="${h.url('new_repo')}" class="btn btn-small btn-success">${_(u'Add Repository')}</a>
28 </li>
28 </li>
29 %endif
29 %endif
30 </ul>
30 </ul>
31 </div>
31 </div>
32 <div id="repos_list_wrap">
32 <div id="repos_list_wrap">
33 <table id="repo_list_table" class="display"></table>
33 <table id="repo_list_table" class="display"></table>
34 </div>
34 </div>
35 </div>
35 </div>
36
36
37 <script>
37 <script>
38 $(document).ready(function() {
38 $(document).ready(function() {
39
39
40 var get_datatable_count = function(){
40 var get_datatable_count = function(){
41 var api = $('#repo_list_table').dataTable().api();
41 var api = $('#repo_list_table').dataTable().api();
42 $('#repo_count').text(api.page.info().recordsDisplay);
42 $('#repo_count').text(api.page.info().recordsDisplay);
43 };
43 };
44
44
45
45
46 // repo list
46 // repo list
47 $('#repo_list_table').DataTable({
47 $('#repo_list_table').DataTable({
48 data: ${c.data|n},
48 data: ${c.data|n},
49 dom: 'rtp',
49 dom: 'rtp',
50 pageLength: ${c.visual.admin_grid_items},
50 pageLength: ${c.visual.admin_grid_items},
51 order: [[ 0, "asc" ]],
51 order: [[ 0, "asc" ]],
52 columns: [
52 columns: [
53 { data: {"_": "name",
53 { data: {"_": "name",
54 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
54 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
55 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
55 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
56 { data: {"_": "desc",
56 { data: {"_": "desc",
57 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
57 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
58 { data: {"_": "last_change",
58 { data: {"_": "last_change",
59 "sort": "last_change_raw",
59 "sort": "last_change_raw",
60 "type": Number}, title: "${_('Last Change')}", className: "td-time" },
60 "type": Number}, title: "${_('Last Change')}", className: "td-time" },
61 { data: {"_": "last_changeset",
61 { data: {"_": "last_changeset",
62 "sort": "last_changeset_raw",
62 "sort": "last_changeset_raw",
63 "type": Number}, title: "${_('Commit')}", className: "td-commit" },
63 "type": Number}, title: "${_('Commit')}", className: "td-commit" },
64 { data: {"_": "owner",
64 { data: {"_": "owner",
65 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
65 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
66 { data: {"_": "state",
66 { data: {"_": "state",
67 "sort": "state"}, title: "${_('State')}", className: "td-tags td-state" },
67 "sort": "state"}, title: "${_('State')}", className: "td-tags td-state" },
68 { data: {"_": "action",
68 { data: {"_": "action",
69 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
69 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
70 ],
70 ],
71 language: {
71 language: {
72 paginate: DEFAULT_GRID_PAGINATION
72 paginate: DEFAULT_GRID_PAGINATION
73 },
73 },
74 "initComplete": function( settings, json ) {
74 "initComplete": function( settings, json ) {
75 get_datatable_count();
75 get_datatable_count();
76 tooltip_activate();
77 quick_repo_menu();
76 quick_repo_menu();
78 }
77 }
79 });
78 });
80
79
81 // update the counter when doing search
80 // update the counter when doing search
82 $('#repo_list_table').on( 'search.dt', function (e,settings) {
81 $('#repo_list_table').on( 'search.dt', function (e,settings) {
83 get_datatable_count();
82 get_datatable_count();
84 });
83 });
85
84
86 // filter, filter both grids
85 // filter, filter both grids
87 $('#q_filter').on( 'keyup', function () {
86 $('#q_filter').on( 'keyup', function () {
88 var repo_api = $('#repo_list_table').dataTable().api();
87 var repo_api = $('#repo_list_table').dataTable().api();
89 repo_api
88 repo_api
90 .columns(0)
89 .columns(0)
91 .search(this.value)
90 .search(this.value)
92 .draw();
91 .draw();
93 });
92 });
94
93
95 // refilter table if page load via back button
94 // refilter table if page load via back button
96 $("#q_filter").trigger('keyup');
95 $("#q_filter").trigger('keyup');
97 });
96 });
98
97
99 </script>
98 </script>
100
99
101 </%def>
100 </%def>
@@ -1,98 +1,97 b''
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 ${_('User groups administration')}
5 ${_('User groups administration')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="user_group_count">0</span> ${_('user groups')}
13 ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="user_group_count">0</span> ${_('user groups')}
14 </%def>
14 </%def>
15
15
16 <%def name="menu_bar_nav()">
16 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='admin')}
17 ${self.menu_items(active='admin')}
18 </%def>
18 </%def>
19
19
20 <%def name="main()">
20 <%def name="main()">
21 <div class="box">
21 <div class="box">
22
22
23 <div class="title">
23 <div class="title">
24 ${self.breadcrumbs()}
24 ${self.breadcrumbs()}
25 <ul class="links">
25 <ul class="links">
26 %if h.HasPermissionAny('hg.admin', 'hg.usergroup.create.true')():
26 %if h.HasPermissionAny('hg.admin', 'hg.usergroup.create.true')():
27 <li>
27 <li>
28 <a href="${h.url('new_users_group')}" class="btn btn-small btn-success">${_(u'Add User Group')}</a>
28 <a href="${h.url('new_users_group')}" class="btn btn-small btn-success">${_(u'Add User Group')}</a>
29 </li>
29 </li>
30 %endif
30 %endif
31 </ul>
31 </ul>
32 </div>
32 </div>
33
33
34 <div id="repos_list_wrap">
34 <div id="repos_list_wrap">
35 <table id="user_group_list_table" class="display"></table>
35 <table id="user_group_list_table" class="display"></table>
36 </div>
36 </div>
37
37
38 </div>
38 </div>
39 <script>
39 <script>
40 $(document).ready(function() {
40 $(document).ready(function() {
41
41
42 var get_datatable_count = function(){
42 var get_datatable_count = function(){
43 var api = $('#user_group_list_table').dataTable().api();
43 var api = $('#user_group_list_table').dataTable().api();
44 $('#user_group_count').text(api.page.info().recordsDisplay);
44 $('#user_group_count').text(api.page.info().recordsDisplay);
45 };
45 };
46
46
47 // user list
47 // user list
48 $('#user_group_list_table').DataTable({
48 $('#user_group_list_table').DataTable({
49 data: ${c.data|n},
49 data: ${c.data|n},
50 dom: 'rtp',
50 dom: 'rtp',
51 pageLength: ${c.visual.admin_grid_items},
51 pageLength: ${c.visual.admin_grid_items},
52 order: [[ 0, "asc" ]],
52 order: [[ 0, "asc" ]],
53 columns: [
53 columns: [
54 { data: {"_": "group_name",
54 { data: {"_": "group_name",
55 "sort": "group_name_raw"}, title: "${_('Name')}", className: "td-componentname" },
55 "sort": "group_name_raw"}, title: "${_('Name')}", className: "td-componentname" },
56 { data: {"_": "desc",
56 { data: {"_": "desc",
57 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
57 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
58 { data: {"_": "members",
58 { data: {"_": "members",
59 "sort": "members",
59 "sort": "members",
60 "type": Number}, title: "${_('Members')}", className: "td-number" },
60 "type": Number}, title: "${_('Members')}", className: "td-number" },
61 { data: {"_": "active",
61 { data: {"_": "active",
62 "sort": "active"}, title: "${_('Active')}", className: "td-active", className: "td-number"},
62 "sort": "active"}, title: "${_('Active')}", className: "td-active", className: "td-number"},
63 { data: {"_": "owner",
63 { data: {"_": "owner",
64 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
64 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
65 { data: {"_": "action",
65 { data: {"_": "action",
66 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
66 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
67 ],
67 ],
68 language: {
68 language: {
69 paginate: DEFAULT_GRID_PAGINATION
69 paginate: DEFAULT_GRID_PAGINATION
70 },
70 },
71 "initComplete": function( settings, json ) {
71 "initComplete": function( settings, json ) {
72 get_datatable_count();
72 get_datatable_count();
73 tooltip_activate();
74 }
73 }
75 });
74 });
76
75
77 // update the counter when doing search
76 // update the counter when doing search
78 $('#user_group_list_table').on( 'search.dt', function (e,settings) {
77 $('#user_group_list_table').on( 'search.dt', function (e,settings) {
79 get_datatable_count();
78 get_datatable_count();
80 });
79 });
81
80
82 // filter, filter both grids
81 // filter, filter both grids
83 $('#q_filter').on( 'keyup', function () {
82 $('#q_filter').on( 'keyup', function () {
84 var user_api = $('#user_group_list_table').dataTable().api();
83 var user_api = $('#user_group_list_table').dataTable().api();
85 user_api
84 user_api
86 .columns(0)
85 .columns(0)
87 .search(this.value)
86 .search(this.value)
88 .draw();
87 .draw();
89 });
88 });
90
89
91 // refilter table if page load via back button
90 // refilter table if page load via back button
92 $("#q_filter").trigger('keyup');
91 $("#q_filter").trigger('keyup');
93
92
94 });
93 });
95
94
96 </script>
95 </script>
97
96
98 </%def>
97 </%def>
@@ -1,141 +1,140 b''
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 ${_('Users administration')}
5 ${_('Users administration')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="user_count">0</span>
13 ${h.link_to(_('Admin'),h.url('admin_home'))} &raquo; <span id="user_count">0</span>
14 </%def>
14 </%def>
15
15
16 <%def name="menu_bar_nav()">
16 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='admin')}
17 ${self.menu_items(active='admin')}
18 </%def>
18 </%def>
19
19
20 <%def name="main()">
20 <%def name="main()">
21 <div class="box">
21 <div class="box">
22
22
23 <div class="title">
23 <div class="title">
24 ${self.breadcrumbs()}
24 ${self.breadcrumbs()}
25 <ul class="links">
25 <ul class="links">
26 <li>
26 <li>
27 <a href="${h.url('new_user')}" class="btn btn-small btn-success">${_(u'Add User')}</a>
27 <a href="${h.url('new_user')}" class="btn btn-small btn-success">${_(u'Add User')}</a>
28 </li>
28 </li>
29 </ul>
29 </ul>
30 </div>
30 </div>
31
31
32 <div id="repos_list_wrap">
32 <div id="repos_list_wrap">
33 <table id="user_list_table" class="display"></table>
33 <table id="user_list_table" class="display"></table>
34 </div>
34 </div>
35 </div>
35 </div>
36
36
37 <script>
37 <script>
38 $(document).ready(function() {
38 $(document).ready(function() {
39
39
40 var get_datatable_count = function(){
40 var get_datatable_count = function(){
41 var datatable = $('#user_list_table').dataTable();
41 var datatable = $('#user_list_table').dataTable();
42 var api = datatable.api();
42 var api = datatable.api();
43 var total = api.page.info().recordsDisplay;
43 var total = api.page.info().recordsDisplay;
44 var active = datatable.fnGetFilteredData();
44 var active = datatable.fnGetFilteredData();
45 var _text = _gettext("{0} active out of {1} users").format(active, total);
45 var _text = _gettext("{0} active out of {1} users").format(active, total);
46 $('#user_count').text(_text);
46 $('#user_count').text(_text);
47 };
47 };
48
48
49 // custom filter that filters by username OR email
49 // custom filter that filters by username OR email
50 $.fn.dataTable.ext.search.push(
50 $.fn.dataTable.ext.search.push(
51 function( settings, data, dataIndex ) {
51 function( settings, data, dataIndex ) {
52 var query = $('#q_filter').val();
52 var query = $('#q_filter').val();
53 var username = data[1];
53 var username = data[1];
54 var email = data[2];
54 var email = data[2];
55 var first_name = data[3];
55 var first_name = data[3];
56 var last_name = data[4];
56 var last_name = data[4];
57
57
58 var query_str = username + " " +
58 var query_str = username + " " +
59 email + " " +
59 email + " " +
60 first_name + " " +
60 first_name + " " +
61 last_name;
61 last_name;
62 if((query_str).indexOf(query) !== -1){
62 if((query_str).indexOf(query) !== -1){
63 return true;
63 return true;
64 }
64 }
65 return false;
65 return false;
66 }
66 }
67 );
67 );
68 // filtered data plugin
68 // filtered data plugin
69 $.fn.dataTableExt.oApi.fnGetFilteredData = function ( oSettings ) {
69 $.fn.dataTableExt.oApi.fnGetFilteredData = function ( oSettings ) {
70 var res = [];
70 var res = [];
71 for ( var i=0, iLen=oSettings.fnRecordsDisplay() ; i<iLen ; i++ ) {
71 for ( var i=0, iLen=oSettings.fnRecordsDisplay() ; i<iLen ; i++ ) {
72 var record = oSettings.aoData[i]._aData;
72 var record = oSettings.aoData[i]._aData;
73 if(record['active_raw']){
73 if(record['active_raw']){
74 res.push(record);
74 res.push(record);
75 }
75 }
76 }
76 }
77 return res.length;
77 return res.length;
78 };
78 };
79
79
80 // user list
80 // user list
81 $('#user_list_table').DataTable({
81 $('#user_list_table').DataTable({
82 data: ${c.data|n},
82 data: ${c.data|n},
83 dom: 'rtp',
83 dom: 'rtp',
84 pageLength: ${c.visual.admin_grid_items},
84 pageLength: ${c.visual.admin_grid_items},
85 order: [[ 1, "asc" ]],
85 order: [[ 1, "asc" ]],
86 columns: [
86 columns: [
87 { data: {"_": "gravatar"}, className: "td-gravatar" },
87 { data: {"_": "gravatar"}, className: "td-gravatar" },
88 { data: {"_": "username",
88 { data: {"_": "username",
89 "sort": "username_raw"}, title: "${_('Username')}", className: "td-user" },
89 "sort": "username_raw"}, title: "${_('Username')}", className: "td-user" },
90 { data: {"_": "email",
90 { data: {"_": "email",
91 "sort": "email"}, title: "${_('Email')}", className: "td-email" },
91 "sort": "email"}, title: "${_('Email')}", className: "td-email" },
92 { data: {"_": "first_name",
92 { data: {"_": "first_name",
93 "sort": "first_name"}, title: "${_('First Name')}", className: "td-user" },
93 "sort": "first_name"}, title: "${_('First Name')}", className: "td-user" },
94 { data: {"_": "last_name",
94 { data: {"_": "last_name",
95 "sort": "last_name"}, title: "${_('Last Name')}", className: "td-user" },
95 "sort": "last_name"}, title: "${_('Last Name')}", className: "td-user" },
96 { data: {"_": "last_login",
96 { data: {"_": "last_login",
97 "sort": "last_login_raw",
97 "sort": "last_login_raw",
98 "type": Number}, title: "${_('Last login')}", className: "td-time" },
98 "type": Number}, title: "${_('Last login')}", className: "td-time" },
99 { data: {"_": "active",
99 { data: {"_": "active",
100 "sort": "active_raw"}, title: "${_('Active')}", className: "td-active" },
100 "sort": "active_raw"}, title: "${_('Active')}", className: "td-active" },
101 { data: {"_": "admin",
101 { data: {"_": "admin",
102 "sort": "admin_raw"}, title: "${_('Admin')}", className: "td-admin" },
102 "sort": "admin_raw"}, title: "${_('Admin')}", className: "td-admin" },
103 { data: {"_": "extern_type",
103 { data: {"_": "extern_type",
104 "sort": "extern_type"}, title: "${_('Authentication type')}", className: "td-type" },
104 "sort": "extern_type"}, title: "${_('Authentication type')}", className: "td-type" },
105 { data: {"_": "action",
105 { data: {"_": "action",
106 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
106 "sort": "action"}, title: "${_('Action')}", className: "td-action" }
107 ],
107 ],
108 language: {
108 language: {
109 paginate: DEFAULT_GRID_PAGINATION
109 paginate: DEFAULT_GRID_PAGINATION
110 },
110 },
111 "initComplete": function( settings, json ) {
111 "initComplete": function( settings, json ) {
112 get_datatable_count();
112 get_datatable_count();
113 tooltip_activate();
114 },
113 },
115 "createdRow": function ( row, data, index ) {
114 "createdRow": function ( row, data, index ) {
116 if (!data['active_raw']){
115 if (!data['active_raw']){
117 $(row).addClass('closed')
116 $(row).addClass('closed')
118 }
117 }
119 }
118 }
120 });
119 });
121
120
122 // update the counter when doing search
121 // update the counter when doing search
123 $('#user_list_table').on( 'search.dt', function (e,settings) {
122 $('#user_list_table').on( 'search.dt', function (e,settings) {
124 get_datatable_count();
123 get_datatable_count();
125 });
124 });
126
125
127 // filter, filter both grids
126 // filter, filter both grids
128 $('#q_filter').on( 'keyup', function () {
127 $('#q_filter').on( 'keyup', function () {
129 var user_api = $('#user_list_table').dataTable().api();
128 var user_api = $('#user_list_table').dataTable().api();
130 user_api
129 user_api
131 .draw();
130 .draw();
132 });
131 });
133
132
134 // refilter table if page load via back button
133 // refilter table if page load via back button
135 $("#q_filter").trigger('keyup');
134 $("#q_filter").trigger('keyup');
136
135
137 });
136 });
138
137
139 </script>
138 </script>
140
139
141 </%def>
140 </%def>
@@ -1,172 +1,170 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <!DOCTYPE html>
2 <!DOCTYPE html>
3
3
4 <%def name="get_template_context()" filter="n, trim">{
4 <%def name="get_template_context()" filter="n, trim">{
5
5
6 ## repo data
6 ## repo data
7 repo_name: "${getattr(c, 'repo_name', '')}",
7 repo_name: "${getattr(c, 'repo_name', '')}",
8 % if hasattr(c, 'rhodecode_db_repo'):
8 % if hasattr(c, 'rhodecode_db_repo'):
9 repo_type: "${c.rhodecode_db_repo.repo_type}",
9 repo_type: "${c.rhodecode_db_repo.repo_type}",
10 repo_landing_commit: "${c.rhodecode_db_repo.landing_rev[1]}",
10 repo_landing_commit: "${c.rhodecode_db_repo.landing_rev[1]}",
11 % else:
11 % else:
12 repo_type: null,
12 repo_type: null,
13 repo_landing_commit: null,
13 repo_landing_commit: null,
14 % endif
14 % endif
15
15
16 ## user data
16 ## user data
17 % if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
17 % if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
18 rhodecode_user: {
18 rhodecode_user: {
19 username: "${c.rhodecode_user.username}",
19 username: "${c.rhodecode_user.username}",
20 email: "${c.rhodecode_user.email}",
20 email: "${c.rhodecode_user.email}",
21 },
21 },
22 % else:
22 % else:
23 rhodecode_user: {
23 rhodecode_user: {
24 username: null,
24 username: null,
25 email: null,
25 email: null,
26 },
26 },
27 % endif
27 % endif
28
28
29 ## visual settings
29 ## visual settings
30 visual: {
30 visual: {
31 default_renderer: "${h.get_visual_attr(c, 'default_renderer')}"
31 default_renderer: "${h.get_visual_attr(c, 'default_renderer')}"
32 },
32 },
33
33
34 ## current commit context, filled inside templates that expose that
34 ## current commit context, filled inside templates that expose that
35 commit_data: {
35 commit_data: {
36 commit_id: null,
36 commit_id: null,
37 },
37 },
38
38
39 ## current pr context, filled inside templates that expose that
39 ## current pr context, filled inside templates that expose that
40 pull_request_data: {
40 pull_request_data: {
41 pull_request_id: null,
41 pull_request_id: null,
42 },
42 },
43
43
44 ## timeago settings, can be overwritten by custom user settings later
44 ## timeago settings, can be overwritten by custom user settings later
45 timeago: {
45 timeago: {
46 refresh_time: ${120 * 1000},
46 refresh_time: ${120 * 1000},
47 cutoff_limit: ${1000*60*60*24*7}
47 cutoff_limit: ${1000*60*60*24*7}
48 }
48 }
49 }
49 }
50
50
51 </%def>
51 </%def>
52
52
53 <html xmlns="http://www.w3.org/1999/xhtml">
53 <html xmlns="http://www.w3.org/1999/xhtml">
54 <head>
54 <head>
55 <title>${self.title()}</title>
55 <title>${self.title()}</title>
56 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
56 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
57 <%def name="robots()">
57 <%def name="robots()">
58 <meta name="robots" content="index, nofollow"/>
58 <meta name="robots" content="index, nofollow"/>
59 </%def>
59 </%def>
60 ${self.robots()}
60 ${self.robots()}
61 <link rel="icon" href="${h.url('/images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
61 <link rel="icon" href="${h.url('/images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
62
62
63 ## CSS definitions
63 ## CSS definitions
64 <%def name="css()">
64 <%def name="css()">
65 <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
65 <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
66 <!--[if lt IE 9]>
66 <!--[if lt IE 9]>
67 <link rel="stylesheet" type="text/css" href="${h.url('/css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
67 <link rel="stylesheet" type="text/css" href="${h.url('/css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
68 <![endif]-->
68 <![endif]-->
69 ## EXTRA FOR CSS
69 ## EXTRA FOR CSS
70 ${self.css_extra()}
70 ${self.css_extra()}
71 </%def>
71 </%def>
72 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
72 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
73 <%def name="css_extra()">
73 <%def name="css_extra()">
74 </%def>
74 </%def>
75
75
76 ${self.css()}
76 ${self.css()}
77
77
78 ## JAVASCRIPT
78 ## JAVASCRIPT
79 <%def name="js()">
79 <%def name="js()">
80 <script src="${h.url('/js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
80 <script src="${h.url('/js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
81 <script type="text/javascript">
81 <script type="text/javascript">
82 // register templateContext to pass template variables to JS
82 // register templateContext to pass template variables to JS
83 var templateContext = ${get_template_context()};
83 var templateContext = ${get_template_context()};
84
84
85 var REPO_NAME = "${getattr(c, 'repo_name', '')}";
85 var REPO_NAME = "${getattr(c, 'repo_name', '')}";
86 %if hasattr(c, 'rhodecode_db_repo'):
86 %if hasattr(c, 'rhodecode_db_repo'):
87 var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}';
87 var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}';
88 var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}';
88 var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}';
89 %else:
89 %else:
90 var REPO_LANDING_REV = '';
90 var REPO_LANDING_REV = '';
91 var REPO_TYPE = '';
91 var REPO_TYPE = '';
92 %endif
92 %endif
93 var APPLICATION_URL = "${h.url('home').rstrip('/')}";
93 var APPLICATION_URL = "${h.url('home').rstrip('/')}";
94 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
94 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
95 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
95 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
96 % if getattr(c, 'rhodecode_user', None):
96 % if getattr(c, 'rhodecode_user', None):
97 var USER = {name:'${c.rhodecode_user.username}'};
97 var USER = {name:'${c.rhodecode_user.username}'};
98 % else:
98 % else:
99 var USER = {name:null};
99 var USER = {name:null};
100 % endif
100 % endif
101
101
102 var APPENLIGHT = {
102 var APPENLIGHT = {
103 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
103 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
104 key: '${getattr(c, "appenlight_api_public_key", "")}',
104 key: '${getattr(c, "appenlight_api_public_key", "")}',
105 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
105 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
106 requestInfo: {
106 requestInfo: {
107 % if getattr(c, 'rhodecode_user', None):
107 % if getattr(c, 'rhodecode_user', None):
108 ip: '${c.rhodecode_user.ip_addr}',
108 ip: '${c.rhodecode_user.ip_addr}',
109 username: '${c.rhodecode_user.username}'
109 username: '${c.rhodecode_user.username}'
110 % endif
110 % endif
111 }
111 }
112 };
112 };
113 </script>
113 </script>
114
114
115 <!--[if lt IE 9]>
115 <!--[if lt IE 9]>
116 <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
116 <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
117 <![endif]-->
117 <![endif]-->
118 <script language="javascript" type="text/javascript" src="${h.url('/js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
118 <script language="javascript" type="text/javascript" src="${h.url('/js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
119 <script language="javascript" type="text/javascript" src="${h.url('/js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
119 <script language="javascript" type="text/javascript" src="${h.url('/js/scripts.js', ver=c.rhodecode_version_hash)}"></script>
120 <script>CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}";</script>
120 <script>CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}";</script>
121
121
122 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
122 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
123 ${self.js_extra()}
123 ${self.js_extra()}
124
124
125 <script type="text/javascript">
125 <script type="text/javascript">
126 $(document).ready(function(){
126 $(document).ready(function(){
127 tooltip_activate();
128 show_more_event();
127 show_more_event();
129 show_changeset_tooltip();
130 timeagoActivate();
128 timeagoActivate();
131 })
129 })
132 </script>
130 </script>
133
131
134 </%def>
132 </%def>
135
133
136 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
134 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
137 <%def name="js_extra()"></%def>
135 <%def name="js_extra()"></%def>
138 ${self.js()}
136 ${self.js()}
139
137
140 <%def name="head_extra()"></%def>
138 <%def name="head_extra()"></%def>
141 ${self.head_extra()}
139 ${self.head_extra()}
142
140
143 <%include file="/base/plugins_base.html"/>
141 <%include file="/base/plugins_base.html"/>
144
142
145 ## extra stuff
143 ## extra stuff
146 %if c.pre_code:
144 %if c.pre_code:
147 ${c.pre_code|n}
145 ${c.pre_code|n}
148 %endif
146 %endif
149 </head>
147 </head>
150 <body id="body">
148 <body id="body">
151 <noscript>
149 <noscript>
152 <div class="noscript-error">
150 <div class="noscript-error">
153 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
151 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
154 </div>
152 </div>
155 </noscript>
153 </noscript>
156 ## IE hacks
154 ## IE hacks
157 <!--[if IE 7]>
155 <!--[if IE 7]>
158 <script>$(document.body).addClass('ie7')</script>
156 <script>$(document.body).addClass('ie7')</script>
159 <![endif]-->
157 <![endif]-->
160 <!--[if IE 8]>
158 <!--[if IE 8]>
161 <script>$(document.body).addClass('ie8')</script>
159 <script>$(document.body).addClass('ie8')</script>
162 <![endif]-->
160 <![endif]-->
163 <!--[if IE 9]>
161 <!--[if IE 9]>
164 <script>$(document.body).addClass('ie9')</script>
162 <script>$(document.body).addClass('ie9')</script>
165 <![endif]-->
163 <![endif]-->
166
164
167 ${next.body()}
165 ${next.body()}
168 %if c.post_code:
166 %if c.post_code:
169 ${c.post_code|n}
167 ${c.post_code|n}
170 %endif
168 %endif
171 </body>
169 </body>
172 </html>
170 </html>
@@ -1,103 +1,101 b''
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 ${_('%s Bookmarks') % c.repo_name}
5 ${_('%s Bookmarks') % c.repo_name}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 <span id="obj_count">0</span> ${_('bookmarks')}
13 <span id="obj_count">0</span> ${_('bookmarks')}
14 </%def>
14 </%def>
15
15
16 <%def name="menu_bar_nav()">
16 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='repositories')}
17 ${self.menu_items(active='repositories')}
18 </%def>
18 </%def>
19
19
20 <%def name="menu_bar_subnav()">
20 <%def name="menu_bar_subnav()">
21 ${self.repo_menu(active='summary')}
21 ${self.repo_menu(active='summary')}
22 </%def>
22 </%def>
23
23
24 <%def name="main()">
24 <%def name="main()">
25 <div class="box">
25 <div class="box">
26 <div class="title">
26 <div class="title">
27 ${self.repo_page_title(c.rhodecode_db_repo)}
27 ${self.repo_page_title(c.rhodecode_db_repo)}
28 %if c.has_references:
28 %if c.has_references:
29 <ul class="links">
29 <ul class="links">
30 <li>
30 <li>
31 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Bookmarks')}">
31 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Bookmarks')}">
32 </li>
32 </li>
33 </ul>
33 </ul>
34 %endif
34 %endif
35 %if c.has_references:
35 %if c.has_references:
36 ${self.breadcrumbs()}
36 ${self.breadcrumbs()}
37 %endif
37 %endif
38 </div>
38 </div>
39 <table id="obj_list_table" class="display"></table>
39 <table id="obj_list_table" class="display"></table>
40 </div>
40 </div>
41
41
42
42
43 <script type="text/javascript">
43 <script type="text/javascript">
44 $(document).ready(function() {
44 $(document).ready(function() {
45
45
46 var get_datatable_count = function(){
46 var get_datatable_count = function(){
47 var api = $('#obj_list_table').dataTable().api();
47 var api = $('#obj_list_table').dataTable().api();
48 $('#obj_count').text(api.page.info().recordsDisplay);
48 $('#obj_count').text(api.page.info().recordsDisplay);
49 };
49 };
50
50
51 // object list
51 // object list
52 $('#obj_list_table').DataTable({
52 $('#obj_list_table').DataTable({
53 data: ${c.data|n},
53 data: ${c.data|n},
54 dom: 'rtp',
54 dom: 'rtp',
55 pageLength: ${c.visual.dashboard_items},
55 pageLength: ${c.visual.dashboard_items},
56 order: [[ 0, "asc" ]],
56 order: [[ 0, "asc" ]],
57 columns: [
57 columns: [
58 { data: {"_": "name",
58 { data: {"_": "name",
59 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
59 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
60 { data: {"_": "date",
60 { data: {"_": "date",
61 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
61 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
62 { data: {"_": "author",
62 { data: {"_": "author",
63 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
63 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
64 { data: {"_": "commit",
64 { data: {"_": "commit",
65 "sort": "commit_raw",
65 "sort": "commit_raw",
66 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
66 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
67 { data: {"_": "compare",
67 { data: {"_": "compare",
68 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
68 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
69 ],
69 ],
70 language: {
70 language: {
71 paginate: DEFAULT_GRID_PAGINATION
71 paginate: DEFAULT_GRID_PAGINATION
72 },
72 },
73 "initComplete": function(settings, json) {
73 "initComplete": function(settings, json) {
74 get_datatable_count();
74 get_datatable_count();
75 tooltip_activate();
76 timeagoActivate();
75 timeagoActivate();
77 compare_radio_buttons("${c.repo_name}", 'book');
76 compare_radio_buttons("${c.repo_name}", 'book');
78 }
77 }
79 });
78 });
80
79
81 // update when things change
80 // update when things change
82 $('#obj_list_table').on('draw.dt', function() {
81 $('#obj_list_table').on('draw.dt', function() {
83 get_datatable_count();
82 get_datatable_count();
84 tooltip_activate();
85 timeagoActivate();
83 timeagoActivate();
86 });
84 });
87
85
88 // filter, filter both grids
86 // filter, filter both grids
89 $('#q_filter').on('keyup', function() {
87 $('#q_filter').on('keyup', function() {
90 var obj_api = $('#obj_list_table').dataTable().api();
88 var obj_api = $('#obj_list_table').dataTable().api();
91 obj_api
89 obj_api
92 .columns(0)
90 .columns(0)
93 .search(this.value)
91 .search(this.value)
94 .draw();
92 .draw();
95 });
93 });
96
94
97 // refilter table if page load via back button
95 // refilter table if page load via back button
98 $("#q_filter").trigger('keyup');
96 $("#q_filter").trigger('keyup');
99
97
100 });
98 });
101
99
102 </script>
100 </script>
103 </%def>
101 </%def>
@@ -1,102 +1,100 b''
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 ${_('%s Branches') % c.repo_name}
5 ${_('%s Branches') % c.repo_name}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 <span id="obj_count">0</span> ${_('branches')}
13 <span id="obj_count">0</span> ${_('branches')}
14 </%def>
14 </%def>
15
15
16 <%def name="menu_bar_nav()">
16 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='repositories')}
17 ${self.menu_items(active='repositories')}
18 </%def>
18 </%def>
19
19
20 <%def name="menu_bar_subnav()">
20 <%def name="menu_bar_subnav()">
21 ${self.repo_menu(active='summary')}
21 ${self.repo_menu(active='summary')}
22 </%def>
22 </%def>
23
23
24 <%def name="main()">
24 <%def name="main()">
25 <div class="box">
25 <div class="box">
26 <div class="title">
26 <div class="title">
27 ${self.repo_page_title(c.rhodecode_db_repo)}
27 ${self.repo_page_title(c.rhodecode_db_repo)}
28 %if c.has_references:
28 %if c.has_references:
29 <ul class="links">
29 <ul class="links">
30 <li>
30 <li>
31 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Branches')}"/>
31 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Branches')}"/>
32 </li>
32 </li>
33 </ul>
33 </ul>
34 %endif
34 %endif
35 %if c.has_references:
35 %if c.has_references:
36 ${self.breadcrumbs()}
36 ${self.breadcrumbs()}
37 %endif
37 %endif
38 </div>
38 </div>
39 <table id="obj_list_table" class="display"></table>
39 <table id="obj_list_table" class="display"></table>
40 </div>
40 </div>
41
41
42 <script type="text/javascript">
42 <script type="text/javascript">
43 $(document).ready(function() {
43 $(document).ready(function() {
44
44
45 var get_datatable_count = function(){
45 var get_datatable_count = function(){
46 var api = $('#obj_list_table').dataTable().api();
46 var api = $('#obj_list_table').dataTable().api();
47 $('#obj_count').text(api.page.info().recordsDisplay);
47 $('#obj_count').text(api.page.info().recordsDisplay);
48 };
48 };
49
49
50 // object list
50 // object list
51 $('#obj_list_table').DataTable({
51 $('#obj_list_table').DataTable({
52 data: ${c.data|n},
52 data: ${c.data|n},
53 dom: 'rtp',
53 dom: 'rtp',
54 pageLength: ${c.visual.dashboard_items},
54 pageLength: ${c.visual.dashboard_items},
55 order: [[ 0, "asc" ]],
55 order: [[ 0, "asc" ]],
56 columns: [
56 columns: [
57 { data: {"_": "name",
57 { data: {"_": "name",
58 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
58 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
59 { data: {"_": "date",
59 { data: {"_": "date",
60 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
60 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
61 { data: {"_": "author",
61 { data: {"_": "author",
62 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
62 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
63 { data: {"_": "commit",
63 { data: {"_": "commit",
64 "sort": "commit_raw",
64 "sort": "commit_raw",
65 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
65 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
66 { data: {"_": "compare",
66 { data: {"_": "compare",
67 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
67 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
68 ],
68 ],
69 language: {
69 language: {
70 paginate: DEFAULT_GRID_PAGINATION
70 paginate: DEFAULT_GRID_PAGINATION
71 },
71 },
72 "initComplete": function( settings, json ) {
72 "initComplete": function( settings, json ) {
73 get_datatable_count();
73 get_datatable_count();
74 tooltip_activate();
75 timeagoActivate();
74 timeagoActivate();
76 compare_radio_buttons("${c.repo_name}", 'branch');
75 compare_radio_buttons("${c.repo_name}", 'branch');
77 }
76 }
78 });
77 });
79
78
80 // update when things change
79 // update when things change
81 $('#obj_list_table').on('draw.dt', function() {
80 $('#obj_list_table').on('draw.dt', function() {
82 get_datatable_count();
81 get_datatable_count();
83 tooltip_activate();
84 timeagoActivate();
82 timeagoActivate();
85 });
83 });
86
84
87 // filter, filter both grids
85 // filter, filter both grids
88 $('#q_filter').on( 'keyup', function () {
86 $('#q_filter').on( 'keyup', function () {
89 var obj_api = $('#obj_list_table').dataTable().api();
87 var obj_api = $('#obj_list_table').dataTable().api();
90 obj_api
88 obj_api
91 .columns(0)
89 .columns(0)
92 .search(this.value)
90 .search(this.value)
93 .draw();
91 .draw();
94 });
92 });
95
93
96 // refilter table if page load via back button
94 // refilter table if page load via back button
97 $("#q_filter").trigger('keyup');
95 $("#q_filter").trigger('keyup');
98
96
99 });
97 });
100
98
101 </script>
99 </script>
102 </%def>
100 </%def>
@@ -1,127 +1,127 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.html"/>
2 <%namespace name="base" file="/base/base.html"/>
3 %if c.repo_commits:
3 %if c.repo_commits:
4 <table class="rctable repo_summary table_disp">
4 <table class="rctable repo_summary table_disp">
5 <tr>
5 <tr>
6 <th>${_('Commit')}</th>
6 <th>${_('Commit')}</th>
7 <th class="status" colspan="2"></th>
7 <th class="status" colspan="2"></th>
8 <th>${_('Commit message')}</th>
8 <th>${_('Commit message')}</th>
9 <th>${_('Age')}</th>
9 <th>${_('Age')}</th>
10 <th>${_('Author')}</th>
10 <th>${_('Author')}</th>
11 <th>${_('Refs')}</th>
11 <th>${_('Refs')}</th>
12 </tr>
12 </tr>
13 %for cnt,cs in enumerate(c.repo_commits):
13 %for cnt,cs in enumerate(c.repo_commits):
14 <tr class="parity${cnt%2}">
14 <tr class="parity${cnt%2}">
15 <td class="td-commit">
15 <td class="td-commit">
16 <pre><a href="${h.url('changeset_home', repo_name=c.repo_name, revision=cs.raw_id)}">${h.show_id(cs)}</a></pre>
16 <pre><a href="${h.url('changeset_home', repo_name=c.repo_name, revision=cs.raw_id)}">${h.show_id(cs)}</a></pre>
17 </td>
17 </td>
18 <td class="td-status">
18 <td class="td-status">
19 %if c.statuses.get(cs.raw_id):
19 %if c.statuses.get(cs.raw_id):
20 <div class="changeset-status-ico shortlog">
20 <div class="changeset-status-ico shortlog">
21 %if c.statuses.get(cs.raw_id)[2]:
21 %if c.statuses.get(cs.raw_id)[2]:
22 <a class="tooltip" title="${_('Commit status: %s\nClick to open associated pull request #%s') % (c.statuses.get(cs.raw_id)[0], c.statuses.get(cs.raw_id)[2])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}">
22 <a class="tooltip" title="${_('Commit status: %s\nClick to open associated pull request #%s') % (c.statuses.get(cs.raw_id)[0], c.statuses.get(cs.raw_id)[2])}" href="${h.url('pullrequest_show',repo_name=c.statuses.get(cs.raw_id)[3],pull_request_id=c.statuses.get(cs.raw_id)[2])}">
23 <div class="${'flag_status %s' % c.statuses.get(cs.raw_id)[0]}"></div>
23 <div class="${'flag_status %s' % c.statuses.get(cs.raw_id)[0]}"></div>
24 </a>
24 </a>
25 %else:
25 %else:
26 <div class="${'flag_status %s' % c.statuses.get(cs.raw_id)[0]}"></div>
26 <div class="${'flag_status %s' % c.statuses.get(cs.raw_id)[0]}"></div>
27 %endif
27 %endif
28 </div>
28 </div>
29 %endif
29 %endif
30 </td>
30 </td>
31 <td class="td-comments">
31 <td class="td-comments">
32 %if c.comments.get(cs.raw_id,[]):
32 %if c.comments.get(cs.raw_id,[]):
33 <a title="${_('Commit has comments')}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id,anchor='comment-%s' % c.comments[cs.raw_id][0].comment_id)}">
33 <a title="${_('Commit has comments')}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id,anchor='comment-%s' % c.comments[cs.raw_id][0].comment_id)}">
34 <i class="icon-comment icon-comment-colored"></i> ${len(c.comments[cs.raw_id])}
34 <i class="icon-comment icon-comment-colored"></i> ${len(c.comments[cs.raw_id])}
35 </a>
35 </a>
36 %endif
36 %endif
37 </td>
37 </td>
38 <td class="td-message">
38 <td class="td-message">
39 ${h.urlify_commit_message(h.truncate(cs.message, 50), c.repo_name)}
39 ${h.urlify_commit_message(h.truncate(cs.message, 50), c.repo_name)}
40 </td>
40 </td>
41 <td class="td-time">
41 <td class="td-time">
42 ${h.age_component(cs.date)}
42 ${h.age_component(cs.date)}
43 </td>
43 </td>
44
44
45 <td class="td-user author">
45 <td class="td-user author">
46 ${base.gravatar(h.email_or_none(cs.author), 16)}
46 ${base.gravatar(h.email_or_none(cs.author), 16)}
47 <span title="${cs.author}" class="user">${h.link_to_user(cs.author, length=22)}</span>
47 <span title="${cs.author}" class="user">${h.link_to_user(cs.author, length=22)}</span>
48 </td>
48 </td>
49 <td class="td-tags truncate-wrap">
49 <td class="td-tags truncate-wrap">
50 <div class="truncate tags-truncate"><div class="autoexpand">
50 <div class="truncate tags-truncate"><div class="autoexpand">
51 %if h.is_hg(c.rhodecode_repo):
51 %if h.is_hg(c.rhodecode_repo):
52 %for book in cs.bookmarks:
52 %for book in cs.bookmarks:
53 <span class="booktag tag" title="${_('Bookmark %s') % book}">
53 <span class="booktag tag" title="${_('Bookmark %s') % book}">
54 <a href="${h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id)}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
54 <a href="${h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id)}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
55 </span>
55 </span>
56 %endfor
56 %endfor
57 %endif
57 %endif
58 ## tags
58 ## tags
59 %for tag in cs.tags:
59 %for tag in cs.tags:
60 <span class="tagtag tag" title="${_('Tag %s') % tag}">
60 <span class="tagtag tag" title="${_('Tag %s') % tag}">
61 <a href="${h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id)}"><i class="icon-tag"></i>${h.shorter(tag)}</a>
61 <a href="${h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id)}"><i class="icon-tag"></i>${h.shorter(tag)}</a>
62 </span>
62 </span>
63 %endfor
63 %endfor
64
64
65 ## branch
65 ## branch
66 %if cs.branch:
66 %if cs.branch:
67 <span class="branchtag tag" title="${_('Branch %s') % cs.branch}">
67 <span class="branchtag tag" title="${_('Branch %s') % cs.branch}">
68 <a href="${h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch)}"><i class="icon-code-fork"></i>${h.shorter(cs.branch)}</a>
68 <a href="${h.url('changelog_home',repo_name=c.repo_name,branch=cs.branch)}"><i class="icon-code-fork"></i>${h.shorter(cs.branch)}</a>
69 </span>
69 </span>
70 %endif
70 %endif
71 </div>
71 </div>
72 </td>
72 </td>
73 </tr>
73 </tr>
74 %endfor
74 %endfor
75
75
76 </table>
76 </table>
77
77
78 <script type="text/javascript">
78 <script type="text/javascript">
79 $(document).pjax('#shortlog_data .pager_link','#shortlog_data', {timeout: 2000, scrollTo: false });
79 $(document).pjax('#shortlog_data .pager_link','#shortlog_data', {timeout: 2000, scrollTo: false });
80 $(document).on('pjax:success', function(){ timeagoActivate(); tooltip_activate(); });
80 $(document).on('pjax:success', function(){ timeagoActivate(); });
81 </script>
81 </script>
82
82
83 <div class="pagination-wh pagination-left">
83 <div class="pagination-wh pagination-left">
84 ${c.repo_commits.pager('$link_previous ~2~ $link_next')}
84 ${c.repo_commits.pager('$link_previous ~2~ $link_next')}
85 </div>
85 </div>
86 %else:
86 %else:
87
87
88 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
88 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
89 <div class="quick_start">
89 <div class="quick_start">
90 <div class="fieldset">
90 <div class="fieldset">
91 <div class="left-label">${_('Add or upload files directly via RhodeCode:')}</div>
91 <div class="left-label">${_('Add or upload files directly via RhodeCode:')}</div>
92 <div class="right-content">
92 <div class="right-content">
93 <div id="add_node_id" class="add_node">
93 <div id="add_node_id" class="add_node">
94 <a href="${h.url('files_add_home',repo_name=c.repo_name,revision=0,f_path='', anchor='edit')}" class="btn btn-default">${_('Add New File')}</a>
94 <a href="${h.url('files_add_home',repo_name=c.repo_name,revision=0,f_path='', anchor='edit')}" class="btn btn-default">${_('Add New File')}</a>
95 </div>
95 </div>
96 </div>
96 </div>
97 %endif
97 %endif
98 </div>
98 </div>
99
99
100 %if not h.is_svn(c.rhodecode_repo):
100 %if not h.is_svn(c.rhodecode_repo):
101 <div class="fieldset">
101 <div class="fieldset">
102 <div class="left-label">${_('Push new repo:')}</div>
102 <div class="left-label">${_('Push new repo:')}</div>
103 <div class="right-content">
103 <div class="right-content">
104 <pre>
104 <pre>
105 ${c.rhodecode_repo.alias} clone ${c.clone_repo_url}
105 ${c.rhodecode_repo.alias} clone ${c.clone_repo_url}
106 ${c.rhodecode_repo.alias} add README # add first file
106 ${c.rhodecode_repo.alias} add README # add first file
107 ${c.rhodecode_repo.alias} commit -m "Initial" # commit with message
107 ${c.rhodecode_repo.alias} commit -m "Initial" # commit with message
108 ${c.rhodecode_repo.alias} push ${'origin master' if h.is_git(c.rhodecode_repo) else ''} # push changes back
108 ${c.rhodecode_repo.alias} push ${'origin master' if h.is_git(c.rhodecode_repo) else ''} # push changes back
109 </pre>
109 </pre>
110 </div>
110 </div>
111 </div>
111 </div>
112 <div class="fieldset">
112 <div class="fieldset">
113 <div class="left-label">${_('Existing repository?')}</div>
113 <div class="left-label">${_('Existing repository?')}</div>
114 <div class="right-content">
114 <div class="right-content">
115 <pre>
115 <pre>
116 %if h.is_git(c.rhodecode_repo):
116 %if h.is_git(c.rhodecode_repo):
117 git remote add origin ${c.clone_repo_url}
117 git remote add origin ${c.clone_repo_url}
118 git push -u origin master
118 git push -u origin master
119 %else:
119 %else:
120 hg push ${c.clone_repo_url}
120 hg push ${c.clone_repo_url}
121 %endif
121 %endif
122 </pre>
122 </pre>
123 </div>
123 </div>
124 </div>
124 </div>
125 %endif
125 %endif
126 </div>
126 </div>
127 %endif
127 %endif
@@ -1,336 +1,333 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title(*args)">
3 <%def name="title(*args)">
4 ${_('%s Files') % c.repo_name}
4 ${_('%s Files') % c.repo_name}
5 %if hasattr(c,'file'):
5 %if hasattr(c,'file'):
6 &middot; ${h.safe_unicode(c.file.path) or '\\'}
6 &middot; ${h.safe_unicode(c.file.path) or '\\'}
7 %endif
7 %endif
8
8
9 %if c.rhodecode_name:
9 %if c.rhodecode_name:
10 &middot; ${h.branding(c.rhodecode_name)}
10 &middot; ${h.branding(c.rhodecode_name)}
11 %endif
11 %endif
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()">
14 <%def name="breadcrumbs_links()">
15 ${_('Files')}
15 ${_('Files')}
16 %if c.file:
16 %if c.file:
17 @ ${h.show_id(c.commit)}
17 @ ${h.show_id(c.commit)}
18 %endif
18 %endif
19 </%def>
19 </%def>
20
20
21 <%def name="menu_bar_nav()">
21 <%def name="menu_bar_nav()">
22 ${self.menu_items(active='repositories')}
22 ${self.menu_items(active='repositories')}
23 </%def>
23 </%def>
24
24
25 <%def name="menu_bar_subnav()">
25 <%def name="menu_bar_subnav()">
26 ${self.repo_menu(active='files')}
26 ${self.repo_menu(active='files')}
27 </%def>
27 </%def>
28
28
29 <%def name="main()">
29 <%def name="main()">
30 <div class="title">
30 <div class="title">
31 ${self.repo_page_title(c.rhodecode_db_repo)}
31 ${self.repo_page_title(c.rhodecode_db_repo)}
32 </div>
32 </div>
33
33
34 <div id="pjax-container" class="summary">
34 <div id="pjax-container" class="summary">
35 <div id="files_data">
35 <div id="files_data">
36 <%include file='files_pjax.html'/>
36 <%include file='files_pjax.html'/>
37 </div>
37 </div>
38 </div>
38 </div>
39 <script>
39 <script>
40 var curState = {
40 var curState = {
41 commit_id: "${c.commit.raw_id}"
41 commit_id: "${c.commit.raw_id}"
42 };
42 };
43
43
44 var getState = function(context) {
44 var getState = function(context) {
45 var url = $(location).attr('href');
45 var url = $(location).attr('href');
46 var _base_url = '${h.url("files_home",repo_name=c.repo_name,revision='',f_path='')}';
46 var _base_url = '${h.url("files_home",repo_name=c.repo_name,revision='',f_path='')}';
47 var _annotate_url = '${h.url("files_annotate_home",repo_name=c.repo_name,revision='',f_path='')}';
47 var _annotate_url = '${h.url("files_annotate_home",repo_name=c.repo_name,revision='',f_path='')}';
48 _base_url = _base_url.replace('//', '/');
48 _base_url = _base_url.replace('//', '/');
49 _annotate_url = _annotate_url.replace('//', '/');
49 _annotate_url = _annotate_url.replace('//', '/');
50
50
51 //extract f_path from url.
51 //extract f_path from url.
52 var parts = url.split(_base_url);
52 var parts = url.split(_base_url);
53 if (parts.length != 2) {
53 if (parts.length != 2) {
54 parts = url.split(_annotate_url);
54 parts = url.split(_annotate_url);
55 if (parts.length != 2) {
55 if (parts.length != 2) {
56 var rev = "tip";
56 var rev = "tip";
57 var f_path = "";
57 var f_path = "";
58 } else {
58 } else {
59 var parts2 = parts[1].split('/');
59 var parts2 = parts[1].split('/');
60 var rev = parts2.shift(); // pop the first element which is the revision
60 var rev = parts2.shift(); // pop the first element which is the revision
61 var f_path = parts2.join('/');
61 var f_path = parts2.join('/');
62 }
62 }
63
63
64 } else {
64 } else {
65 var parts2 = parts[1].split('/');
65 var parts2 = parts[1].split('/');
66 var rev = parts2.shift(); // pop the first element which is the revision
66 var rev = parts2.shift(); // pop the first element which is the revision
67 var f_path = parts2.join('/');
67 var f_path = parts2.join('/');
68 }
68 }
69
69
70 var _node_list_url = pyroutes.url('files_nodelist_home',
70 var _node_list_url = pyroutes.url('files_nodelist_home',
71 {repo_name: templateContext.repo_name,
71 {repo_name: templateContext.repo_name,
72 revision: rev, f_path: f_path});
72 revision: rev, f_path: f_path});
73 var _url_base = pyroutes.url('files_home',
73 var _url_base = pyroutes.url('files_home',
74 {repo_name: templateContext.repo_name,
74 {repo_name: templateContext.repo_name,
75 revision: rev, f_path:'__FPATH__'});
75 revision: rev, f_path:'__FPATH__'});
76 return {
76 return {
77 url: url,
77 url: url,
78 f_path: f_path,
78 f_path: f_path,
79 rev: rev,
79 rev: rev,
80 commit_id: curState.commit_id,
80 commit_id: curState.commit_id,
81 node_list_url: _node_list_url,
81 node_list_url: _node_list_url,
82 url_base: _url_base
82 url_base: _url_base
83 };
83 };
84 };
84 };
85
85
86 var metadataRequest = null;
86 var metadataRequest = null;
87 var getFilesMetadata = function() {
87 var getFilesMetadata = function() {
88 if (metadataRequest && metadataRequest.readyState != 4) {
88 if (metadataRequest && metadataRequest.readyState != 4) {
89 metadataRequest.abort();
89 metadataRequest.abort();
90 }
90 }
91 if (source_page) {
91 if (source_page) {
92 return false;
92 return false;
93 }
93 }
94 var state = getState('metadata');
94 var state = getState('metadata');
95 var url_data = {
95 var url_data = {
96 'repo_name': templateContext.repo_name,
96 'repo_name': templateContext.repo_name,
97 'revision': state.commit_id,
97 'revision': state.commit_id,
98 'f_path': state.f_path
98 'f_path': state.f_path
99 };
99 };
100
100
101 var url = pyroutes.url('files_metadata_list_home', url_data);
101 var url = pyroutes.url('files_metadata_list_home', url_data);
102
102
103 metadataRequest = $.ajax({url: url});
103 metadataRequest = $.ajax({url: url});
104
104
105 metadataRequest.done(function(data) {
105 metadataRequest.done(function(data) {
106 var data = data.metadata;
106 var data = data.metadata;
107 var dataLength = data.length;
107 var dataLength = data.length;
108 for (var i = 0; i < dataLength; i++) {
108 for (var i = 0; i < dataLength; i++) {
109 var rowData = data[i];
109 var rowData = data[i];
110 var name = rowData.name.replace('\\', '\\\\');
110 var name = rowData.name.replace('\\', '\\\\');
111
111
112 $('td[title="size-' + name + '"]').html(rowData.size);
112 $('td[title="size-' + name + '"]').html(rowData.size);
113 var timeComponent = AgeModule.createTimeComponent(
113 var timeComponent = AgeModule.createTimeComponent(
114 rowData.modified_ts, rowData.modified_at);
114 rowData.modified_ts, rowData.modified_at);
115 $('td[title="modified_at-' + name + '"]').html(timeComponent);
115 $('td[title="modified_at-' + name + '"]').html(timeComponent);
116
116
117 $('td[title="revision-' + name + '"]').html(
117 $('td[title="revision-' + name + '"]').html(
118 '<div class="tooltip" title="{0}"><pre>r{1}:{2}</pre></div>'.format(
118 '<div class="tooltip" title="{0}"><pre>r{1}:{2}</pre></div>'.format(
119 data[i].message, data[i].revision, data[i].short_id));
119 data[i].message, data[i].revision, data[i].short_id));
120 $('td[title="author-' + name + '"]').html(
120 $('td[title="author-' + name + '"]').html(
121 '<span title="{0}">{1}</span>'.format(
121 '<span title="{0}">{1}</span>'.format(
122 data[i].author, data[i].user_profile));
122 data[i].author, data[i].user_profile));
123 }
123 }
124 tooltip_activate();
125 timeagoActivate();
124 timeagoActivate();
126 });
125 });
127 metadataRequest.fail(function (data, textStatus, errorThrown) {
126 metadataRequest.fail(function (data, textStatus, errorThrown) {
128 console.log(data);
127 console.log(data);
129 if (data.status != 0) {
128 if (data.status != 0) {
130 alert("Error while fetching metadata.\nError code {0} ({1}).Please consider reloading the page".format(data.status,data.statusText));
129 alert("Error while fetching metadata.\nError code {0} ({1}).Please consider reloading the page".format(data.status,data.statusText));
131 }
130 }
132 });
131 });
133 };
132 };
134
133
135 var callbacks = function() {
134 var callbacks = function() {
136 var state = getState('callbacks');
135 var state = getState('callbacks');
137 tooltip_activate();
138 timeagoActivate();
136 timeagoActivate();
139
137
140 // used for history, and switch to
138 // used for history, and switch to
141 var initialCommitData = {
139 var initialCommitData = {
142 id: null,
140 id: null,
143 text: "${_("Switch To Commit")}",
141 text: "${_("Switch To Commit")}",
144 type: 'sha',
142 type: 'sha',
145 raw_id: null,
143 raw_id: null,
146 files_url: null
144 files_url: null
147 };
145 };
148
146
149 if ($('#trimmed_message_box').height() < 50) {
147 if ($('#trimmed_message_box').height() < 50) {
150 $('#message_expand').hide();
148 $('#message_expand').hide();
151 }
149 }
152
150
153 $('#message_expand').on('click', function(e) {
151 $('#message_expand').on('click', function(e) {
154 $('#trimmed_message_box').css('max-height', 'none');
152 $('#trimmed_message_box').css('max-height', 'none');
155 $(this).hide();
153 $(this).hide();
156 });
154 });
157
155
158
156
159 if (source_page) {
157 if (source_page) {
160 // variants for with source code, not tree view
158 // variants for with source code, not tree view
161
159
162 if (location.href.indexOf('#') != -1) {
160 if (location.href.indexOf('#') != -1) {
163 page_highlights = location.href.substring(location.href.indexOf('#') + 1).split('L');
161 page_highlights = location.href.substring(location.href.indexOf('#') + 1).split('L');
164 if (page_highlights.length == 2) {
162 if (page_highlights.length == 2) {
165 highlight_ranges = page_highlights[1].split(",");
163 highlight_ranges = page_highlights[1].split(",");
166
164
167 var h_lines = [];
165 var h_lines = [];
168 for (pos in highlight_ranges) {
166 for (pos in highlight_ranges) {
169 var _range = highlight_ranges[pos].split('-');
167 var _range = highlight_ranges[pos].split('-');
170 if (_range.length == 2) {
168 if (_range.length == 2) {
171 var start = parseInt(_range[0]);
169 var start = parseInt(_range[0]);
172 var end = parseInt(_range[1]);
170 var end = parseInt(_range[1]);
173 if (start < end) {
171 if (start < end) {
174 for (var i = start; i <= end; i++) {
172 for (var i = start; i <= end; i++) {
175 h_lines.push(i);
173 h_lines.push(i);
176 }
174 }
177 }
175 }
178 }
176 }
179 else {
177 else {
180 h_lines.push(parseInt(highlight_ranges[pos]));
178 h_lines.push(parseInt(highlight_ranges[pos]));
181 }
179 }
182 }
180 }
183
181
184 for (pos in h_lines) {
182 for (pos in h_lines) {
185 // @comment-highlight-color
183 // @comment-highlight-color
186 $('#L' + h_lines[pos]).css('background-color', '#ffd887');
184 $('#L' + h_lines[pos]).css('background-color', '#ffd887');
187 }
185 }
188
186
189 var _first_line = $('#L' + h_lines[0]).get(0);
187 var _first_line = $('#L' + h_lines[0]).get(0);
190 if (_first_line) {
188 if (_first_line) {
191 var line = $('#L' + h_lines[0]);
189 var line = $('#L' + h_lines[0]);
192 offsetScroll(line, 70);
190 offsetScroll(line, 70);
193 }
191 }
194 }
192 }
195 }
193 }
196
194
197 // select code link event
195 // select code link event
198 $("#hlcode").mouseup(getSelectionLink);
196 $("#hlcode").mouseup(getSelectionLink);
199
197
200 // file history select2
198 // file history select2
201 select2FileHistorySwitcher('#diff1', initialCommitData, state);
199 select2FileHistorySwitcher('#diff1', initialCommitData, state);
202 $('#diff1').on('change', function(e) {
200 $('#diff1').on('change', function(e) {
203 $('#diff').removeClass('disabled').removeAttr("disabled");
201 $('#diff').removeClass('disabled').removeAttr("disabled");
204 $('#show_rev').removeClass('disabled').removeAttr("disabled");
202 $('#show_rev').removeClass('disabled').removeAttr("disabled");
205 });
203 });
206
204
207 // show more authors
205 // show more authors
208 $('#show_authors').on('click', function(e) {
206 $('#show_authors').on('click', function(e) {
209 e.preventDefault();
207 e.preventDefault();
210 var url = pyroutes.url('files_authors_home',
208 var url = pyroutes.url('files_authors_home',
211 {'repo_name': templateContext.repo_name,
209 {'repo_name': templateContext.repo_name,
212 'revision': state.rev, 'f_path': state.f_path});
210 'revision': state.rev, 'f_path': state.f_path});
213
211
214 $.pjax({
212 $.pjax({
215 url: url,
213 url: url,
216 data: 'annotate=${"1" if c.annotate else "0"}',
214 data: 'annotate=${"1" if c.annotate else "0"}',
217 container: '#file_authors',
215 container: '#file_authors',
218 push: false,
216 push: false,
219 timeout: pjaxTimeout
217 timeout: pjaxTimeout
220 }).complete(function(){
218 }).complete(function(){
221 $('#show_authors').hide();
219 $('#show_authors').hide();
222 })
220 })
223 });
221 });
224
222
225 // load file short history
223 // load file short history
226 $('#file_history_overview').on('click', function(e) {
224 $('#file_history_overview').on('click', function(e) {
227 e.preventDefault();
225 e.preventDefault();
228 path = state.f_path;
226 path = state.f_path;
229 if (path.indexOf("#") >= 0) {
227 if (path.indexOf("#") >= 0) {
230 path = path.slice(0, path.indexOf("#"));
228 path = path.slice(0, path.indexOf("#"));
231 }
229 }
232 var url = pyroutes.url('changelog_file_home',
230 var url = pyroutes.url('changelog_file_home',
233 {'repo_name': templateContext.repo_name,
231 {'repo_name': templateContext.repo_name,
234 'revision': state.rev, 'f_path': path, 'limit': 6});
232 'revision': state.rev, 'f_path': path, 'limit': 6});
235 $('#file_history_container').show();
233 $('#file_history_container').show();
236 $('#file_history_container').html('<div class="file-history-inner">{0}</div>'.format(_gettext('Loading ...')));
234 $('#file_history_container').html('<div class="file-history-inner">{0}</div>'.format(_gettext('Loading ...')));
237
235
238 $.pjax({
236 $.pjax({
239 url: url,
237 url: url,
240 container: '#file_history_container',
238 container: '#file_history_container',
241 push: false,
239 push: false,
242 timeout: pjaxTimeout
240 timeout: pjaxTimeout
243 })
241 })
244 });
242 });
245
243
246 }
244 }
247 else {
245 else {
248 getFilesMetadata();
246 getFilesMetadata();
249
247
250 // fuzzy file filter
248 // fuzzy file filter
251 fileBrowserListeners(state.node_list_url, state.url_base);
249 fileBrowserListeners(state.node_list_url, state.url_base);
252
250
253 // switch to widget
251 // switch to widget
254 select2RefSwitcher('#refs_filter', initialCommitData);
252 select2RefSwitcher('#refs_filter', initialCommitData);
255 $('#refs_filter').on('change', function(e) {
253 $('#refs_filter').on('change', function(e) {
256 var data = $('#refs_filter').select2('data');
254 var data = $('#refs_filter').select2('data');
257 curState.commit_id = data.raw_id;
255 curState.commit_id = data.raw_id;
258 $.pjax({url: data.files_url, container: '#pjax-container', timeout: pjaxTimeout});
256 $.pjax({url: data.files_url, container: '#pjax-container', timeout: pjaxTimeout});
259 });
257 });
260
258
261 $("#prev_commit_link").on('click', function(e) {
259 $("#prev_commit_link").on('click', function(e) {
262 var data = $(this).data();
260 var data = $(this).data();
263 curState.commit_id = data.commitId;
261 curState.commit_id = data.commitId;
264 });
262 });
265
263
266 $("#next_commit_link").on('click', function(e) {
264 $("#next_commit_link").on('click', function(e) {
267 var data = $(this).data();
265 var data = $(this).data();
268 curState.commit_id = data.commitId;
266 curState.commit_id = data.commitId;
269 });
267 });
270
268
271 $('#at_rev').on("keypress", function(e) {
269 $('#at_rev').on("keypress", function(e) {
272 /* ENTER PRESSED */
270 /* ENTER PRESSED */
273 if (e.keyCode === 13) {
271 if (e.keyCode === 13) {
274 var rev = $('#at_rev').val();
272 var rev = $('#at_rev').val();
275 // explicit reload page here. with pjax entering bad input
273 // explicit reload page here. with pjax entering bad input
276 // produces not so nice results
274 // produces not so nice results
277 window.location = pyroutes.url('files_home',
275 window.location = pyroutes.url('files_home',
278 {'repo_name': templateContext.repo_name,
276 {'repo_name': templateContext.repo_name,
279 'revision': rev, 'f_path': state.f_path});
277 'revision': rev, 'f_path': state.f_path});
280 }
278 }
281 });
279 });
282 }
280 }
283 };
281 };
284
282
285 var pjaxTimeout = 5000;
283 var pjaxTimeout = 5000;
286
284
287 $(document).pjax(".pjax-link", "#pjax-container", {
285 $(document).pjax(".pjax-link", "#pjax-container", {
288 "fragment": "#pjax-content",
286 "fragment": "#pjax-content",
289 "maxCacheLength": 1000,
287 "maxCacheLength": 1000,
290 "timeout": pjaxTimeout
288 "timeout": pjaxTimeout
291 });
289 });
292
290
293 // define global back/forward states
291 // define global back/forward states
294 var isPjaxPopState = false;
292 var isPjaxPopState = false;
295 $(document).on('pjax:popstate', function() {
293 $(document).on('pjax:popstate', function() {
296 isPjaxPopState = true;
294 isPjaxPopState = true;
297 });
295 });
298
296
299 $(document).on('pjax:end', function(xhr, options) {
297 $(document).on('pjax:end', function(xhr, options) {
300 if (isPjaxPopState) {
298 if (isPjaxPopState) {
301 isPjaxPopState = false;
299 isPjaxPopState = false;
302 callbacks();
300 callbacks();
303 _NODEFILTER.resetFilter();
301 _NODEFILTER.resetFilter();
304 }
302 }
305
303
306 // run callback for tracking if defined for google analytics etc.
304 // run callback for tracking if defined for google analytics etc.
307 // this is used to trigger tracking on pjax
305 // this is used to trigger tracking on pjax
308 if (typeof window.rhodecode_statechange_callback !== 'undefined') {
306 if (typeof window.rhodecode_statechange_callback !== 'undefined') {
309 var state = getState('statechange');
307 var state = getState('statechange');
310 rhodecode_statechange_callback(state.url, null)
308 rhodecode_statechange_callback(state.url, null)
311 }
309 }
312 });
310 });
313
311
314 $(document).on('pjax:success', function(event, xhr, options) {
312 $(document).on('pjax:success', function(event, xhr, options) {
315 if (event.target.id == "file_history_container") {
313 if (event.target.id == "file_history_container") {
316 $('#file_history_overview').hide();
314 $('#file_history_overview').hide();
317 $('#file_history_overview_full').show();
315 $('#file_history_overview_full').show();
318 timeagoActivate();
316 timeagoActivate();
319 tooltip_activate();
320 } else {
317 } else {
321 callbacks();
318 callbacks();
322 }
319 }
323 });
320 });
324
321
325 $(document).ready(function() {
322 $(document).ready(function() {
326 callbacks();
323 callbacks();
327 var search_GET = "${request.GET.get('search','')}";
324 var search_GET = "${request.GET.get('search','')}";
328 if (search_GET == "1") {
325 if (search_GET == "1") {
329 _NODEFILTER.initFilter();
326 _NODEFILTER.initFilter();
330 }
327 }
331 });
328 });
332
329
333 </script>
330 </script>
334
331
335
332
336 </%def>
333 </%def>
@@ -1,31 +1,29 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.html"/>
2 <%namespace name="base" file="/base/base.html"/>
3 <table class="rctable followers_data">
3 <table class="rctable followers_data">
4 <tr>
4 <tr>
5 <th>${_('Follower Name')}</th>
5 <th>${_('Follower Name')}</th>
6 <th>${_('Following Since')}</th>
6 <th>${_('Following Since')}</th>
7 </tr>
7 </tr>
8 % for f in c.followers_pager:
8 % for f in c.followers_pager:
9 <tr>
9 <tr>
10 <td class="td-user follower_user">
10 <td class="td-user follower_user">
11 ${base.gravatar_with_user(f.user.email, 16)}
11 ${base.gravatar_with_user(f.user.email, 16)}
12 </td>
12 </td>
13 <td class="td-time follower_date">
13 <td class="td-time follower_date">
14 ${h.age_component(f.follows_from, time_is_local=True)}
14 ${h.age_component(f.follows_from, time_is_local=True)}
15 </td>
15 </td>
16 </tr>
16 </tr>
17 % endfor
17 % endfor
18 </table>
18 </table>
19
19
20 <div class="pagination-wh pagination-left">
20 <div class="pagination-wh pagination-left">
21 <script type="text/javascript">
21 <script type="text/javascript">
22 $(document).pjax('#followers.pager_link','#followers');
22 $(document).pjax('#followers.pager_link','#followers');
23 $(document).on('pjax:success',function(){
23 $(document).on('pjax:success',function(){
24 show_more_event();
24 show_more_event();
25 timeagoActivate();
25 timeagoActivate();
26 tooltip_activate();
27 show_changeset_tooltip();
28 });
26 });
29 </script>
27 </script>
30 ${c.followers_pager.pager('$link_previous ~2~ $link_next')}
28 ${c.followers_pager.pager('$link_previous ~2~ $link_next')}
31 </div>
29 </div>
@@ -1,49 +1,47 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.html"/>
2 <%namespace name="base" file="/base/base.html"/>
3
3
4 % if c.forks_pager:
4 % if c.forks_pager:
5 <table class="rctable fork_summary">
5 <table class="rctable fork_summary">
6 <tr>
6 <tr>
7 <th>${_('Owner')}</th>
7 <th>${_('Owner')}</th>
8 <th>${_('Fork')}</th>
8 <th>${_('Fork')}</th>
9 <th>${_('Description')}</th>
9 <th>${_('Description')}</th>
10 <th>${_('Forked')}</th>
10 <th>${_('Forked')}</th>
11 <th></th>
11 <th></th>
12 </tr>
12 </tr>
13 % for f in c.forks_pager:
13 % for f in c.forks_pager:
14 <tr>
14 <tr>
15 <td class="td-user fork_user">
15 <td class="td-user fork_user">
16 ${base.gravatar_with_user(f.user.email, 16)}
16 ${base.gravatar_with_user(f.user.email, 16)}
17 </td>
17 </td>
18 <td class="td-componentname">
18 <td class="td-componentname">
19 ${h.link_to(f.repo_name,h.url('summary_home',repo_name=f.repo_name))}
19 ${h.link_to(f.repo_name,h.url('summary_home',repo_name=f.repo_name))}
20 </td>
20 </td>
21 <td class="td-description">
21 <td class="td-description">
22 <div class="truncate">${f.description}</div>
22 <div class="truncate">${f.description}</div>
23 </td>
23 </td>
24 <td class="td-time follower_date">
24 <td class="td-time follower_date">
25 ${h.age_component(f.created_on, time_is_local=True)}
25 ${h.age_component(f.created_on, time_is_local=True)}
26 </td>
26 </td>
27 <td class="td-compare">
27 <td class="td-compare">
28 <a title="${_('Compare fork with %s' % c.repo_name)}"
28 <a title="${_('Compare fork with %s' % c.repo_name)}"
29 href="${h.url('compare_url',repo_name=c.repo_name, source_ref_type=c.rhodecode_db_repo.landing_rev[0],source_ref=c.rhodecode_db_repo.landing_rev[1],target_repo=f.repo_name,target_ref_type=c.rhodecode_db_repo.landing_rev[0],target_ref=c.rhodecode_db_repo.landing_rev[1], merge=1)}"
29 href="${h.url('compare_url',repo_name=c.repo_name, source_ref_type=c.rhodecode_db_repo.landing_rev[0],source_ref=c.rhodecode_db_repo.landing_rev[1],target_repo=f.repo_name,target_ref_type=c.rhodecode_db_repo.landing_rev[0],target_ref=c.rhodecode_db_repo.landing_rev[1], merge=1)}"
30 class="btn-link"><i class="icon-loop"></i> ${_('Compare fork')}</a>
30 class="btn-link"><i class="icon-loop"></i> ${_('Compare fork')}</a>
31 </td>
31 </td>
32 </tr>
32 </tr>
33 % endfor
33 % endfor
34 </table>
34 </table>
35 <div class="pagination-wh pagination-left">
35 <div class="pagination-wh pagination-left">
36 <script type="text/javascript">
36 <script type="text/javascript">
37 $(document).pjax('#forks .pager_link','#forks');
37 $(document).pjax('#forks .pager_link','#forks');
38 $(document).on('pjax:success',function(){
38 $(document).on('pjax:success',function(){
39 show_more_event();
39 show_more_event();
40 timeagoActivate();
40 timeagoActivate();
41 tooltip_activate();
42 show_changeset_tooltip();
43 });
41 });
44 </script>
42 </script>
45 ${c.forks_pager.pager('$link_previous ~2~ $link_next')}
43 ${c.forks_pager.pager('$link_previous ~2~ $link_next')}
46 </div>
44 </div>
47 % else:
45 % else:
48 ${_('There are no forks yet')}
46 ${_('There are no forks yet')}
49 % endif
47 % endif
@@ -1,172 +1,170 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="main()">
3 <%def name="main()">
4 <div class="box">
4 <div class="box">
5 <!-- box / title -->
5 <!-- box / title -->
6 <div class="title">
6 <div class="title">
7 <div class="block-left breadcrumbs">
7 <div class="block-left breadcrumbs">
8 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
8 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
9 ${self.breadcrumbs()}
9 ${self.breadcrumbs()}
10 <span id="match_container" style="display:none">&raquo; <span id="match_count">0</span> ${_('matches')}</span>
10 <span id="match_container" style="display:none">&raquo; <span id="match_count">0</span> ${_('matches')}</span>
11 </div>
11 </div>
12 %if c.rhodecode_user.username != h.DEFAULT_USER:
12 %if c.rhodecode_user.username != h.DEFAULT_USER:
13 <div class="block-right">
13 <div class="block-right">
14 <%
14 <%
15 is_admin = h.HasPermissionAny('hg.admin')('can create repos index page')
15 is_admin = h.HasPermissionAny('hg.admin')('can create repos index page')
16 create_repo = h.HasPermissionAny('hg.create.repository')('can create repository index page')
16 create_repo = h.HasPermissionAny('hg.create.repository')('can create repository index page')
17 create_repo_group = h.HasPermissionAny('hg.repogroup.create.true')('can create repository groups index page')
17 create_repo_group = h.HasPermissionAny('hg.repogroup.create.true')('can create repository groups index page')
18 create_user_group = h.HasPermissionAny('hg.usergroup.create.true')('can create user groups index page')
18 create_user_group = h.HasPermissionAny('hg.usergroup.create.true')('can create user groups index page')
19
19
20 gr_name = c.repo_group.group_name if c.repo_group else None
20 gr_name = c.repo_group.group_name if c.repo_group else None
21 # create repositories with write permission on group is set to true
21 # create repositories with write permission on group is set to true
22 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
22 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
23 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
23 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
24 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
24 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
25 %>
25 %>
26
26
27 %if not c.repo_group:
27 %if not c.repo_group:
28 ## no repository group context here
28 ## no repository group context here
29 %if is_admin or create_repo:
29 %if is_admin or create_repo:
30 <a href="${h.url('new_repo')}" class="btn btn-small btn-success btn-primary">${_('Add Repository')}</a>
30 <a href="${h.url('new_repo')}" class="btn btn-small btn-success btn-primary">${_('Add Repository')}</a>
31 %endif
31 %endif
32
32
33 %if is_admin or create_repo_group:
33 %if is_admin or create_repo_group:
34 <a href="${h.url('new_repo_group')}" class="btn btn-small btn-default">${_(u'Add Repository Group')}</a>
34 <a href="${h.url('new_repo_group')}" class="btn btn-small btn-default">${_(u'Add Repository Group')}</a>
35 %endif
35 %endif
36 %else:
36 %else:
37 ##we're inside other repository group other terms apply
37 ##we're inside other repository group other terms apply
38 %if is_admin or group_admin or (group_write and create_on_write):
38 %if is_admin or group_admin or (group_write and create_on_write):
39 <a href="${h.url('new_repo',parent_group=c.repo_group.group_id)}" class="btn btn-small btn-success btn-primary">${_('Add Repository')}</a>
39 <a href="${h.url('new_repo',parent_group=c.repo_group.group_id)}" class="btn btn-small btn-success btn-primary">${_('Add Repository')}</a>
40 %endif
40 %endif
41 %if is_admin or group_admin:
41 %if is_admin or group_admin:
42 <a href="${h.url('new_repo_group', parent_group=c.repo_group.group_id)}" class="btn btn-small btn-default">${_(u'Add Repository Group')}</a>
42 <a href="${h.url('new_repo_group', parent_group=c.repo_group.group_id)}" class="btn btn-small btn-default">${_(u'Add Repository Group')}</a>
43 %endif
43 %endif
44 %if is_admin or group_admin:
44 %if is_admin or group_admin:
45 <a href="${h.url('edit_repo_group',group_name=c.repo_group.group_name)}" title="${_('You have admin right to this group, and can edit it')}" class="btn btn-small btn-primary">${_('Edit Repository Group')}</a>
45 <a href="${h.url('edit_repo_group',group_name=c.repo_group.group_name)}" title="${_('You have admin right to this group, and can edit it')}" class="btn btn-small btn-primary">${_('Edit Repository Group')}</a>
46 %endif
46 %endif
47 %endif
47 %endif
48 </div>
48 </div>
49 %endif
49 %endif
50 </div>
50 </div>
51 <!-- end box / title -->
51 <!-- end box / title -->
52 <div class="table">
52 <div class="table">
53 <div id="groups_list_wrap">
53 <div id="groups_list_wrap">
54 <table id="group_list_table" class="display"></table>
54 <table id="group_list_table" class="display"></table>
55 </div>
55 </div>
56 </div>
56 </div>
57
57
58 <div class="table">
58 <div class="table">
59 <div id="repos_list_wrap">
59 <div id="repos_list_wrap">
60 <table id="repo_list_table" class="display"></table>
60 <table id="repo_list_table" class="display"></table>
61 </div>
61 </div>
62 </div>
62 </div>
63 </div>
63 </div>
64 <script>
64 <script>
65 $(document).ready(function() {
65 $(document).ready(function() {
66
66
67 var get_datatable_count = function() {
67 var get_datatable_count = function() {
68 var api = $('#repo_list_table').dataTable().api();
68 var api = $('#repo_list_table').dataTable().api();
69 var pageInfo = api.page.info();
69 var pageInfo = api.page.info();
70 var repos = pageInfo.recordsDisplay;
70 var repos = pageInfo.recordsDisplay;
71 var reposTotal = pageInfo.recordsTotal;
71 var reposTotal = pageInfo.recordsTotal;
72
72
73 api = $('#group_list_table').dataTable().api();
73 api = $('#group_list_table').dataTable().api();
74 pageInfo = api.page.info();
74 pageInfo = api.page.info();
75 var repoGroups = pageInfo.recordsDisplay;
75 var repoGroups = pageInfo.recordsDisplay;
76 var repoGroupsTotal = pageInfo.recordsTotal;
76 var repoGroupsTotal = pageInfo.recordsTotal;
77
77
78 if (repoGroups !== repoGroupsTotal) {
78 if (repoGroups !== repoGroupsTotal) {
79 $('#match_count').text(repos+repoGroups);
79 $('#match_count').text(repos+repoGroups);
80 }
80 }
81 if (repos !== reposTotal) {
81 if (repos !== reposTotal) {
82 $('#match_container').show();
82 $('#match_container').show();
83 }
83 }
84 if ($('#q_filter').val() === '') {
84 if ($('#q_filter').val() === '') {
85 $('#match_container').hide();
85 $('#match_container').hide();
86 }
86 }
87 };
87 };
88
88
89 // repo group list
89 // repo group list
90 $('#group_list_table').DataTable({
90 $('#group_list_table').DataTable({
91 data: ${c.repo_groups_data|n},
91 data: ${c.repo_groups_data|n},
92 dom: 'rtp',
92 dom: 'rtp',
93 pageLength: ${c.visual.dashboard_items},
93 pageLength: ${c.visual.dashboard_items},
94 order: [[ 0, "asc" ]],
94 order: [[ 0, "asc" ]],
95 columns: [
95 columns: [
96 { data: {"_": "name",
96 { data: {"_": "name",
97 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
97 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" },
98 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
98 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
99 { data: {"_": "desc",
99 { data: {"_": "desc",
100 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
100 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
101 { data: {"_": "owner",
101 { data: {"_": "owner",
102 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" }
102 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" }
103 ],
103 ],
104 language: {
104 language: {
105 paginate: DEFAULT_GRID_PAGINATION
105 paginate: DEFAULT_GRID_PAGINATION
106 },
106 },
107 "drawCallback": function( settings, json ) {
107 "drawCallback": function( settings, json ) {
108 timeagoActivate();
108 timeagoActivate();
109 tooltip_activate();
110 quick_repo_menu();
109 quick_repo_menu();
111 }
110 }
112 });
111 });
113
112
114 // repo list
113 // repo list
115 $('#repo_list_table').DataTable({
114 $('#repo_list_table').DataTable({
116 data: ${c.repos_data|n},
115 data: ${c.repos_data|n},
117 dom: 'rtp',
116 dom: 'rtp',
118 order: [[ 0, "asc" ]],
117 order: [[ 0, "asc" ]],
119 pageLength: ${c.visual.dashboard_items},
118 pageLength: ${c.visual.dashboard_items},
120 columns: [
119 columns: [
121 { data: {"_": "name",
120 { data: {"_": "name",
122 "sort": "name_raw"}, title: "${_('Name')}", className: "truncate-wrap td-componentname" },
121 "sort": "name_raw"}, title: "${_('Name')}", className: "truncate-wrap td-componentname" },
123 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
122 { data: 'menu', "bSortable": false, className: "quick_repo_menu" },
124 { data: {"_": "desc",
123 { data: {"_": "desc",
125 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
124 "sort": "desc"}, title: "${_('Description')}", className: "td-description" },
126 { data: {"_": "last_change",
125 { data: {"_": "last_change",
127 "sort": "last_change_raw",
126 "sort": "last_change_raw",
128 "type": Number}, title: "${_('Last Change')}", className: "td-time" },
127 "type": Number}, title: "${_('Last Change')}", className: "td-time" },
129 { data: {"_": "last_changeset",
128 { data: {"_": "last_changeset",
130 "sort": "last_changeset_raw",
129 "sort": "last_changeset_raw",
131 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
130 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
132 { data: {"_": "owner",
131 { data: {"_": "owner",
133 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
132 "sort": "owner"}, title: "${_('Owner')}", className: "td-user" },
134 { data: {"_": "rss",
133 { data: {"_": "rss",
135 "sort": "rss"}, title: "rss", className: "td-rss" }
134 "sort": "rss"}, title: "rss", className: "td-rss" }
136 ],
135 ],
137 language: {
136 language: {
138 paginate: DEFAULT_GRID_PAGINATION
137 paginate: DEFAULT_GRID_PAGINATION
139 },
138 },
140 "drawCallback": function( settings, json ) {
139 "drawCallback": function( settings, json ) {
141 timeagoActivate();
140 timeagoActivate();
142 tooltip_activate();
143 quick_repo_menu();
141 quick_repo_menu();
144 }
142 }
145 });
143 });
146
144
147 // update the counter when doing search
145 // update the counter when doing search
148 $('#repo_list_table, #group_list_table').on( 'search.dt', function (e,settings) {
146 $('#repo_list_table, #group_list_table').on( 'search.dt', function (e,settings) {
149 get_datatable_count();
147 get_datatable_count();
150 });
148 });
151
149
152 // filter, filter both grids
150 // filter, filter both grids
153 $('#q_filter').on( 'keyup', function () {
151 $('#q_filter').on( 'keyup', function () {
154 var repo_api = $('#repo_list_table').dataTable().api();
152 var repo_api = $('#repo_list_table').dataTable().api();
155 repo_api
153 repo_api
156 .columns( 0 )
154 .columns( 0 )
157 .search( this.value )
155 .search( this.value )
158 .draw();
156 .draw();
159
157
160 var repo_group_api = $('#group_list_table').dataTable().api();
158 var repo_group_api = $('#group_list_table').dataTable().api();
161 repo_group_api
159 repo_group_api
162 .columns( 0 )
160 .columns( 0 )
163 .search( this.value )
161 .search( this.value )
164 .draw();
162 .draw();
165 });
163 });
166
164
167 // refilter table if page load via back button
165 // refilter table if page load via back button
168 $("#q_filter").trigger('keyup');
166 $("#q_filter").trigger('keyup');
169
167
170 });
168 });
171 </script>
169 </script>
172 </%def>
170 </%def>
@@ -1,56 +1,54 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3 <%def name="title()">
3 <%def name="title()">
4 ${_('Journal')}
4 ${_('Journal')}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9 <%def name="breadcrumbs()">
9 <%def name="breadcrumbs()">
10 <h1 class="block-left">
10 <h1 class="block-left">
11 ${h.form(None, id_="filter_form", method="get")}
11 ${h.form(None, id_="filter_form", method="get")}
12 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term}" placeholder="${_('quick filter...')}"/>
12 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term}" placeholder="${_('quick filter...')}"/>
13 <input type='submit' value="${_('Filter')}" class="btn" />
13 <input type='submit' value="${_('Filter')}" class="btn" />
14 ${_('Journal')} - ${ungettext('%s entry', '%s entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
14 ${_('Journal')} - ${ungettext('%s entry', '%s entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
15 ${h.end_form()}
15 ${h.end_form()}
16 </h1>
16 </h1>
17 <p class="tooltip filterexample" title="${h.tooltip(h.journal_filter_help())}">${_('Example Queries')}</p>
17 <p class="tooltip filterexample" title="${h.tooltip(h.journal_filter_help())}">${_('Example Queries')}</p>
18 </%def>
18 </%def>
19 <%def name="menu_bar_nav()">
19 <%def name="menu_bar_nav()">
20 ${self.menu_items(active='journal')}
20 ${self.menu_items(active='journal')}
21 </%def>
21 </%def>
22 <%def name="head_extra()">
22 <%def name="head_extra()">
23 <link href="${h.url('journal_atom', auth_token=c.rhodecode_user.feed_token)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
23 <link href="${h.url('journal_atom', auth_token=c.rhodecode_user.feed_token)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
24 <link href="${h.url('journal_rss', auth_token=c.rhodecode_user.feed_token)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
24 <link href="${h.url('journal_rss', auth_token=c.rhodecode_user.feed_token)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
25 </%def>
25 </%def>
26 <%def name="main()">
26 <%def name="main()">
27
27
28 <div class="box">
28 <div class="box">
29 <!-- box / title -->
29 <!-- box / title -->
30 <div class="title journal">
30 <div class="title journal">
31 ${self.breadcrumbs()}
31 ${self.breadcrumbs()}
32 <ul class="links icon-only-links block-right">
32 <ul class="links icon-only-links block-right">
33 <li>
33 <li>
34 <span><a id="refresh" href="${h.url('journal')}"><i class="icon-refresh"></i></a></span>
34 <span><a id="refresh" href="${h.url('journal')}"><i class="icon-refresh"></i></a></span>
35 </li>
35 </li>
36 <li>
36 <li>
37 <span><a href="${h.url('journal_atom', auth_token=c.rhodecode_user.feed_token)}"><i class="icon-rss-sign"></i></a></span>
37 <span><a href="${h.url('journal_atom', auth_token=c.rhodecode_user.feed_token)}"><i class="icon-rss-sign"></i></a></span>
38 </li>
38 </li>
39 </ul>
39 </ul>
40 </div>
40 </div>
41 <div id="journal">${c.journal_data}</div>
41 <div id="journal">${c.journal_data}</div>
42 </div>
42 </div>
43
43
44 <script type="text/javascript">
44 <script type="text/javascript">
45
45
46 $('#j_filter').autoGrowInput();
46 $('#j_filter').autoGrowInput();
47 $(document).on('pjax:success',function(){
47 $(document).on('pjax:success',function(){
48 show_more_event();
48 show_more_event();
49 tooltip_activate();
50 show_changeset_tooltip();
51 });
49 });
52 $(document).pjax('#refresh', '#journal',
50 $(document).pjax('#refresh', '#journal',
53 {url: "${h.url.current(filter=c.search_term)}", push: false});
51 {url: "${h.url.current(filter=c.search_term)}", push: false});
54
52
55 </script>
53 </script>
56 </%def>
54 </%def>
@@ -1,55 +1,53 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.html"/>
2 <%namespace name="base" file="/base/base.html"/>
3
3
4 %if c.journal_day_aggreagate:
4 %if c.journal_day_aggreagate:
5 %for day,items in c.journal_day_aggreagate:
5 %for day,items in c.journal_day_aggreagate:
6 <div class="journal_day">${day}</div>
6 <div class="journal_day">${day}</div>
7 % for user,entries in items:
7 % for user,entries in items:
8 <div class="journal_container">
8 <div class="journal_container">
9 ${base.gravatar(user.email if user else '', 30)}
9 ${base.gravatar(user.email if user else '', 30)}
10 %if user:
10 %if user:
11 <div class="journal_user user">${h.link_to_user(user.username)}</div>
11 <div class="journal_user user">${h.link_to_user(user.username)}</div>
12 %else:
12 %else:
13 <div class="journal_user user deleted">${entries[0].username}</div>
13 <div class="journal_user user deleted">${entries[0].username}</div>
14 %endif
14 %endif
15 <div class="journal_action_container">
15 <div class="journal_action_container">
16 % for entry in entries:
16 % for entry in entries:
17 <div class="journal_icon"> ${h.action_parser(entry)[2]()}</div>
17 <div class="journal_icon"> ${h.action_parser(entry)[2]()}</div>
18 <div class="journal_action">${h.action_parser(entry)[0]()}</div>
18 <div class="journal_action">${h.action_parser(entry)[0]()}</div>
19 <div class="journal_repo">
19 <div class="journal_repo">
20 <span class="journal_repo_name">
20 <span class="journal_repo_name">
21 %if entry.repository is not None:
21 %if entry.repository is not None:
22 ${h.link_to(entry.repository.repo_name,
22 ${h.link_to(entry.repository.repo_name,
23 h.url('summary_home',repo_name=entry.repository.repo_name))}
23 h.url('summary_home',repo_name=entry.repository.repo_name))}
24 %else:
24 %else:
25 ${entry.repository_name}
25 ${entry.repository_name}
26 %endif
26 %endif
27 </span>
27 </span>
28 </div>
28 </div>
29 <div class="journal_action_params">${h.literal(h.action_parser(entry)[1]())}</div>
29 <div class="journal_action_params">${h.literal(h.action_parser(entry)[1]())}</div>
30 <div class="date">
30 <div class="date">
31 ${h.age_component(entry.action_date, time_is_local=True)}
31 ${h.age_component(entry.action_date, time_is_local=True)}
32 </div>
32 </div>
33 %endfor
33 %endfor
34 </div>
34 </div>
35 </div>
35 </div>
36 %endfor
36 %endfor
37 %endfor
37 %endfor
38
38
39 <div class="pagination-wh pagination-left" >
39 <div class="pagination-wh pagination-left" >
40 ${c.journal_pager.pager('$link_previous ~2~ $link_next')}
40 ${c.journal_pager.pager('$link_previous ~2~ $link_next')}
41 </div>
41 </div>
42 <script type="text/javascript">
42 <script type="text/javascript">
43 $(document).pjax('#journal .pager_link','#journal');
43 $(document).pjax('#journal .pager_link','#journal');
44 $(document).on('pjax:success',function(){
44 $(document).on('pjax:success',function(){
45 show_more_event();
45 show_more_event();
46 timeagoActivate();
46 timeagoActivate();
47 tooltip_activate();
48 show_changeset_tooltip();
49 });
47 });
50 </script>
48 </script>
51 %else:
49 %else:
52 <div>
50 <div>
53 ${_('No entries yet')}
51 ${_('No entries yet')}
54 </div>
52 </div>
55 %endif
53 %endif
@@ -1,132 +1,131 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s Pull Requests') % c.repo_name}
4 ${_('%s Pull Requests') % c.repo_name}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="breadcrumbs_links()">
10 <%def name="breadcrumbs_links()">
11
11
12 </%def>
12 </%def>
13
13
14 <%def name="menu_bar_nav()">
14 <%def name="menu_bar_nav()">
15 ${self.menu_items(active='repositories')}
15 ${self.menu_items(active='repositories')}
16 </%def>
16 </%def>
17
17
18
18
19 <%def name="menu_bar_subnav()">
19 <%def name="menu_bar_subnav()">
20 ${self.repo_menu(active='showpullrequest')}
20 ${self.repo_menu(active='showpullrequest')}
21 </%def>
21 </%def>
22
22
23
23
24 <%def name="main()">
24 <%def name="main()">
25 <div class="box">
25 <div class="box">
26 <div class="title">
26 <div class="title">
27 ${self.repo_page_title(c.rhodecode_db_repo)}
27 ${self.repo_page_title(c.rhodecode_db_repo)}
28
28
29 <ul class="links">
29 <ul class="links">
30 <li>
30 <li>
31 %if c.rhodecode_user.username != h.DEFAULT_USER:
31 %if c.rhodecode_user.username != h.DEFAULT_USER:
32 <span>
32 <span>
33 <a id="open_new_pull_request" class="btn btn-small btn-success" href="${h.url('pullrequest_home',repo_name=c.repo_name)}">
33 <a id="open_new_pull_request" class="btn btn-small btn-success" href="${h.url('pullrequest_home',repo_name=c.repo_name)}">
34 ${_('Open new Pull Request')}
34 ${_('Open new Pull Request')}
35 </a>
35 </a>
36 </span>
36 </span>
37 %endif
37 %endif
38 </li>
38 </li>
39 </ul>
39 </ul>
40
40
41 ${self.breadcrumbs()}
41 ${self.breadcrumbs()}
42 </div>
42 </div>
43
43
44 <div class="sidebar-col-wrapper">
44 <div class="sidebar-col-wrapper">
45 ##main
45 ##main
46 <div class="sidebar">
46 <div class="sidebar">
47 <ul class="nav nav-pills nav-stacked">
47 <ul class="nav nav-pills nav-stacked">
48 <li class="${'active' if c.active=='open' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0)}">${_('Opened')}</a></li>
48 <li class="${'active' if c.active=='open' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0)}">${_('Opened')}</a></li>
49 <li class="${'active' if c.active=='my' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0,my=1)}">${_('Opened by me')}</a></li>
49 <li class="${'active' if c.active=='my' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0,my=1)}">${_('Opened by me')}</a></li>
50 <li class="${'active' if c.active=='awaiting' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0,awaiting_review=1)}">${_('Awaiting review')}</a></li>
50 <li class="${'active' if c.active=='awaiting' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0,awaiting_review=1)}">${_('Awaiting review')}</a></li>
51 <li class="${'active' if c.active=='awaiting_my' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0,awaiting_my_review=1)}">${_('Awaiting my review')}</a></li>
51 <li class="${'active' if c.active=='awaiting_my' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0,awaiting_my_review=1)}">${_('Awaiting my review')}</a></li>
52 <li class="${'active' if c.active=='closed' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0,closed=1)}">${_('Closed')}</a></li>
52 <li class="${'active' if c.active=='closed' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=0,closed=1)}">${_('Closed')}</a></li>
53 <li class="${'active' if c.active=='source' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=1)}">${_('From this repo')}</a></li>
53 <li class="${'active' if c.active=='source' else ''}"><a href="${h.url('pullrequest_show_all',repo_name=c.repo_name,source=1)}">${_('From this repo')}</a></li>
54 </ul>
54 </ul>
55 </div>
55 </div>
56
56
57 <div class="main-content-full-width">
57 <div class="main-content-full-width">
58 <div class="panel panel-default">
58 <div class="panel panel-default">
59 <div class="panel-heading">
59 <div class="panel-heading">
60 <h3 class="panel-title">
60 <h3 class="panel-title">
61 %if c.source:
61 %if c.source:
62 ${_('Pull Requests from %(repo_name)s repository') % {'repo_name': c.repo_name}}
62 ${_('Pull Requests from %(repo_name)s repository') % {'repo_name': c.repo_name}}
63 %elif c.closed:
63 %elif c.closed:
64 ${_('Closed Pull Requests to repository %(repo_name)s') % {'repo_name': c.repo_name}}
64 ${_('Closed Pull Requests to repository %(repo_name)s') % {'repo_name': c.repo_name}}
65 %elif c.my:
65 %elif c.my:
66 ${_('Pull Requests to %(repo_name)s repository opened by me') % {'repo_name': c.repo_name}}
66 ${_('Pull Requests to %(repo_name)s repository opened by me') % {'repo_name': c.repo_name}}
67 %elif c.awaiting_review:
67 %elif c.awaiting_review:
68 ${_('Pull Requests to %(repo_name)s repository awaiting review') % {'repo_name': c.repo_name}}
68 ${_('Pull Requests to %(repo_name)s repository awaiting review') % {'repo_name': c.repo_name}}
69 %elif c.awaiting_my_review:
69 %elif c.awaiting_my_review:
70 ${_('Pull Requests to %(repo_name)s repository awaiting my review') % {'repo_name': c.repo_name}}
70 ${_('Pull Requests to %(repo_name)s repository awaiting my review') % {'repo_name': c.repo_name}}
71 %else:
71 %else:
72 ${_('Pull Requests to %(repo_name)s repository') % {'repo_name': c.repo_name}}
72 ${_('Pull Requests to %(repo_name)s repository') % {'repo_name': c.repo_name}}
73 %endif
73 %endif
74 </h3>
74 </h3>
75 </div>
75 </div>
76 <div class="panel-body">
76 <div class="panel-body">
77 <table id="pull_request_list_table" class="display"></table>
77 <table id="pull_request_list_table" class="display"></table>
78 </div>
78 </div>
79 </div>
79 </div>
80 </div>
80 </div>
81 </div>
81 </div>
82 </div>
82 </div>
83
83
84 <script type="text/javascript">
84 <script type="text/javascript">
85 $(document).ready(function() {
85 $(document).ready(function() {
86 // object list
86 // object list
87 $('#pull_request_list_table').DataTable({
87 $('#pull_request_list_table').DataTable({
88 data: ${c.data|n},
88 data: ${c.data|n},
89 processing: true,
89 processing: true,
90 serverSide: true,
90 serverSide: true,
91 deferLoading: ${c.records_total},
91 deferLoading: ${c.records_total},
92 ajax: "",
92 ajax: "",
93 dom: 'tp',
93 dom: 'tp',
94 pageLength: ${c.visual.dashboard_items},
94 pageLength: ${c.visual.dashboard_items},
95 order: [[ 1, "desc" ]],
95 order: [[ 1, "desc" ]],
96 columns: [
96 columns: [
97 { data: {"_": "status",
97 { data: {"_": "status",
98 "sort": "status"}, title: "", className: "td-status", orderable: false},
98 "sort": "status"}, title: "", className: "td-status", orderable: false},
99 { data: {"_": "name",
99 { data: {"_": "name",
100 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname", "type": "num" },
100 "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname", "type": "num" },
101 { data: {"_": "author",
101 { data: {"_": "author",
102 "sort": "author_raw"}, title: "${_('Author')}", className: "td-user", orderable: false },
102 "sort": "author_raw"}, title: "${_('Author')}", className: "td-user", orderable: false },
103 { data: {"_": "title",
103 { data: {"_": "title",
104 "sort": "title"}, title: "${_('Title')}", className: "td-description" },
104 "sort": "title"}, title: "${_('Title')}", className: "td-description" },
105 { data: {"_": "comments",
105 { data: {"_": "comments",
106 "sort": "comments_raw"}, title: "", className: "td-comments", orderable: false},
106 "sort": "comments_raw"}, title: "", className: "td-comments", orderable: false},
107 { data: {"_": "updated_on",
107 { data: {"_": "updated_on",
108 "sort": "updated_on_raw"}, title: "${_('Updated on')}", className: "td-time" }
108 "sort": "updated_on_raw"}, title: "${_('Updated on')}", className: "td-time" }
109 ],
109 ],
110 language: {
110 language: {
111 paginate: DEFAULT_GRID_PAGINATION
111 paginate: DEFAULT_GRID_PAGINATION
112 },
112 },
113 "drawCallback": function( settings, json ) {
113 "drawCallback": function( settings, json ) {
114 timeagoActivate();
114 timeagoActivate();
115 tooltip_activate();
116 },
115 },
117 "createdRow": function ( row, data, index ) {
116 "createdRow": function ( row, data, index ) {
118 if (data['closed']) {
117 if (data['closed']) {
119 $(row).addClass('closed');
118 $(row).addClass('closed');
120 }
119 }
121 }
120 }
122 });
121 });
123 });
122 });
124 $('#pull_request_list_table').on('xhr.dt', function(e, settings, json, xhr){
123 $('#pull_request_list_table').on('xhr.dt', function(e, settings, json, xhr){
125 $('#pull_request_list_table').css('opacity', 1);
124 $('#pull_request_list_table').css('opacity', 1);
126 });
125 });
127
126
128 $('#pull_request_list_table').on('preXhr.dt', function(e, settings, data){
127 $('#pull_request_list_table').on('preXhr.dt', function(e, settings, data){
129 $('#pull_request_list_table').css('opacity', 0.3);
128 $('#pull_request_list_table').css('opacity', 0.3);
130 });
129 });
131 </script>
130 </script>
132 </%def>
131 </%def>
@@ -1,102 +1,100 b''
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 ${_('%s Tags') % c.repo_name}
5 ${_('%s Tags') % c.repo_name}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
12 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
13 <span id="obj_count">0</span> ${_('tags')}
13 <span id="obj_count">0</span> ${_('tags')}
14 </%def>
14 </%def>
15
15
16 <%def name="menu_bar_nav()">
16 <%def name="menu_bar_nav()">
17 ${self.menu_items(active='repositories')}
17 ${self.menu_items(active='repositories')}
18 </%def>
18 </%def>
19
19
20 <%def name="menu_bar_subnav()">
20 <%def name="menu_bar_subnav()">
21 ${self.repo_menu(active='summary')}
21 ${self.repo_menu(active='summary')}
22 </%def>
22 </%def>
23
23
24 <%def name="main()">
24 <%def name="main()">
25 <div class="box">
25 <div class="box">
26 <div class="title">
26 <div class="title">
27 ${self.repo_page_title(c.rhodecode_db_repo)}
27 ${self.repo_page_title(c.rhodecode_db_repo)}
28 %if c.has_references:
28 %if c.has_references:
29 <ul class="links">
29 <ul class="links">
30 <li>
30 <li>
31 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Tags')}">
31 <input type="submit" id="compare_action" class="btn" disabled="disabled" value="${_('Compare Selected Tags')}">
32 </li>
32 </li>
33 </ul>
33 </ul>
34 %endif
34 %endif
35 %if c.has_references:
35 %if c.has_references:
36 ${self.breadcrumbs()}
36 ${self.breadcrumbs()}
37 %endif
37 %endif
38 </div>
38 </div>
39 <table id="obj_list_table" class="display"></table>
39 <table id="obj_list_table" class="display"></table>
40 </div>
40 </div>
41
41
42
42
43 <script type="text/javascript">
43 <script type="text/javascript">
44 $(document).ready(function() {
44 $(document).ready(function() {
45
45
46 var get_datatable_count = function(){
46 var get_datatable_count = function(){
47 var api = $('#obj_list_table').dataTable().api();
47 var api = $('#obj_list_table').dataTable().api();
48 $('#obj_count').text(api.page.info().recordsDisplay);
48 $('#obj_count').text(api.page.info().recordsDisplay);
49 };
49 };
50
50
51 // object list
51 // object list
52 $('#obj_list_table').DataTable({
52 $('#obj_list_table').DataTable({
53 data: ${c.data|n},
53 data: ${c.data|n},
54 dom: 'rtp',
54 dom: 'rtp',
55 pageLength: ${c.visual.dashboard_items},
55 pageLength: ${c.visual.dashboard_items},
56 order: [[ 0, "asc" ]],
56 order: [[ 0, "asc" ]],
57 columns: [
57 columns: [
58 { data: {"_": "name",
58 { data: {"_": "name",
59 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
59 "sort": "name_raw"}, title: "${_('Name')}", className: "td-tags" },
60 { data: {"_": "date",
60 { data: {"_": "date",
61 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
61 "sort": "date_raw"}, title: "${_('Date')}", className: "td-time" },
62 { data: {"_": "author",
62 { data: {"_": "author",
63 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
63 "sort": "author"}, title: "${_('Author')}", className: "td-user" },
64 { data: {"_": "commit",
64 { data: {"_": "commit",
65 "sort": "commit_raw",
65 "sort": "commit_raw",
66 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
66 "type": Number}, title: "${_('Commit')}", className: "td-hash" },
67 { data: {"_": "compare",
67 { data: {"_": "compare",
68 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
68 "sort": "compare"}, title: "${_('Compare')}", className: "td-compare" }
69 ],
69 ],
70 language: {
70 language: {
71 paginate: DEFAULT_GRID_PAGINATION
71 paginate: DEFAULT_GRID_PAGINATION
72 },
72 },
73 "initComplete": function(settings, json) {
73 "initComplete": function(settings, json) {
74 get_datatable_count();
74 get_datatable_count();
75 tooltip_activate();
76 timeagoActivate();
75 timeagoActivate();
77 compare_radio_buttons("${c.repo_name}", 'tag');
76 compare_radio_buttons("${c.repo_name}", 'tag');
78 }
77 }
79 });
78 });
80
79
81 // update when things change
80 // update when things change
82 $('#obj_list_table').on('draw.dt', function() {
81 $('#obj_list_table').on('draw.dt', function() {
83 get_datatable_count();
82 get_datatable_count();
84 tooltip_activate();
85 timeagoActivate();
83 timeagoActivate();
86 });
84 });
87
85
88 // filter, filter both grids
86 // filter, filter both grids
89 $('#q_filter').on('keyup', function() {
87 $('#q_filter').on('keyup', function() {
90 var obj_api = $('#obj_list_table').dataTable().api();
88 var obj_api = $('#obj_list_table').dataTable().api();
91 obj_api
89 obj_api
92 .columns(0)
90 .columns(0)
93 .search(this.value)
91 .search(this.value)
94 .draw();
92 .draw();
95 });
93 });
96
94
97 // refilter table if page load via back button
95 // refilter table if page load via back button
98 $("#q_filter").trigger('keyup');
96 $("#q_filter").trigger('keyup');
99 });
97 });
100
98
101 </script>
99 </script>
102 </%def>
100 </%def>
@@ -1,498 +1,496 b''
1 <html xmlns="http://www.w3.org/1999/xhtml">
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
2 <head>
3 <title>
3 <title>
4 Gist &middot; 22
4 Gist &middot; 22
5 </title>
5 </title>
6 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
6 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
7 <meta name="robots" content="index, nofollow"/>
7 <meta name="robots" content="index, nofollow"/>
8 <link rel="icon" href="/images/favicon.ico?ver=b5cbcb03" sizes="16x16 32x32" type="image/png" />
8 <link rel="icon" href="/images/favicon.ico?ver=b5cbcb03" sizes="16x16 32x32" type="image/png" />
9 <link rel="stylesheet" type="text/css" href="/css/style.css?ver=b5cbcb03" media="screen"/>
9 <link rel="stylesheet" type="text/css" href="/css/style.css?ver=b5cbcb03" media="screen"/>
10 <!--[if lt IE 9]>
10 <!--[if lt IE 9]>
11 <link rel="stylesheet" type="text/css" href="/css/ie.css?ver=b5cbcb03" media="screen"/>
11 <link rel="stylesheet" type="text/css" href="/css/ie.css?ver=b5cbcb03" media="screen"/>
12 <![endif]-->
12 <![endif]-->
13 <script src="/js/rhodecode/i18n/en.js?ver=b5cbcb03"></script>
13 <script src="/js/rhodecode/i18n/en.js?ver=b5cbcb03"></script>
14 <script type="text/javascript">
14 <script type="text/javascript">
15 // register templateContext to pass template variables to JS
15 // register templateContext to pass template variables to JS
16 var templateContext = {
16 var templateContext = {
17 repo_name: "",
17 repo_name: "",
18 repo_type: null,
18 repo_type: null,
19 repo_landing_commit: null,
19 repo_landing_commit: null,
20 rhodecode_user: {
20 rhodecode_user: {
21 username: "default",
21 username: "default",
22 email: "anonymous@rhodecode.org",
22 email: "anonymous@rhodecode.org",
23 },
23 },
24 visual: {
24 visual: {
25 default_renderer: "rst"
25 default_renderer: "rst"
26 },
26 },
27 commit_data: {
27 commit_data: {
28 commit_id: null,
28 commit_id: null,
29 },
29 },
30 pull_request_data: {
30 pull_request_data: {
31 pull_request_id: null,
31 pull_request_id: null,
32 },
32 },
33 timeago: {
33 timeago: {
34 refresh_time: 120000,
34 refresh_time: 120000,
35 cutoff_limit: 604800000
35 cutoff_limit: 604800000
36 }
36 }
37 };
37 };
38 var REPO_NAME = "";
38 var REPO_NAME = "";
39 var REPO_LANDING_REV = '';
39 var REPO_LANDING_REV = '';
40 var REPO_TYPE = '';
40 var REPO_TYPE = '';
41 var APPLICATION_URL = "";
41 var APPLICATION_URL = "";
42 var DEFAULT_RENDERER = "rst";
42 var DEFAULT_RENDERER = "rst";
43 var CSRF_TOKEN = "0fd2775cf20f09b9942125e6ffb4c6da143d1b14";
43 var CSRF_TOKEN = "0fd2775cf20f09b9942125e6ffb4c6da143d1b14";
44 var USER = {name:'default'};
44 var USER = {name:'default'};
45 var APPENLIGHT = {
45 var APPENLIGHT = {
46 enabled: false,
46 enabled: false,
47 key: 'YOUR_API_PUBLIC_KEY',
47 key: 'YOUR_API_PUBLIC_KEY',
48 serverUrl: 'https://api.appenlight.com',
48 serverUrl: 'https://api.appenlight.com',
49 requestInfo: {
49 requestInfo: {
50 ip: '0.0.0.0',
50 ip: '0.0.0.0',
51 username: 'default'
51 username: 'default'
52 }
52 }
53 };
53 };
54 </script>
54 </script>
55 <!--[if lt IE 9]>
55 <!--[if lt IE 9]>
56 <script language="javascript" type="text/javascript" src="/js/excanvas.min.js"></script>
56 <script language="javascript" type="text/javascript" src="/js/excanvas.min.js"></script>
57 <![endif]-->
57 <![endif]-->
58 <script language="javascript" type="text/javascript" src="/js/scripts.js?ver=b5cbcb03"></script>
58 <script language="javascript" type="text/javascript" src="/js/scripts.js?ver=b5cbcb03"></script>
59 <script>CodeMirror.modeURL = "/js/mode/%N/%N.js";</script>
59 <script>CodeMirror.modeURL = "/js/mode/%N/%N.js";</script>
60 <script type="text/javascript">
60 <script type="text/javascript">
61 $(document).ready(function(){
61 $(document).ready(function(){
62 tooltip_activate();
63 show_more_event();
62 show_more_event();
64 show_changeset_tooltip();
65 timeagoActivate();
63 timeagoActivate();
66 })
64 })
67 </script>
65 </script>
68 </head>
66 </head>
69 <body id="body">
67 <body id="body">
70 <noscript>
68 <noscript>
71 <div class="noscript-error">
69 <div class="noscript-error">
72 Please enable JavaScript to use RhodeCode Enterprise
70 Please enable JavaScript to use RhodeCode Enterprise
73 </div>
71 </div>
74 </noscript>
72 </noscript>
75 <!--[if IE 7]>
73 <!--[if IE 7]>
76 <script>$(document.body).addClass('ie7')</script>
74 <script>$(document.body).addClass('ie7')</script>
77 <![endif]-->
75 <![endif]-->
78 <!--[if IE 8]>
76 <!--[if IE 8]>
79 <script>$(document.body).addClass('ie8')</script>
77 <script>$(document.body).addClass('ie8')</script>
80 <![endif]-->
78 <![endif]-->
81 <!--[if IE 9]>
79 <!--[if IE 9]>
82 <script>$(document.body).addClass('ie9')</script>
80 <script>$(document.body).addClass('ie9')</script>
83 <![endif]-->
81 <![endif]-->
84 <div class="outerwrapper">
82 <div class="outerwrapper">
85 <!-- HEADER -->
83 <!-- HEADER -->
86 <div class="header">
84 <div class="header">
87 <div id="header-inner" class="wrapper">
85 <div id="header-inner" class="wrapper">
88 <div id="logo">
86 <div id="logo">
89 <div class="logo-wrapper">
87 <div class="logo-wrapper">
90 <a href="/"><img src="/images/rhodecode-logo-white-216x60.png" alt="RhodeCode"/></a>
88 <a href="/"><img src="/images/rhodecode-logo-white-216x60.png" alt="RhodeCode"/></a>
91 </div>
89 </div>
92 </div>
90 </div>
93 <!-- MENU BAR NAV -->
91 <!-- MENU BAR NAV -->
94 <ul id="quick" class="main_nav navigation horizontal-list">
92 <ul id="quick" class="main_nav navigation horizontal-list">
95 <!-- repo switcher -->
93 <!-- repo switcher -->
96 <li class=" repo_switcher_li has_select2">
94 <li class=" repo_switcher_li has_select2">
97 <input id="repo_switcher" name="repo_switcher" type="hidden">
95 <input id="repo_switcher" name="repo_switcher" type="hidden">
98 </li>
96 </li>
99 <li class="">
97 <li class="">
100 <a class="menulink" title="Show Public activity journal" href="/_admin/public_journal">
98 <a class="menulink" title="Show Public activity journal" href="/_admin/public_journal">
101 <div class="menulabel">Public journal</div>
99 <div class="menulabel">Public journal</div>
102 </a>
100 </a>
103 </li>
101 </li>
104 <li class="active">
102 <li class="active">
105 <a class="menulink childs" title="Show Gists" href="/_admin/gists">
103 <a class="menulink childs" title="Show Gists" href="/_admin/gists">
106 <div class="menulabel">Gists</div>
104 <div class="menulabel">Gists</div>
107 </a>
105 </a>
108 </li>
106 </li>
109 <li class="">
107 <li class="">
110 <a class="menulink" title="Search in repositories you have access to" href="/_admin/search">
108 <a class="menulink" title="Search in repositories you have access to" href="/_admin/search">
111 <div class="menulabel">Search</div>
109 <div class="menulabel">Search</div>
112 </a>
110 </a>
113 </li>
111 </li>
114 <li id="quick_login_li">
112 <li id="quick_login_li">
115 <a id="quick_login_link" class="menulink childs">
113 <a id="quick_login_link" class="menulink childs">
116 <img class="gravatar gravatar-large" src="data:image/svg+xml;base64,CiAgICAgICAgPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgICAgICAg
114 <img class="gravatar gravatar-large" src="data:image/svg+xml;base64,CiAgICAgICAgPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgICAgICAg
117 dmVyc2lvbj0iMS4xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIgogICAg
115 dmVyc2lvbj0iMS4xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIgogICAg
118 ICAgIHZpZXdCb3g9Ii0xNSAtMTAgNDM5LjE2NSA0MjkuMTY0IgoKICAgICAgICB4bWw6c3BhY2U9
116 ICAgIHZpZXdCb3g9Ii0xNSAtMTAgNDM5LjE2NSA0MjkuMTY0IgoKICAgICAgICB4bWw6c3BhY2U9
119 InByZXNlcnZlIgogICAgICAgIHN0eWxlPSJiYWNrZ3JvdW5kOiM5Nzk3OTc7IiA+CgogICAgICAg
117 InByZXNlcnZlIgogICAgICAgIHN0eWxlPSJiYWNrZ3JvdW5kOiM5Nzk3OTc7IiA+CgogICAgICAg
120 IDxwYXRoIGQ9Ik0yMDQuNTgzLDIxNi42NzFjNTAuNjY0LDAsOTEuNzQtNDguMDc1LAogICAgICAg
118 IDxwYXRoIGQ9Ik0yMDQuNTgzLDIxNi42NzFjNTAuNjY0LDAsOTEuNzQtNDguMDc1LAogICAgICAg
121 ICAgICAgICAgIDkxLjc0LTEwNy4zNzhjMC04Mi4yMzctNDEuMDc0LTEwNy4zNzctOTEuNzQtMTA3
119 ICAgICAgICAgIDkxLjc0LTEwNy4zNzhjMC04Mi4yMzctNDEuMDc0LTEwNy4zNzctOTEuNzQtMTA3
122 LjM3NwogICAgICAgICAgICAgICAgIGMtNTAuNjY4LDAtOTEuNzQsMjUuMTQtOTEuNzQsMTA3LjM3
120 LjM3NwogICAgICAgICAgICAgICAgIGMtNTAuNjY4LDAtOTEuNzQsMjUuMTQtOTEuNzQsMTA3LjM3
123 N0MxMTIuODQ0LAogICAgICAgICAgICAgICAgIDE2OC41OTYsMTUzLjkxNiwyMTYuNjcxLAogICAg
121 N0MxMTIuODQ0LAogICAgICAgICAgICAgICAgIDE2OC41OTYsMTUzLjkxNiwyMTYuNjcxLAogICAg
124 ICAgICAgICAgICAgIDIwNC41ODMsMjE2LjY3MXoiIGZpbGw9IiNmZmYiLz4KICAgICAgICA8cGF0
122 ICAgICAgICAgICAgIDIwNC41ODMsMjE2LjY3MXoiIGZpbGw9IiNmZmYiLz4KICAgICAgICA8cGF0
125 aCBkPSJNNDA3LjE2NCwzNzQuNzE3TDM2MC44OCwKICAgICAgICAgICAgICAgICAyNzAuNDU0Yy0y
123 aCBkPSJNNDA3LjE2NCwzNzQuNzE3TDM2MC44OCwKICAgICAgICAgICAgICAgICAyNzAuNDU0Yy0y
126 LjExNy00Ljc3MS01LjgzNi04LjcyOC0xMC40NjUtMTEuMTM4bC03MS44My0zNy4zOTIKICAgICAg
124 LjExNy00Ljc3MS01LjgzNi04LjcyOC0xMC40NjUtMTEuMTM4bC03MS44My0zNy4zOTIKICAgICAg
127 ICAgICAgICAgICBjLTEuNTg0LTAuODIzLTMuNTAyLTAuNjYzLTQuOTI2LDAuNDE1Yy0yMC4zMTYs
125 ICAgICAgICAgICBjLTEuNTg0LTAuODIzLTMuNTAyLTAuNjYzLTQuOTI2LDAuNDE1Yy0yMC4zMTYs
128 CiAgICAgICAgICAgICAgICAgMTUuMzY2LTQ0LjIwMywyMy40ODgtNjkuMDc2LDIzLjQ4OGMtMjQu
126 CiAgICAgICAgICAgICAgICAgMTUuMzY2LTQ0LjIwMywyMy40ODgtNjkuMDc2LDIzLjQ4OGMtMjQu
129 ODc3LAogICAgICAgICAgICAgICAgIDAtNDguNzYyLTguMTIyLTY5LjA3OC0yMy40ODgKICAgICAg
127 ODc3LAogICAgICAgICAgICAgICAgIDAtNDguNzYyLTguMTIyLTY5LjA3OC0yMy40ODgKICAgICAg
130 ICAgICAgICAgICBjLTEuNDI4LTEuMDc4LTMuMzQ2LTEuMjM4LTQuOTMtMC40MTVMNTguNzUsCiAg
128 ICAgICAgICAgICBjLTEuNDI4LTEuMDc4LTMuMzQ2LTEuMjM4LTQuOTMtMC40MTVMNTguNzUsCiAg
131 ICAgICAgICAgICAgICAgMjU5LjMxNmMtNC42MzEsMi40MS04LjM0Niw2LjM2NS0xMC40NjUsMTEu
129 ICAgICAgICAgICAgICAgMjU5LjMxNmMtNC42MzEsMi40MS04LjM0Niw2LjM2NS0xMC40NjUsMTEu
132 MTM4TDIuMDAxLDM3NC43MTcKICAgICAgICAgICAgICAgICBjLTMuMTkxLDcuMTg4LTIuNTM3LDE1
130 MTM4TDIuMDAxLDM3NC43MTcKICAgICAgICAgICAgICAgICBjLTMuMTkxLDcuMTg4LTIuNTM3LDE1
133 LjQxMiwxLjc1LDIyLjAwNWM0LjI4NSwKICAgICAgICAgICAgICAgICA2LjU5MiwxMS41MzcsMTAu
131 LjQxMiwxLjc1LDIyLjAwNWM0LjI4NSwKICAgICAgICAgICAgICAgICA2LjU5MiwxMS41MzcsMTAu
134 NTI2LDE5LjQsMTAuNTI2aDM2Mi44NjFjNy44NjMsMCwxNS4xMTctMy45MzYsCiAgICAgICAgICAg
132 NTI2LDE5LjQsMTAuNTI2aDM2Mi44NjFjNy44NjMsMCwxNS4xMTctMy45MzYsCiAgICAgICAgICAg
135 ICAgICAgMTkuNDAyLTEwLjUyNyBDNDA5LjY5OSwzOTAuMTI5LAogICAgICAgICAgICAgICAgIDQx
133 ICAgICAgMTkuNDAyLTEwLjUyNyBDNDA5LjY5OSwzOTAuMTI5LAogICAgICAgICAgICAgICAgIDQx
136 MC4zNTUsMzgxLjkwMiw0MDcuMTY0LDM3NC43MTd6IiBmaWxsPSIjZmZmIi8+CiAgICAgICAgPC9z
134 MC4zNTUsMzgxLjkwMiw0MDcuMTY0LDM3NC43MTd6IiBmaWxsPSIjZmZmIi8+CiAgICAgICAgPC9z
137 dmc+
135 dmc+
138 " height="20" width="20">
136 " height="20" width="20">
139 <span class="user">
137 <span class="user">
140 <span>Sign in</span>
138 <span>Sign in</span>
141 </span>
139 </span>
142 </a>
140 </a>
143 <div class="user-menu submenu">
141 <div class="user-menu submenu">
144 <div id="quick_login">
142 <div id="quick_login">
145 <h4>Sign in to your account</h4>
143 <h4>Sign in to your account</h4>
146 <form action="/_admin/login?came_from=%2F_admin%2Fgists%2F22" method="post">
144 <form action="/_admin/login?came_from=%2F_admin%2Fgists%2F22" method="post">
147 <div class="form form-vertical">
145 <div class="form form-vertical">
148 <div class="fields">
146 <div class="fields">
149 <div class="field">
147 <div class="field">
150 <div class="label">
148 <div class="label">
151 <label for="username">Username:</label>
149 <label for="username">Username:</label>
152 </div>
150 </div>
153 <div class="input">
151 <div class="input">
154 <input class="focus" id="username" name="username" tabindex="1" type="text" />
152 <input class="focus" id="username" name="username" tabindex="1" type="text" />
155 </div>
153 </div>
156 </div>
154 </div>
157 <div class="field">
155 <div class="field">
158 <div class="label">
156 <div class="label">
159 <label for="password">Password:</label>
157 <label for="password">Password:</label>
160 <span class="forgot_password"><a href="/_admin/password_reset">(Forgot password?)</a></span>
158 <span class="forgot_password"><a href="/_admin/password_reset">(Forgot password?)</a></span>
161 </div>
159 </div>
162 <div class="input">
160 <div class="input">
163 <input class="focus" id="password" name="password" tabindex="2" type="password" />
161 <input class="focus" id="password" name="password" tabindex="2" type="password" />
164 </div>
162 </div>
165 </div>
163 </div>
166 <div class="buttons">
164 <div class="buttons">
167 <div class="register">
165 <div class="register">
168 <a href="/_admin/register">Don&#39;t have an account ?</a>
166 <a href="/_admin/register">Don&#39;t have an account ?</a>
169 </div>
167 </div>
170 <div class="submit">
168 <div class="submit">
171 <input class="btn btn-small" id="sign_in" name="sign_in" tabindex="3" type="submit" value="Sign In" />
169 <input class="btn btn-small" id="sign_in" name="sign_in" tabindex="3" type="submit" value="Sign In" />
172 </div>
170 </div>
173 </div>
171 </div>
174 </div>
172 </div>
175 </div>
173 </div>
176 </form>
174 </form>
177 </div>
175 </div>
178 </div>
176 </div>
179 </li>
177 </li>
180 </ul>
178 </ul>
181 <script type="text/javascript">
179 <script type="text/javascript">
182 var visual_show_public_icon = "True" == "True";
180 var visual_show_public_icon = "True" == "True";
183 /*format the look of items in the list*/
181 /*format the look of items in the list*/
184 var format = function(state, escapeMarkup){
182 var format = function(state, escapeMarkup){
185 if (!state.id){
183 if (!state.id){
186 return state.text; // optgroup
184 return state.text; // optgroup
187 }
185 }
188 var obj_dict = state.obj;
186 var obj_dict = state.obj;
189 var tmpl = '';
187 var tmpl = '';
190 if(obj_dict && state.type == 'repo'){
188 if(obj_dict && state.type == 'repo'){
191 if(obj_dict['repo_type'] === 'hg'){
189 if(obj_dict['repo_type'] === 'hg'){
192 tmpl += '<i class="icon-hg"></i> ';
190 tmpl += '<i class="icon-hg"></i> ';
193 }
191 }
194 else if(obj_dict['repo_type'] === 'git'){
192 else if(obj_dict['repo_type'] === 'git'){
195 tmpl += '<i class="icon-git"></i> ';
193 tmpl += '<i class="icon-git"></i> ';
196 }
194 }
197 else if(obj_dict['repo_type'] === 'svn'){
195 else if(obj_dict['repo_type'] === 'svn'){
198 tmpl += '<i class="icon-svn"></i> ';
196 tmpl += '<i class="icon-svn"></i> ';
199 }
197 }
200 if(obj_dict['private']){
198 if(obj_dict['private']){
201 tmpl += '<i class="icon-lock" ></i> ';
199 tmpl += '<i class="icon-lock" ></i> ';
202 }
200 }
203 else if(visual_show_public_icon){
201 else if(visual_show_public_icon){
204 tmpl += '<i class="icon-unlock-alt"></i> ';
202 tmpl += '<i class="icon-unlock-alt"></i> ';
205 }
203 }
206 }
204 }
207 if(obj_dict && state.type == 'group'){
205 if(obj_dict && state.type == 'group'){
208 tmpl += '<i class="icon-folder-close"></i> ';
206 tmpl += '<i class="icon-folder-close"></i> ';
209 }
207 }
210 tmpl += escapeMarkup(state.text);
208 tmpl += escapeMarkup(state.text);
211 return tmpl;
209 return tmpl;
212 };
210 };
213 var formatResult = function(result, container, query, escapeMarkup) {
211 var formatResult = function(result, container, query, escapeMarkup) {
214 return format(result, escapeMarkup);
212 return format(result, escapeMarkup);
215 };
213 };
216 var formatSelection = function(data, container, escapeMarkup) {
214 var formatSelection = function(data, container, escapeMarkup) {
217 return format(data, escapeMarkup);
215 return format(data, escapeMarkup);
218 };
216 };
219 $("#repo_switcher").select2({
217 $("#repo_switcher").select2({
220 cachedDataSource: {},
218 cachedDataSource: {},
221 minimumInputLength: 2,
219 minimumInputLength: 2,
222 placeholder: '<div class="menulabel">Go to <div class="show_more"></div></div>',
220 placeholder: '<div class="menulabel">Go to <div class="show_more"></div></div>',
223 dropdownAutoWidth: true,
221 dropdownAutoWidth: true,
224 formatResult: formatResult,
222 formatResult: formatResult,
225 formatSelection: formatSelection,
223 formatSelection: formatSelection,
226 containerCssClass: "repo-switcher",
224 containerCssClass: "repo-switcher",
227 dropdownCssClass: "repo-switcher-dropdown",
225 dropdownCssClass: "repo-switcher-dropdown",
228 escapeMarkup: function(m){
226 escapeMarkup: function(m){
229 // don't escape our custom placeholder
227 // don't escape our custom placeholder
230 if(m.substr(0,23) == '<div class="menulabel">'){
228 if(m.substr(0,23) == '<div class="menulabel">'){
231 return m;
229 return m;
232 }
230 }
233 return Select2.util.escapeMarkup(m);
231 return Select2.util.escapeMarkup(m);
234 },
232 },
235 query: $.debounce(250, function(query){
233 query: $.debounce(250, function(query){
236 self = this;
234 self = this;
237 var cacheKey = query.term;
235 var cacheKey = query.term;
238 var cachedData = self.cachedDataSource[cacheKey];
236 var cachedData = self.cachedDataSource[cacheKey];
239 if (cachedData) {
237 if (cachedData) {
240 query.callback({results: cachedData.results});
238 query.callback({results: cachedData.results});
241 } else {
239 } else {
242 $.ajax({
240 $.ajax({
243 url: "/_repos_and_groups",
241 url: "/_repos_and_groups",
244 data: {'query': query.term},
242 data: {'query': query.term},
245 dataType: 'json',
243 dataType: 'json',
246 type: 'GET',
244 type: 'GET',
247 success: function(data) {
245 success: function(data) {
248 self.cachedDataSource[cacheKey] = data;
246 self.cachedDataSource[cacheKey] = data;
249 query.callback({results: data.results});
247 query.callback({results: data.results});
250 },
248 },
251 error: function(data, textStatus, errorThrown) {
249 error: function(data, textStatus, errorThrown) {
252 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
250 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
253 }
251 }
254 })
252 })
255 }
253 }
256 })
254 })
257 });
255 });
258 $("#repo_switcher").on('select2-selecting', function(e){
256 $("#repo_switcher").on('select2-selecting', function(e){
259 e.preventDefault();
257 e.preventDefault();
260 window.location = pyroutes.url('summary_home', {'repo_name': e.val});
258 window.location = pyroutes.url('summary_home', {'repo_name': e.val});
261 });
259 });
262 // general help "?"
260 // general help "?"
263 Mousetrap.bind(['?'], function(e) {
261 Mousetrap.bind(['?'], function(e) {
264 $('#help_kb').modal({})
262 $('#help_kb').modal({})
265 });
263 });
266 // / open the quick filter
264 // / open the quick filter
267 Mousetrap.bind(['/'], function(e) {
265 Mousetrap.bind(['/'], function(e) {
268 $("#repo_switcher").select2("open");
266 $("#repo_switcher").select2("open");
269 // return false to prevent default browser behavior
267 // return false to prevent default browser behavior
270 // and stop event from bubbling
268 // and stop event from bubbling
271 return false;
269 return false;
272 });
270 });
273 // general nav g + action
271 // general nav g + action
274 Mousetrap.bind(['g h'], function(e) {
272 Mousetrap.bind(['g h'], function(e) {
275 window.location = pyroutes.url('home');
273 window.location = pyroutes.url('home');
276 });
274 });
277 Mousetrap.bind(['g g'], function(e) {
275 Mousetrap.bind(['g g'], function(e) {
278 window.location = pyroutes.url('gists', {'private':1});
276 window.location = pyroutes.url('gists', {'private':1});
279 });
277 });
280 Mousetrap.bind(['g G'], function(e) {
278 Mousetrap.bind(['g G'], function(e) {
281 window.location = pyroutes.url('gists', {'public':1});
279 window.location = pyroutes.url('gists', {'public':1});
282 });
280 });
283 Mousetrap.bind(['n g'], function(e) {
281 Mousetrap.bind(['n g'], function(e) {
284 window.location = pyroutes.url('new_gist');
282 window.location = pyroutes.url('new_gist');
285 });
283 });
286 Mousetrap.bind(['n r'], function(e) {
284 Mousetrap.bind(['n r'], function(e) {
287 window.location = pyroutes.url('new_repo');
285 window.location = pyroutes.url('new_repo');
288 });
286 });
289 </script>
287 </script>
290 <script src="/js/rhodecode/base/keyboard-bindings.js?ver=b5cbcb03"></script>
288 <script src="/js/rhodecode/base/keyboard-bindings.js?ver=b5cbcb03"></script>
291 <!-- END MENU BAR NAV -->
289 <!-- END MENU BAR NAV -->
292 </div>
290 </div>
293 </div>
291 </div>
294 <!-- END HEADER -->
292 <!-- END HEADER -->
295 <!-- CONTENT -->
293 <!-- CONTENT -->
296 <div id="content" class="wrapper">
294 <div id="content" class="wrapper">
297 <div class="flash_msg">
295 <div class="flash_msg">
298 <script>
296 <script>
299 if (typeof jQuery != 'undefined') {
297 if (typeof jQuery != 'undefined') {
300 $(".alert").alert();
298 $(".alert").alert();
301 }
299 }
302 </script>
300 </script>
303 </div>
301 </div>
304 <div class="main">
302 <div class="main">
305 <div class="box">
303 <div class="box">
306 <!-- box / title -->
304 <!-- box / title -->
307 <div class="title">
305 <div class="title">
308 <div class="breadcrumbs">
306 <div class="breadcrumbs">
309 Gist &middot; 22
307 Gist &middot; 22
310 / URL: http://test.example.com:80/_admin/gists/22
308 / URL: http://test.example.com:80/_admin/gists/22
311 </div>
309 </div>
312 </div>
310 </div>
313 <div class="table">
311 <div class="table">
314 <div id="files_data">
312 <div id="files_data">
315 <div id="codeblock" class="codeblock">
313 <div id="codeblock" class="codeblock">
316 <div class="code-header">
314 <div class="code-header">
317 <div class="stats">
315 <div class="stats">
318 <div class="buttons">
316 <div class="buttons">
319 <a class="btn btn-mini" href="/_admin/gists/22/tip/raw">Show as Raw</a>
317 <a class="btn btn-mini" href="/_admin/gists/22/tip/raw">Show as Raw</a>
320 </div>
318 </div>
321 <div class="left" >
319 <div class="left" >
322 <span> gist-desc</span>
320 <span> gist-desc</span>
323 <span>Expires:
321 <span>Expires:
324 never
322 never
325 </span>
323 </span>
326 </div>
324 </div>
327 </div>
325 </div>
328 <div class="author">
326 <div class="author">
329 <div title="RhodeCode Admin &lt;test_admin@mail.com&gt;">
327 <div title="RhodeCode Admin &lt;test_admin@mail.com&gt;">
330 <div class="rc-user tooltip" title="RhodeCode Admin &lt;test_admin@mail.com&gt;">
328 <div class="rc-user tooltip" title="RhodeCode Admin &lt;test_admin@mail.com&gt;">
331 <img class="gravatar" src="data:image/svg+xml;base64,CiAgICAgICAgPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHBvaW50ZXIt
329 <img class="gravatar" src="data:image/svg+xml;base64,CiAgICAgICAgPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHBvaW50ZXIt
332 ZXZlbnRzPSJub25lIgogICAgICAgICAgICAgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIgogICAgICAg
330 ZXZlbnRzPSJub25lIgogICAgICAgICAgICAgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIgogICAgICAg
333 ICAgICAgc3R5bGU9IndpZHRoOiAxMDAlOyBoZWlnaHQ6IDEwMCU7IGJhY2tncm91bmQtY29sb3I6
331 ICAgICAgc3R5bGU9IndpZHRoOiAxMDAlOyBoZWlnaHQ6IDEwMCU7IGJhY2tncm91bmQtY29sb3I6
334 ICM1OWIzODkiCiAgICAgICAgICAgICB2aWV3Qm94PSIwIDAgMzIgMzIiPgogICAgICAgICAgICA8
332 ICM1OWIzODkiCiAgICAgICAgICAgICB2aWV3Qm94PSIwIDAgMzIgMzIiPgogICAgICAgICAgICA8
335 dGV4dCB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB5PSI1MCUiIHg9IjUwJSIgZHk9IjAuMzVlbSIKICAg
333 dGV4dCB0ZXh0LWFuY2hvcj0ibWlkZGxlIiB5PSI1MCUiIHg9IjUwJSIgZHk9IjAuMzVlbSIKICAg
336 ICAgICAgICAgICAgICAgcG9pbnRlci1ldmVudHM9ImF1dG8iIGZpbGw9IiNmZmYiCiAgICAgICAg
334 ICAgICAgICAgICAgICAgcG9pbnRlci1ldmVudHM9ImF1dG8iIGZpbGw9IiNmZmYiCiAgICAgICAg
337 ICAgICAgICAgIGZvbnQtZmFtaWx5PSJwcm94aW1hbm92YXJlZ3VsYXIsUHJveGltYSBOb3ZhIFJl
335 ICAgICAgICAgIGZvbnQtZmFtaWx5PSJwcm94aW1hbm92YXJlZ3VsYXIsUHJveGltYSBOb3ZhIFJl
338 Z3VsYXIsUHJveGltYSBOb3ZhLEFyaWFsLEx1Y2lkYSBHcmFuZGUsc2Fucy1zZXJpZiIKICAgICAg
336 Z3VsYXIsUHJveGltYSBOb3ZhLEFyaWFsLEx1Y2lkYSBHcmFuZGUsc2Fucy1zZXJpZiIKICAgICAg
339 ICAgICAgICAgICAgc3R5bGU9ImZvbnQtd2VpZ2h0OiA0MDA7IGZvbnQtc2l6ZTogMTcuMjk3Mjk3
337 ICAgICAgICAgICAgc3R5bGU9ImZvbnQtd2VpZ2h0OiA0MDA7IGZvbnQtc2l6ZTogMTcuMjk3Mjk3
340 Mjk3M3B4OyI+VE0KICAgICAgICAgICAgPC90ZXh0PgogICAgICAgIDwvc3ZnPg==
338 Mjk3M3B4OyI+VE0KICAgICAgICAgICAgPC90ZXh0PgogICAgICAgIDwvc3ZnPg==
341 " height="16" width="16">
339 " height="16" width="16">
342 <span class="user"> <a href="/_profiles/test_admin">test_admin</a></span>
340 <span class="user"> <a href="/_profiles/test_admin">test_admin</a></span>
343 </div>
341 </div>
344 - created <time class="timeago tooltip" title="Mon, 23 May 2016 19:54:34" datetime="2016-05-23 19:54:34+00:00">Mon, 23 May 2016 19:54:34</time>
342 - created <time class="timeago tooltip" title="Mon, 23 May 2016 19:54:34" datetime="2016-05-23 19:54:34+00:00">Mon, 23 May 2016 19:54:34</time>
345 </div>
343 </div>
346 </div>
344 </div>
347 <div class="commit">added file: gist-show-me</div>
345 <div class="commit">added file: gist-show-me</div>
348 </div>
346 </div>
349 <!-- <div id="c-G-eff3be0ea272" class="stats" >
347 <!-- <div id="c-G-eff3be0ea272" class="stats" >
350 <a href="http://test.example.com:80/_admin/gists/22">ΒΆ</a>
348 <a href="http://test.example.com:80/_admin/gists/22">ΒΆ</a>
351 <b >gist-show-me</b>
349 <b >gist-show-me</b>
352 <div>
350 <div>
353 <a class="btn btn-mini" href="/_admin/gists/22/3f6f18ddcd5669697303ab3cd5a2eabb1c558c6f/raw/gist-show-me">Show as raw</a>
351 <a class="btn btn-mini" href="/_admin/gists/22/3f6f18ddcd5669697303ab3cd5a2eabb1c558c6f/raw/gist-show-me">Show as raw</a>
354 </div>
352 </div>
355 </div> -->
353 </div> -->
356 <div class="code-body textarea text-area editor">
354 <div class="code-body textarea text-area editor">
357 <table class="code-highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L1">1</a></pre></div></td><td id="hlcode" class="code"><div class="code-highlight"><pre><div id="L1"><a name="L-1"></a>some gist
355 <table class="code-highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L1">1</a></pre></div></td><td id="hlcode" class="code"><div class="code-highlight"><pre><div id="L1"><a name="L-1"></a>some gist
358 </div></pre></div>
356 </div></pre></div>
359 </td></tr></table>
357 </td></tr></table>
360 </div>
358 </div>
361 </div>
359 </div>
362 </div>
360 </div>
363 </div>
361 </div>
364 </div>
362 </div>
365 </div>
363 </div>
366 </div>
364 </div>
367 <!-- END CONTENT -->
365 <!-- END CONTENT -->
368 </div>
366 </div>
369 <!-- FOOTER -->
367 <!-- FOOTER -->
370 <div id="footer">
368 <div id="footer">
371 <div id="footer-inner" class="title wrapper">
369 <div id="footer-inner" class="title wrapper">
372 <div>
370 <div>
373 <p class="footer-link-right">
371 <p class="footer-link-right">
374 RhodeCode Enterprise 4.0.0 Community Edition
372 RhodeCode Enterprise 4.0.0 Community Edition
375 &copy; 2010-2016, <a href="https://rhodecode.com" target="_blank">RhodeCode GmbH</a>. All rights reserved.
373 &copy; 2010-2016, <a href="https://rhodecode.com" target="_blank">RhodeCode GmbH</a>. All rights reserved.
376 <a href="https://rhodecode.com/help/" target="_blank">Support</a>
374 <a href="https://rhodecode.com/help/" target="_blank">Support</a>
377 </p>
375 </p>
378 <p class="server-instance" style="display:none">
376 <p class="server-instance" style="display:none">
379 RhodeCode instance id: vps1.local-105134
377 RhodeCode instance id: vps1.local-105134
380 </p>
378 </p>
381 </div>
379 </div>
382 </div>
380 </div>
383 </div>
381 </div>
384 <!-- END FOOTER -->
382 <!-- END FOOTER -->
385 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
383 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
386 <div class="modal-dialog">
384 <div class="modal-dialog">
387 <div class="modal-content">
385 <div class="modal-content">
388 <div class="modal-header">
386 <div class="modal-header">
389 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
387 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
390 <h4 class="modal-title" id="myModalLabel">Keyboard shortcuts</h4>
388 <h4 class="modal-title" id="myModalLabel">Keyboard shortcuts</h4>
391 </div>
389 </div>
392 <div class="modal-body">
390 <div class="modal-body">
393 <div class="block-left">
391 <div class="block-left">
394 <table class="keyboard-mappings">
392 <table class="keyboard-mappings">
395 <tbody>
393 <tbody>
396 <tr>
394 <tr>
397 <th></th>
395 <th></th>
398 <th>Site-wide shortcuts</th>
396 <th>Site-wide shortcuts</th>
399 </tr>
397 </tr>
400 <tr>
398 <tr>
401 <td class="keys">
399 <td class="keys">
402 <span class="key tag">/</span>
400 <span class="key tag">/</span>
403 </td>
401 </td>
404 <td>Open quick search box</td>
402 <td>Open quick search box</td>
405 </tr>
403 </tr>
406 <tr>
404 <tr>
407 <td class="keys">
405 <td class="keys">
408 <span class="key tag">g h</span>
406 <span class="key tag">g h</span>
409 </td>
407 </td>
410 <td>Goto home page</td>
408 <td>Goto home page</td>
411 </tr>
409 </tr>
412 <tr>
410 <tr>
413 <td class="keys">
411 <td class="keys">
414 <span class="key tag">g g</span>
412 <span class="key tag">g g</span>
415 </td>
413 </td>
416 <td>Goto my private gists page</td>
414 <td>Goto my private gists page</td>
417 </tr>
415 </tr>
418 <tr>
416 <tr>
419 <td class="keys">
417 <td class="keys">
420 <span class="key tag">g G</span>
418 <span class="key tag">g G</span>
421 </td>
419 </td>
422 <td>Goto my public gists page</td>
420 <td>Goto my public gists page</td>
423 </tr>
421 </tr>
424 <tr>
422 <tr>
425 <td class="keys">
423 <td class="keys">
426 <span class="key tag">n r</span>
424 <span class="key tag">n r</span>
427 </td>
425 </td>
428 <td>New repository page</td>
426 <td>New repository page</td>
429 </tr>
427 </tr>
430 <tr>
428 <tr>
431 <td class="keys">
429 <td class="keys">
432 <span class="key tag">n g</span>
430 <span class="key tag">n g</span>
433 </td>
431 </td>
434 <td>New gist page</td>
432 <td>New gist page</td>
435 </tr>
433 </tr>
436 </tbody>
434 </tbody>
437 </table>
435 </table>
438 </div>
436 </div>
439 <div class="block-left">
437 <div class="block-left">
440 <table class="keyboard-mappings">
438 <table class="keyboard-mappings">
441 <tbody>
439 <tbody>
442 <tr>
440 <tr>
443 <th></th>
441 <th></th>
444 <th>Repositories</th>
442 <th>Repositories</th>
445 </tr>
443 </tr>
446 <tr>
444 <tr>
447 <td class="keys">
445 <td class="keys">
448 <span class="key tag">g s</span>
446 <span class="key tag">g s</span>
449 </td>
447 </td>
450 <td>Goto summary page</td>
448 <td>Goto summary page</td>
451 </tr>
449 </tr>
452 <tr>
450 <tr>
453 <td class="keys">
451 <td class="keys">
454 <span class="key tag">g c</span>
452 <span class="key tag">g c</span>
455 </td>
453 </td>
456 <td>Goto changelog page</td>
454 <td>Goto changelog page</td>
457 </tr>
455 </tr>
458 <tr>
456 <tr>
459 <td class="keys">
457 <td class="keys">
460 <span class="key tag">g f</span>
458 <span class="key tag">g f</span>
461 </td>
459 </td>
462 <td>Goto files page</td>
460 <td>Goto files page</td>
463 </tr>
461 </tr>
464 <tr>
462 <tr>
465 <td class="keys">
463 <td class="keys">
466 <span class="key tag">g F</span>
464 <span class="key tag">g F</span>
467 </td>
465 </td>
468 <td>Goto files page with file search activated</td>
466 <td>Goto files page with file search activated</td>
469 </tr>
467 </tr>
470 <tr>
468 <tr>
471 <td class="keys">
469 <td class="keys">
472 <span class="key tag">g p</span>
470 <span class="key tag">g p</span>
473 </td>
471 </td>
474 <td>Goto pull requests page</td>
472 <td>Goto pull requests page</td>
475 </tr>
473 </tr>
476 <tr>
474 <tr>
477 <td class="keys">
475 <td class="keys">
478 <span class="key tag">g o</span>
476 <span class="key tag">g o</span>
479 </td>
477 </td>
480 <td>Goto repository settings</td>
478 <td>Goto repository settings</td>
481 </tr>
479 </tr>
482 <tr>
480 <tr>
483 <td class="keys">
481 <td class="keys">
484 <span class="key tag">g O</span>
482 <span class="key tag">g O</span>
485 </td>
483 </td>
486 <td>Goto repository permissions settings</td>
484 <td>Goto repository permissions settings</td>
487 </tr>
485 </tr>
488 </tbody>
486 </tbody>
489 </table>
487 </table>
490 </div>
488 </div>
491 </div>
489 </div>
492 <div class="modal-footer">
490 <div class="modal-footer">
493 </div>
491 </div>
494 </div><!-- /.modal-content -->
492 </div><!-- /.modal-content -->
495 </div><!-- /.modal-dialog -->
493 </div><!-- /.modal-dialog -->
496 </div><!-- /.modal -->
494 </div><!-- /.modal -->
497 </body>
495 </body>
498 </html> No newline at end of file
496 </html>
General Comments 0
You need to be logged in to leave comments. Login now