Mercurial > kallithea
annotate rhodecode/public/js/rhodecode.js @ 2913:bfffaa9aff58 beta
#589 search urlgenerator didn't properly escape special chars on url
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 09 Oct 2012 19:39:26 +0200 |
parents | 9812e617c564 |
children | 2bfcec6a3985 |
rev | line source |
---|---|
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 RhodeCode JS Files |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 **/ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
4 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
5 if (typeof console == "undefined" || typeof console.log == "undefined"){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
6 console = { log: function() {} } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
10 var str_repeat = function(i, m) { |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 for (var o = []; m > 0; o[--m] = i); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 return o.join(''); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
13 }; |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
14 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
15 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
16 * INJECT .format function into String |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
17 * Usage: "My name is {0} {1}".format("Johny","Bravo") |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
18 * Return "My name is Johny Bravo" |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
19 * Inspired by https://gist.github.com/1049426 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
20 */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
21 String.prototype.format = function() { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
22 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
23 function format() { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
24 var str = this; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
25 var len = arguments.length+1; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 var safe = undefined; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 var arg = undefined; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 // For each {0} {1} {n...} replace with the argument in that position. If |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
30 // the argument is an object or an array it will be stringified to JSON. |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
31 for (var i=0; i < len; arg = arguments[i++]) { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
34 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 return str; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
36 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
37 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 // Save a reference of what may already exist under the property native. |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
39 // Allows for doing something like: if("".format.native) { /* use native */ } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
40 format.native = String.prototype.format; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
41 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
42 // Replace the prototype property |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
43 return format; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
44 |
1458
9d9e491e2a21
added author to main page tooltip
Marcin Kuzminski <marcin@python-works.com>
parents:
1426
diff
changeset
|
45 }(); |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
46 |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
47 String.prototype.strip = function(char) { |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
48 if(char === undefined){ |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
49 char = '\\s'; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
50 } |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
51 return this.replace(new RegExp('^'+char+'+|'+char+'+$','g'), ''); |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
52 } |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
53 String.prototype.lstrip = function(char) { |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
54 if(char === undefined){ |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
55 char = '\\s'; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
56 } |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
57 return this.replace(new RegExp('^'+char+'+'),''); |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
58 } |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
59 String.prototype.rstrip = function(char) { |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
60 if(char === undefined){ |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
61 char = '\\s'; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
62 } |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
63 return this.replace(new RegExp(''+char+'+$'),''); |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
64 } |
1465
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
65 |
2612
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
66 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
67 if(!Array.prototype.indexOf) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
68 Array.prototype.indexOf = function(needle) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
69 for(var i = 0; i < this.length; i++) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
70 if(this[i] === needle) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
71 return i; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
72 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
73 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
74 return -1; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
75 }; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
76 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
77 |
2698
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
78 // IE(CRAP) doesn't support previousElementSibling |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
79 var prevElementSibling = function( el ) { |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
80 if( el.previousElementSibling ) { |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
81 return el.previousElementSibling; |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
82 } else { |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
83 while( el = el.previousSibling ) { |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
84 if( el.nodeType === 1 ) return el; |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
85 } |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
86 } |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
87 } |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
88 |
2849
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
89 var setSelectValue = function(select, val){ |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
90 var selection = YUD.get(select); |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
91 |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
92 // select element |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
93 for(var i=0;i<selection.options.length;i++){ |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
94 console.log(selection.options[i].innerHTML); |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
95 if (selection.options[i].innerHTML == val) { |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
96 selection.selectedIndex = i; |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
97 break; |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
98 } |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
99 } |
2b672f04bfd9
fixed few issues with autoselection of revisions on pull requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2789
diff
changeset
|
100 } |
2698
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
101 |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
102 |
1465
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
103 /** |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
104 * SmartColorGenerator |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
105 * |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
106 *usage:: |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
107 * var CG = new ColorGenerator(); |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
108 * var col = CG.getColor(key); //returns array of RGB |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
109 * 'rgb({0})'.format(col.join(',') |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
110 * |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
111 * @returns {ColorGenerator} |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
112 */ |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
113 var ColorGenerator = function(){ |
1465
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
114 this.GOLDEN_RATIO = 0.618033988749895; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
115 this.CURRENT_RATIO = 0.22717784590367374 // this can be random |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
116 this.HSV_1 = 0.75;//saturation |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
117 this.HSV_2 = 0.95; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
118 this.color; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
119 this.cacheColorMap = {}; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
120 }; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
121 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
122 ColorGenerator.prototype = { |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
123 getColor:function(key){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
124 if(this.cacheColorMap[key] !== undefined){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
125 return this.cacheColorMap[key]; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
126 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
127 else{ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
128 this.cacheColorMap[key] = this.generateColor(); |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
129 return this.cacheColorMap[key]; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
130 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
131 }, |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
132 _hsvToRgb:function(h,s,v){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
133 if (s == 0.0) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
134 return [v, v, v]; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
135 i = parseInt(h * 6.0) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
136 f = (h * 6.0) - i |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
137 p = v * (1.0 - s) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
138 q = v * (1.0 - s * f) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
139 t = v * (1.0 - s * (1.0 - f)) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
140 i = i % 6 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
141 if (i == 0) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
142 return [v, t, p] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
143 if (i == 1) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
144 return [q, v, p] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
145 if (i == 2) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
146 return [p, v, t] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
147 if (i == 3) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
148 return [p, q, v] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
149 if (i == 4) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
150 return [t, p, v] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
151 if (i == 5) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
152 return [v, p, q] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
153 }, |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
154 generateColor:function(){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
155 this.CURRENT_RATIO = this.CURRENT_RATIO+this.GOLDEN_RATIO; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
156 this.CURRENT_RATIO = this.CURRENT_RATIO %= 1; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
157 HSV_tuple = [this.CURRENT_RATIO, this.HSV_1, this.HSV_2] |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
158 RGB_tuple = this._hsvToRgb(HSV_tuple[0],HSV_tuple[1],HSV_tuple[2]); |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
159 function toRgb(v){ |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
160 return ""+parseInt(v*256) |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
161 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
162 return [toRgb(RGB_tuple[0]),toRgb(RGB_tuple[1]),toRgb(RGB_tuple[2])]; |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
163 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
164 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
165 } |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
166 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
167 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
168 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
169 |
ef31d0c6bae9
Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
1458
diff
changeset
|
170 |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
171 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
172 * GLOBAL YUI Shortcuts |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
173 */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
174 var YUC = YAHOO.util.Connect; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
175 var YUD = YAHOO.util.Dom; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
176 var YUE = YAHOO.util.Event; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
177 var YUQ = YAHOO.util.Selector.query; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
178 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
179 // defines if push state is enabled for this browser ? |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
180 var push_state_enabled = Boolean( |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
181 window.history && window.history.pushState && window.history.replaceState |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
182 && !( /* disable for versions of iOS before version 4.3 (8F190) */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
183 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent) |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
184 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
185 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent) |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
186 ) |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
187 ); |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
188 |
1717
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
189 var _run_callbacks = function(callbacks){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
190 if (callbacks !== undefined){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
191 var _l = callbacks.length; |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
192 for (var i=0;i<_l;i++){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
193 var func = callbacks[i]; |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
194 if(typeof(func)=='function'){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
195 try{ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
196 func(); |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
197 }catch (err){}; |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
198 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
199 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
200 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
201 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
202 |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
203 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
204 * Partial Ajax Implementation |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
205 * |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
206 * @param url: defines url to make partial request |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
207 * @param container: defines id of container to input partial result |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
208 * @param s_call: success callback function that takes o as arg |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
209 * o.tId |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
210 * o.status |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
211 * o.statusText |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
212 * o.getResponseHeader[ ] |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
213 * o.getAllResponseHeaders |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
214 * o.responseText |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
215 * o.responseXML |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
216 * o.argument |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
217 * @param f_call: failure callback |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
218 * @param args arguments |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
219 */ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
220 function ypjax(url,container,s_call,f_call,args){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
221 var method='GET'; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
222 if(args===undefined){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
223 args=null; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
224 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
225 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
226 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
227 YUC.initHeader('X-PARTIAL-XHR',true); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
228 |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
229 // wrapper of passed callback |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
230 var s_wrapper = (function(o){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
231 return function(o){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
232 YUD.get(container).innerHTML=o.responseText; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
233 YUD.setStyle(container,'opacity','1.0'); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
234 //execute the given original callback |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
235 if (s_call !== undefined){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
236 s_call(o); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
237 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
238 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
239 })() |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
240 YUD.setStyle(container,'opacity','0.3'); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
241 YUC.asyncRequest(method,url,{ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
242 success:s_wrapper, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
243 failure:function(o){ |
1651
96ae22a4e963
Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents:
1638
diff
changeset
|
244 console.log(o); |
2690
ad0b61d9177a
fix leftover error coloring after ypjax failure
Marcin Kuzminski <marcin@python-works.com>
parents:
2686
diff
changeset
|
245 YUD.get(container).innerHTML='<span class="error_red">ERROR: {0}</span>'.format(o.status); |
1651
96ae22a4e963
Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents:
1638
diff
changeset
|
246 YUD.setStyle(container,'opacity','1.0'); |
2694
78694f9acd31
Add cache to ypjax calls to overcome chrome caching issues of requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2690
diff
changeset
|
247 }, |
78694f9acd31
Add cache to ypjax calls to overcome chrome caching issues of requests
Marcin Kuzminski <marcin@python-works.com>
parents:
2690
diff
changeset
|
248 cache:false |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
249 },args); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
250 |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
251 }; |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
252 |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
253 var ajaxPOST = function(url,postData,success) { |
2189
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
254 // Set special header for ajax == HTTP_X_PARTIAL_XHR |
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
255 YUC.initHeader('X-PARTIAL-XHR',true); |
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
256 |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
257 var toQueryString = function(o) { |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
258 if(typeof o !== 'object') { |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
259 return false; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
260 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
261 var _p, _qs = []; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
262 for(_p in o) { |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
263 _qs.push(encodeURIComponent(_p) + '=' + encodeURIComponent(o[_p])); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
264 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
265 return _qs.join('&'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
266 }; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
267 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
268 var sUrl = url; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
269 var callback = { |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
270 success: success, |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
271 failure: function (o) { |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
272 alert("error"); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
273 }, |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
274 }; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
275 var postData = toQueryString(postData); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
276 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
277 return request; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
278 }; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
279 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
280 |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
281 /** |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
282 * tooltip activate |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
283 */ |
1458
9d9e491e2a21
added author to main page tooltip
Marcin Kuzminski <marcin@python-works.com>
parents:
1426
diff
changeset
|
284 var tooltip_activate = function(){ |
1421
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
285 function toolTipsId(){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
286 var ids = []; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
287 var tts = YUQ('.tooltip'); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
288 for (var i = 0; i < tts.length; i++) { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
289 // if element doesn't not have and id |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
290 // autogenerate one for tooltip |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
291 if (!tts[i].id){ |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
292 tts[i].id='tt'+((i*100)+tts.length); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
293 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
294 ids.push(tts[i].id); |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
295 } |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
296 return ids |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
297 }; |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
298 var myToolTips = new YAHOO.widget.Tooltip("tooltip", { |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
299 context: [[toolTipsId()],"tl","bl",null,[0,5]], |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
300 monitorresize:false, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
301 xyoffset :[0,0], |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
302 autodismissdelay:300000, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
303 hidedelay:5, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
304 showdelay:20, |
c6b811f11c94
Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
305 }); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
306 }; |
1426
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
307 |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
308 /** |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
309 * show more |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
310 */ |
1458
9d9e491e2a21
added author to main page tooltip
Marcin Kuzminski <marcin@python-works.com>
parents:
1426
diff
changeset
|
311 var show_more_event = function(){ |
1426
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
312 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){ |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
313 var el = e.target; |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
314 YUD.setStyle(YUD.get(el.id.substring(1)),'display',''); |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
315 YUD.setStyle(el.parentNode,'display','none'); |
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
316 }); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
317 }; |
1426
91708b96e991
Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents:
1421
diff
changeset
|
318 |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
319 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
320 /** |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
321 * Quick filter widget |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
322 * |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
323 * @param target: filter input target |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
324 * @param nodes: list of nodes in html we want to filter. |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
325 * @param display_element function that takes current node from nodes and |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
326 * does hide or show based on the node |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
327 * |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
328 */ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
329 var q_filter = function(target,nodes,display_element){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
330 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
331 var nodes = nodes; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
332 var q_filter_field = YUD.get(target); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
333 var F = YAHOO.namespace(target); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
334 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
335 YUE.on(q_filter_field,'click',function(){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
336 q_filter_field.value = ''; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
337 }); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
338 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
339 YUE.on(q_filter_field,'keyup',function(e){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
340 clearTimeout(F.filterTimeout); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
341 F.filterTimeout = setTimeout(F.updateFilter,600); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
342 }); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
343 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
344 F.filterTimeout = null; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
345 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
346 var show_node = function(node){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
347 YUD.setStyle(node,'display','') |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
348 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
349 var hide_node = function(node){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
350 YUD.setStyle(node,'display','none'); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
351 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
352 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
353 F.updateFilter = function() { |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
354 // Reset timeout |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
355 F.filterTimeout = null; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
356 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
357 var obsolete = []; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
358 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
359 var req = q_filter_field.value.toLowerCase(); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
360 |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
361 var l = nodes.length; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
362 var i; |
1667
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
363 var showing = 0; |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
364 |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
365 for (i=0;i<l;i++ ){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
366 var n = nodes[i]; |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
367 var target_element = display_element(n) |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
368 if(req && n.innerHTML.toLowerCase().indexOf(req) == -1){ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
369 hide_node(target_element); |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
370 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
371 else{ |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
372 show_node(target_element); |
1667
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
373 showing+=1; |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
374 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
375 } |
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
376 |
1667
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
377 // if repo_count is set update the number |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
378 var cnt = YUD.get('repo_count'); |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
379 if(cnt){ |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
380 YUD.get('repo_count').innerHTML = showing; |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
381 } |
fab837f40cf7
fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents:
1653
diff
changeset
|
382 |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
383 } |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
384 }; |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
385 |
2787
423a14349ef3
Don't use .innerHTML for tr field, I'm looking at you IE
Marcin Kuzminski <marcin@python-works.com>
parents:
2759
diff
changeset
|
386 var tableTr = function(cls, body){ |
2789
d3e5c259fe71
Fixing inline comment for IE.
Marcin Kuzminski <marcin@python-works.com>
parents:
2787
diff
changeset
|
387 var _el = document.createElement('div'); |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
388 var cont = new YAHOO.util.Element(body); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
389 var comment_id = fromHTML(body).children[0].id.split('comment-')[1]; |
2787
423a14349ef3
Don't use .innerHTML for tr field, I'm looking at you IE
Marcin Kuzminski <marcin@python-works.com>
parents:
2759
diff
changeset
|
390 var id = 'comment-tr-{0}'.format(comment_id); |
2789
d3e5c259fe71
Fixing inline comment for IE.
Marcin Kuzminski <marcin@python-works.com>
parents:
2787
diff
changeset
|
391 var _html = ('<table><tbody><tr id="{0}" class="{1}">'+ |
2787
423a14349ef3
Don't use .innerHTML for tr field, I'm looking at you IE
Marcin Kuzminski <marcin@python-works.com>
parents:
2759
diff
changeset
|
392 '<td class="lineno-inline new-inline"></td>'+ |
423a14349ef3
Don't use .innerHTML for tr field, I'm looking at you IE
Marcin Kuzminski <marcin@python-works.com>
parents:
2759
diff
changeset
|
393 '<td class="lineno-inline old-inline"></td>'+ |
423a14349ef3
Don't use .innerHTML for tr field, I'm looking at you IE
Marcin Kuzminski <marcin@python-works.com>
parents:
2759
diff
changeset
|
394 '<td>{2}</td>'+ |
2789
d3e5c259fe71
Fixing inline comment for IE.
Marcin Kuzminski <marcin@python-works.com>
parents:
2787
diff
changeset
|
395 '</tr></tbody></table>').format(id, cls, body); |
2787
423a14349ef3
Don't use .innerHTML for tr field, I'm looking at you IE
Marcin Kuzminski <marcin@python-works.com>
parents:
2759
diff
changeset
|
396 _el.innerHTML = _html; |
2789
d3e5c259fe71
Fixing inline comment for IE.
Marcin Kuzminski <marcin@python-works.com>
parents:
2787
diff
changeset
|
397 return _el.children[0].children[0].children[0]; |
1674
6f0143e5efe5
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1667
diff
changeset
|
398 }; |
1653
b1e1dffd595c
one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents:
1651
diff
changeset
|
399 |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
400 /** comments **/ |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
401 var removeInlineForm = function(form) { |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
402 form.parentNode.removeChild(form); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
403 }; |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
404 |
1682
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
405 var createInlineForm = function(parent_tr, f_path, line) { |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
406 var tmpl = YUD.get('comment-inline-form-template').innerHTML; |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
407 tmpl = tmpl.format(f_path, line); |
1682
1f2ba96de73e
#71 code review
Marcin Kuzminski <marcin@python-works.com>
parents:
1679
diff
changeset
|
408 var form = tableTr('comment-form-inline',tmpl) |
2787
423a14349ef3
Don't use .innerHTML for tr field, I'm looking at you IE
Marcin Kuzminski <marcin@python-works.com>
parents:
2759
diff
changeset
|
409 |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
410 // create event for hide button |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
411 form = new YAHOO.util.Element(form); |
2723
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
412 var form_hide_button = new YAHOO.util.Element(YUD.getElementsByClassName('hide-inline-form',null,form)[0]); |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
413 form_hide_button.on('click', function(e) { |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
414 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode; |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
415 if(YUD.hasClass(newtr.nextElementSibling,'inline-comments-button')){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
416 YUD.setStyle(newtr.nextElementSibling,'display',''); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
417 } |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
418 removeInlineForm(newtr); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
419 YUD.removeClass(parent_tr, 'form-open'); |
2868
4982f5b06e2b
Add highlight class for future multiline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2849
diff
changeset
|
420 YUD.removeClass(parent_tr, 'hl-comment'); |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
421 |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
422 }); |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
423 |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
424 return form |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
425 }; |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
426 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
427 /** |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
428 * Inject inline comment for on given TR this tr should be always an .line |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
429 * tr containing the line. Code will detect comment, and always put the comment |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
430 * block at the very bottom |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
431 */ |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
432 var injectInlineForm = function(tr){ |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
433 if(!YUD.hasClass(tr, 'line')){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
434 return |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
435 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
436 var submit_url = AJAX_COMMENT_URL; |
2723
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
437 var _td = YUD.getElementsByClassName('code',null,tr)[0]; |
2608
58c529332e7e
Added option to close pull requests, in future that will be close & merge
Marcin Kuzminski <marcin@python-works.com>
parents:
2548
diff
changeset
|
438 if(YUD.hasClass(tr,'form-open') || YUD.hasClass(tr,'context') || YUD.hasClass(_td,'no-comment')){ |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
439 return |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
440 } |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
441 YUD.addClass(tr,'form-open'); |
2868
4982f5b06e2b
Add highlight class for future multiline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2849
diff
changeset
|
442 YUD.addClass(tr,'hl-comment'); |
2723
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
443 var node = YUD.getElementsByClassName('full_f_path',null,tr.parentNode.parentNode.parentNode)[0]; |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
444 var f_path = YUD.getAttribute(node,'path'); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
445 var lineno = getLineNo(tr); |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
446 var form = createInlineForm(tr, f_path, lineno, submit_url); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
447 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
448 var parent = tr; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
449 while (1){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
450 var n = parent.nextElementSibling; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
451 // next element are comments ! |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
452 if(YUD.hasClass(n,'inline-comments')){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
453 parent = n; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
454 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
455 else{ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
456 break; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
457 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
458 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
459 YUD.insertAfter(form,parent); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
460 var f = YUD.get(form); |
2723
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
461 var overlay = YUD.getElementsByClassName('overlay',null,f)[0]; |
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
462 var _form = YUD.getElementsByClassName('inline-form',null,f)[0]; |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
463 |
2789
d3e5c259fe71
Fixing inline comment for IE.
Marcin Kuzminski <marcin@python-works.com>
parents:
2787
diff
changeset
|
464 YUE.on(YUD.get(_form), 'submit',function(e){ |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
465 YUE.preventDefault(e); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
466 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
467 //ajax submit |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
468 var text = YUD.get('text_'+lineno).value; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
469 var postData = { |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
470 'text':text, |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
471 'f_path':f_path, |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
472 'line':lineno |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
473 }; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
474 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
475 if(lineno === undefined){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
476 alert('missing line !'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
477 return |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
478 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
479 if(f_path === undefined){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
480 alert('missing file path !'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
481 return |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
482 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
483 |
2189
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
484 if(text == ""){ |
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
485 return |
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
486 } |
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
487 |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
488 var success = function(o){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
489 YUD.removeClass(tr, 'form-open'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
490 removeInlineForm(f); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
491 var json_data = JSON.parse(o.responseText); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
492 renderInlineComment(json_data); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
493 }; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
494 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
495 if (YUD.hasClass(overlay,'overlay')){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
496 var w = _form.offsetWidth; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
497 var h = _form.offsetHeight; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
498 YUD.setStyle(overlay,'width',w+'px'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
499 YUD.setStyle(overlay,'height',h+'px'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
500 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
501 YUD.addClass(overlay, 'submitting'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
502 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
503 ajaxPOST(submit_url, postData, success); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
504 }); |
2437
81c29d269aed
fixed race condition in autocomplete widget on inlines comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2428
diff
changeset
|
505 |
81c29d269aed
fixed race condition in autocomplete widget on inlines comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2428
diff
changeset
|
506 setTimeout(function(){ |
81c29d269aed
fixed race condition in autocomplete widget on inlines comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2428
diff
changeset
|
507 // callbacks |
81c29d269aed
fixed race condition in autocomplete widget on inlines comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2428
diff
changeset
|
508 tooltip_activate(); |
81c29d269aed
fixed race condition in autocomplete widget on inlines comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2428
diff
changeset
|
509 MentionsAutoComplete('text_'+lineno, 'mentions_container_'+lineno, |
81c29d269aed
fixed race condition in autocomplete widget on inlines comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2428
diff
changeset
|
510 _USERS_AC_DATA, _GROUPS_AC_DATA); |
2698
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
511 var _e = YUD.get('text_'+lineno); |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
512 if(_e){ |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
513 _e.focus(); |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
514 } |
2437
81c29d269aed
fixed race condition in autocomplete widget on inlines comments
Marcin Kuzminski <marcin@python-works.com>
parents:
2428
diff
changeset
|
515 },10) |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
516 }; |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
517 |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
518 var deleteComment = function(comment_id){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
519 var url = AJAX_COMMENT_DELETE_URL.replace('__COMMENT_ID__',comment_id); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
520 var postData = {'_method':'delete'}; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
521 var success = function(o){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
522 var n = YUD.get('comment-tr-'+comment_id); |
2698
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
523 var root = prevElementSibling(prevElementSibling(n)); |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
524 n.parentNode.removeChild(n); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
525 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
526 // scann nodes, and attach add button to last one |
2189
3052f90c568a
fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents:
2187
diff
changeset
|
527 placeAddButton(root); |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
528 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
529 ajaxPOST(url,postData,success); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
530 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
531 |
2614
3f50a5e8fc4d
Added editing of pull-request reviewers.
Marcin Kuzminski <marcin@python-works.com>
parents:
2613
diff
changeset
|
532 var updateReviewers = function(reviewers_ids){ |
3f50a5e8fc4d
Added editing of pull-request reviewers.
Marcin Kuzminski <marcin@python-works.com>
parents:
2613
diff
changeset
|
533 var url = AJAX_UPDATE_PULLREQUEST; |
3f50a5e8fc4d
Added editing of pull-request reviewers.
Marcin Kuzminski <marcin@python-works.com>
parents:
2613
diff
changeset
|
534 var postData = {'_method':'put', |
3f50a5e8fc4d
Added editing of pull-request reviewers.
Marcin Kuzminski <marcin@python-works.com>
parents:
2613
diff
changeset
|
535 'reviewers_ids': reviewers_ids}; |
3f50a5e8fc4d
Added editing of pull-request reviewers.
Marcin Kuzminski <marcin@python-works.com>
parents:
2613
diff
changeset
|
536 var success = function(o){ |
3f50a5e8fc4d
Added editing of pull-request reviewers.
Marcin Kuzminski <marcin@python-works.com>
parents:
2613
diff
changeset
|
537 window.location.reload(); |
3f50a5e8fc4d
Added editing of pull-request reviewers.
Marcin Kuzminski <marcin@python-works.com>
parents:
2613
diff
changeset
|
538 } |
3f50a5e8fc4d
Added editing of pull-request reviewers.
Marcin Kuzminski <marcin@python-works.com>
parents:
2613
diff
changeset
|
539 ajaxPOST(url,postData,success); |
3f50a5e8fc4d
Added editing of pull-request reviewers.
Marcin Kuzminski <marcin@python-works.com>
parents:
2613
diff
changeset
|
540 } |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
541 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
542 var createInlineAddButton = function(tr){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
543 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
544 var label = TRANSLATION_MAP['add another comment']; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
545 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
546 var html_el = document.createElement('div'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
547 YUD.addClass(html_el, 'add-comment'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
548 html_el.innerHTML = '<span class="ui-btn">{0}</span>'.format(label); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
549 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
550 var add = new YAHOO.util.Element(html_el); |
1705
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
551 add.on('click', function(e) { |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
552 injectInlineForm(tr); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
553 }); |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
554 return add; |
5e4827a8e942
added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
555 }; |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
556 |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
557 var getLineNo = function(tr) { |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
558 var line; |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
559 var o = tr.children[0].id.split('_'); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
560 var n = tr.children[1].id.split('_'); |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
561 |
1679
c3d9cd8c0cba
fixed inline comment file parsing
Marcin Kuzminski <marcin@python-works.com>
parents:
1677
diff
changeset
|
562 if (n.length >= 2) { |
c3d9cd8c0cba
fixed inline comment file parsing
Marcin Kuzminski <marcin@python-works.com>
parents:
1677
diff
changeset
|
563 line = n[n.length-1]; |
c3d9cd8c0cba
fixed inline comment file parsing
Marcin Kuzminski <marcin@python-works.com>
parents:
1677
diff
changeset
|
564 } else if (o.length >= 2) { |
1685
2e583dbfcf22
fixed typo in linenumber calculation on inline comments
Marcin Kuzminski <marcin@python-works.com>
parents:
1683
diff
changeset
|
565 line = o[o.length-1]; |
1677
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
566 } |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
567 |
7276b170ce8b
#71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents:
1674
diff
changeset
|
568 return line |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
569 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
570 |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
571 var placeAddButton = function(target_tr){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
572 if(!target_tr){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
573 return |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
574 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
575 var last_node = target_tr; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
576 //scann |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
577 while (1){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
578 var n = last_node.nextElementSibling; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
579 // next element are comments ! |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
580 if(YUD.hasClass(n,'inline-comments')){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
581 last_node = n; |
2723
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
582 //also remove the comment button from previous |
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
583 var comment_add_buttons = YUD.getElementsByClassName('add-comment',null,last_node); |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
584 for(var i=0;i<comment_add_buttons.length;i++){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
585 var b = comment_add_buttons[i]; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
586 b.parentNode.removeChild(b); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
587 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
588 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
589 else{ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
590 break; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
591 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
592 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
593 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
594 var add = createInlineAddButton(target_tr); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
595 // get the comment div |
2723
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
596 var comment_block = YUD.getElementsByClassName('comment',null,last_node)[0]; |
2187
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
597 // attach add button |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
598 YUD.insertAfter(add,comment_block); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
599 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
600 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
601 /** |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
602 * Places the inline comment into the changeset block in proper line position |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
603 */ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
604 var placeInline = function(target_container,lineno,html){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
605 var lineid = "{0}_{1}".format(target_container,lineno); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
606 var target_line = YUD.get(lineid); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
607 var comment = new YAHOO.util.Element(tableTr('inline-comments',html)) |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
608 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
609 // check if there are comments already ! |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
610 var parent = target_line.parentNode; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
611 var root_parent = parent; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
612 while (1){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
613 var n = parent.nextElementSibling; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
614 // next element are comments ! |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
615 if(YUD.hasClass(n,'inline-comments')){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
616 parent = n; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
617 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
618 else{ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
619 break; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
620 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
621 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
622 // put in the comment at the bottom |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
623 YUD.insertAfter(comment,parent); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
624 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
625 // scann nodes, and attach add button to last one |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
626 placeAddButton(root_parent); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
627 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
628 return target_line; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
629 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
630 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
631 /** |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
632 * make a single inline comment and place it inside |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
633 */ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
634 var renderInlineComment = function(json_data){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
635 try{ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
636 var html = json_data['rendered_text']; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
637 var lineno = json_data['line_no']; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
638 var target_id = json_data['target_id']; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
639 placeInline(target_id, lineno, html); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
640 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
641 }catch(e){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
642 console.log(e); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
643 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
644 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
645 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
646 /** |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
647 * Iterates over all the inlines, and places them inside proper blocks of data |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
648 */ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
649 var renderInlineComments = function(file_comments){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
650 for (f in file_comments){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
651 // holding all comments for a FILE |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
652 var box = file_comments[f]; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
653 |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
654 var target_id = YUD.getAttribute(box,'target_id'); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
655 // actually comments with line numbers |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
656 var comments = box.children; |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
657 for(var i=0; i<comments.length; i++){ |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
658 var data = { |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
659 'rendered_text': comments[i].outerHTML, |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
660 'line_no': YUD.getAttribute(comments[i],'line'), |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
661 'target_id': target_id |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
662 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
663 renderInlineComment(data); |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
664 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
665 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
666 } |
b61e540122f2
#415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents:
2145
diff
changeset
|
667 |
2613
ad3573d744ef
added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents:
2612
diff
changeset
|
668 var removeReviewer = function(reviewer_id){ |
ad3573d744ef
added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents:
2612
diff
changeset
|
669 var el = YUD.get('reviewer_{0}'.format(reviewer_id)); |
ad3573d744ef
added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents:
2612
diff
changeset
|
670 if (el.parentNode !== undefined){ |
ad3573d744ef
added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents:
2612
diff
changeset
|
671 el.parentNode.removeChild(el); |
ad3573d744ef
added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents:
2612
diff
changeset
|
672 } |
ad3573d744ef
added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents:
2612
diff
changeset
|
673 } |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
674 |
2428
530bd12fc18a
removed JSON array envelope from filter files function
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
675 var fileBrowserListeners = function(current_url, node_list_url, url_base){ |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
676 var current_url_branch = +"?branch=__BRANCH__"; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
677 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
678 YUE.on('stay_at_branch','click',function(e){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
679 if(e.target.checked){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
680 var uri = current_url_branch; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
681 uri = uri.replace('__BRANCH__',e.target.value); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
682 window.location = uri; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
683 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
684 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
685 window.location = current_url; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
686 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
687 }) |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
688 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
689 var n_filter = YUD.get('node_filter'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
690 var F = YAHOO.namespace('node_filter'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
691 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
692 F.filterTimeout = null; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
693 var nodes = null; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
694 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
695 F.initFilter = function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
696 YUD.setStyle('node_filter_box_loading','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
697 YUD.setStyle('search_activate_id','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
698 YUD.setStyle('add_node_id','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
699 YUC.initHeader('X-PARTIAL-XHR',true); |
2891
9812e617c564
fix files quick filter links
Marcin Kuzminski <marcin@python-works.com>
parents:
2868
diff
changeset
|
700 YUC.asyncRequest('GET', node_list_url, { |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
701 success:function(o){ |
2428
530bd12fc18a
removed JSON array envelope from filter files function
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
702 nodes = JSON.parse(o.responseText).nodes; |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
703 YUD.setStyle('node_filter_box_loading','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
704 YUD.setStyle('node_filter_box','display',''); |
1810
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
705 n_filter.focus(); |
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
706 if(YUD.hasClass(n_filter,'init')){ |
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
707 n_filter.value = ''; |
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
708 YUD.removeClass(n_filter,'init'); |
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
709 } |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
710 }, |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
711 failure:function(o){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
712 console.log('failed to load'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
713 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
714 },null); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
715 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
716 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
717 F.updateFilter = function(e) { |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
718 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
719 return function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
720 // Reset timeout |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
721 F.filterTimeout = null; |
1810
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
722 var query = e.target.value.toLowerCase(); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
723 var match = []; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
724 var matches = 0; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
725 var matches_max = 20; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
726 if (query != ""){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
727 for(var i=0;i<nodes.length;i++){ |
1810
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
728 |
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
729 var pos = nodes[i].name.toLowerCase().indexOf(query) |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
730 if(query && pos != -1){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
731 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
732 matches++ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
733 //show only certain amount to not kill browser |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
734 if (matches > matches_max){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
735 break; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
736 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
737 |
1810
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
738 var n = nodes[i].name; |
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
739 var t = nodes[i].type; |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
740 var n_hl = n.substring(0,pos) |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
741 +"<b>{0}</b>".format(n.substring(pos,pos+query.length)) |
2686
269c6e0b54cc
Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents:
2658
diff
changeset
|
742 +n.substring(pos+query.length) |
2891
9812e617c564
fix files quick filter links
Marcin Kuzminski <marcin@python-works.com>
parents:
2868
diff
changeset
|
743 var new_url = url_base.replace('__FPATH__',n); |
9812e617c564
fix files quick filter links
Marcin Kuzminski <marcin@python-works.com>
parents:
2868
diff
changeset
|
744 match.push('<tr><td><a class="browser-{0}" href="{1}">{2}</a></td><td colspan="5"></td></tr>'.format(t,new_url,n_hl)); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
745 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
746 if(match.length >= matches_max){ |
2428
530bd12fc18a
removed JSON array envelope from filter files function
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
747 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(_TM['search truncated'])); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
748 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
749 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
750 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
751 if(query != ""){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
752 YUD.setStyle('tbody','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
753 YUD.setStyle('tbody_filtered','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
754 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
755 if (match.length==0){ |
2428
530bd12fc18a
removed JSON array envelope from filter files function
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
756 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(_TM['no matching files'])); |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
757 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
758 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
759 YUD.get('tbody_filtered').innerHTML = match.join(""); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
760 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
761 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
762 YUD.setStyle('tbody','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
763 YUD.setStyle('tbody_filtered','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
764 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
765 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
766 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
767 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
768 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
769 YUE.on(YUD.get('filter_activate'),'click',function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
770 F.initFilter(); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
771 }) |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
772 YUE.on(n_filter,'click',function(){ |
1810
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
773 if(YUD.hasClass(n_filter,'init')){ |
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
774 n_filter.value = ''; |
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
775 YUD.removeClass(n_filter,'init'); |
203af05539e0
implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents:
1787
diff
changeset
|
776 } |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
777 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
778 YUE.on(n_filter,'keyup',function(e){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
779 clearTimeout(F.filterTimeout); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
780 F.filterTimeout = setTimeout(F.updateFilter(e),600); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
781 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
782 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
783 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
784 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
785 var initCodeMirror = function(textAreadId,resetUrl){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
786 var myCodeMirror = CodeMirror.fromTextArea(YUD.get(textAreadId),{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
787 mode: "null", |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
788 lineNumbers:true |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
789 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
790 YUE.on('reset','click',function(e){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
791 window.location=resetUrl |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
792 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
793 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
794 YUE.on('file_enable','click',function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
795 YUD.setStyle('editor_container','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
796 YUD.setStyle('upload_file_container','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
797 YUD.setStyle('filename_container','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
798 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
799 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
800 YUE.on('upload_file_enable','click',function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
801 YUD.setStyle('editor_container','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
802 YUD.setStyle('upload_file_container','display',''); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
803 YUD.setStyle('filename_container','display','none'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
804 }); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
805 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
806 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
807 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
808 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
809 var getIdentNode = function(n){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
810 //iterate thru nodes untill matched interesting node ! |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
811 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
812 if (typeof n == 'undefined'){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
813 return -1 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
814 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
815 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
816 if(typeof n.id != "undefined" && n.id.match('L[0-9]+')){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
817 return n |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
818 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
819 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
820 return getIdentNode(n.parentNode); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
821 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
822 }; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
823 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
824 var getSelectionLink = function(selection_link_label) { |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
825 return function(){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
826 //get selection from start/to nodes |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
827 if (typeof window.getSelection != "undefined") { |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
828 s = window.getSelection(); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
829 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
830 from = getIdentNode(s.anchorNode); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
831 till = getIdentNode(s.focusNode); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
832 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
833 f_int = parseInt(from.id.replace('L','')); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
834 t_int = parseInt(till.id.replace('L','')); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
835 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
836 if (f_int > t_int){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
837 //highlight from bottom |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
838 offset = -35; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
839 ranges = [t_int,f_int]; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
840 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
841 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
842 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
843 //highligth from top |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
844 offset = 35; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
845 ranges = [f_int,t_int]; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
846 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
847 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
848 if (ranges[0] != ranges[1]){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
849 if(YUD.get('linktt') == null){ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
850 hl_div = document.createElement('div'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
851 hl_div.id = 'linktt'; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
852 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
853 anchor = '#L'+ranges[0]+'-'+ranges[1]; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
854 hl_div.innerHTML = ''; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
855 l = document.createElement('a'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
856 l.href = location.href.substring(0,location.href.indexOf('#'))+anchor; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
857 l.innerHTML = selection_link_label; |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
858 hl_div.appendChild(l); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
859 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
860 YUD.get('body').appendChild(hl_div); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
861 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
862 xy = YUD.getXY(till.id); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
863 |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
864 YUD.addClass('linktt','yui-tt'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
865 YUD.setStyle('linktt','top',xy[1]+offset+'px'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
866 YUD.setStyle('linktt','left',xy[0]+'px'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
867 YUD.setStyle('linktt','visibility','visible'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
868 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
869 else{ |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
870 YUD.setStyle('linktt','visibility','hidden'); |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
871 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
872 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
873 } |
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1685
diff
changeset
|
874 }; |
1712
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
875 |
1717
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
876 var deleteNotification = function(url, notification_id,callbacks){ |
1712
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
877 var callback = { |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
878 success:function(o){ |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
879 var obj = YUD.get(String("notification_"+notification_id)); |
1717
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
880 if(obj.parentNode !== undefined){ |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
881 obj.parentNode.removeChild(obj); |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
882 } |
7ff304d3028f
Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1712
diff
changeset
|
883 _run_callbacks(callbacks); |
1712
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
884 }, |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
885 failure:function(o){ |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
886 alert("error"); |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
887 }, |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
888 }; |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
889 var postData = '_method=delete'; |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
890 var sUrl = url.replace('__NOTIFICATION_ID__',notification_id); |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
891 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
892 callback, postData); |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1705
diff
changeset
|
893 }; |
1778
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
894 |
2610
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
895 var readNotification = function(url, notification_id,callbacks){ |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
896 var callback = { |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
897 success:function(o){ |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
898 var obj = YUD.get(String("notification_"+notification_id)); |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
899 YUD.removeClass(obj, 'unread'); |
2723
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
900 var r_button = YUD.getElementsByClassName('read-notification',null,obj.children[0])[0]; |
2610
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
901 |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
902 if(r_button.parentNode !== undefined){ |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
903 r_button.parentNode.removeChild(r_button); |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
904 } |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
905 _run_callbacks(callbacks); |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
906 }, |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
907 failure:function(o){ |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
908 alert("error"); |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
909 }, |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
910 }; |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
911 var postData = '_method=put'; |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
912 var sUrl = url.replace('__NOTIFICATION_ID__',notification_id); |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
913 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
914 callback, postData); |
3fdf7c3be2c9
added mark as read for single notifications
Marcin Kuzminski <marcin@python-works.com>
parents:
2608
diff
changeset
|
915 }; |
1778
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
916 |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
917 /** MEMBERS AUTOCOMPLETE WIDGET **/ |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
918 |
2759
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
919 var MembersAutoComplete = function (divid, cont, users_list, groups_list) { |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
920 var myUsers = users_list; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
921 var myGroups = groups_list; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
922 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
923 // Define a custom search function for the DataSource of users |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
924 var matchUsers = function (sQuery) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
925 // Case insensitive matching |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
926 var query = sQuery.toLowerCase(); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
927 var i = 0; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
928 var l = myUsers.length; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
929 var matches = []; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
930 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
931 // Match against each name of each contact |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
932 for (; i < l; i++) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
933 contact = myUsers[i]; |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
934 if (((contact.fname+"").toLowerCase().indexOf(query) > -1) || |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
935 ((contact.lname+"").toLowerCase().indexOf(query) > -1) || |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
936 ((contact.nname) && ((contact.nname).toLowerCase().indexOf(query) > -1))) { |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
937 matches[matches.length] = contact; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
938 } |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
939 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
940 return matches; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
941 }; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
942 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
943 // Define a custom search function for the DataSource of usersGroups |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
944 var matchGroups = function (sQuery) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
945 // Case insensitive matching |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
946 var query = sQuery.toLowerCase(); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
947 var i = 0; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
948 var l = myGroups.length; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
949 var matches = []; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
950 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
951 // Match against each name of each contact |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
952 for (; i < l; i++) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
953 matched_group = myGroups[i]; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
954 if (matched_group.grname.toLowerCase().indexOf(query) > -1) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
955 matches[matches.length] = matched_group; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
956 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
957 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
958 return matches; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
959 }; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
960 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
961 //match all |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
962 var matchAll = function (sQuery) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
963 u = matchUsers(sQuery); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
964 g = matchGroups(sQuery); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
965 return u.concat(g); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
966 }; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
967 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
968 // DataScheme for members |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
969 var memberDS = new YAHOO.util.FunctionDataSource(matchAll); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
970 memberDS.responseSchema = { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
971 fields: ["id", "fname", "lname", "nname", "grname", "grmembers", "gravatar_lnk"] |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
972 }; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
973 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
974 // DataScheme for owner |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
975 var ownerDS = new YAHOO.util.FunctionDataSource(matchUsers); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
976 ownerDS.responseSchema = { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
977 fields: ["id", "fname", "lname", "nname", "gravatar_lnk"] |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
978 }; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
979 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
980 // Instantiate AutoComplete for perms |
2759
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
981 var membersAC = new YAHOO.widget.AutoComplete(divid, cont, memberDS); |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
982 membersAC.useShadow = false; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
983 membersAC.resultTypeList = false; |
2611
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
984 membersAC.animVert = false; |
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
985 membersAC.animHoriz = false; |
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
986 membersAC.animSpeed = 0.1; |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
987 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
988 // Instantiate AutoComplete for owner |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
989 var ownerAC = new YAHOO.widget.AutoComplete("user", "owner_container", ownerDS); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
990 ownerAC.useShadow = false; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
991 ownerAC.resultTypeList = false; |
2611
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
992 ownerAC.animVert = false; |
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
993 ownerAC.animHoriz = false; |
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
994 ownerAC.animSpeed = 0.1; |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
995 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
996 // Helper highlight function for the formatter |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
997 var highlightMatch = function (full, snippet, matchindex) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
998 return full.substring(0, matchindex) |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
999 + "<span class='match'>" |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1000 + full.substr(matchindex, snippet.length) |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1001 + "</span>" + full.substring(matchindex + snippet.length); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1002 }; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1003 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1004 // Custom formatter to highlight the matching letters |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1005 var custom_formatter = function (oResultData, sQuery, sResultMatch) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1006 var query = sQuery.toLowerCase(); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1007 var _gravatar = function(res, em, group){ |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1008 if (group !== undefined){ |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1009 em = '/images/icons/group.png' |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1010 } |
2145
f8e66d942dcb
autocomplete overflow fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2142
diff
changeset
|
1011 tmpl = '<div class="ac-container-wrap"><img class="perm-gravatar-ac" src="{0}"/>{1}</div>' |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1012 return tmpl.format(em,res) |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1013 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1014 // group |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1015 if (oResultData.grname != undefined) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1016 var grname = oResultData.grname; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1017 var grmembers = oResultData.grmembers; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1018 var grnameMatchIndex = grname.toLowerCase().indexOf(query); |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1019 var grprefix = "{0}: ".format(_TM['Group']); |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1020 var grsuffix = " (" + grmembers + " )"; |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1021 var grsuffix = " ({0} {1})".format(grmembers, _TM['members']); |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1022 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1023 if (grnameMatchIndex > -1) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1024 return _gravatar(grprefix + highlightMatch(grname, query, grnameMatchIndex) + grsuffix,null,true); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1025 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1026 return _gravatar(grprefix + oResultData.grname + grsuffix, null,true); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1027 // Users |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1028 } else if (oResultData.nname != undefined) { |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1029 var fname = oResultData.fname || ""; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1030 var lname = oResultData.lname || ""; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1031 var nname = oResultData.nname; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1032 |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1033 // Guard against null value |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1034 var fnameMatchIndex = fname.toLowerCase().indexOf(query), |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1035 lnameMatchIndex = lname.toLowerCase().indexOf(query), |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1036 nnameMatchIndex = nname.toLowerCase().indexOf(query), |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1037 displayfname, displaylname, displaynname; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1038 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1039 if (fnameMatchIndex > -1) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1040 displayfname = highlightMatch(fname, query, fnameMatchIndex); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1041 } else { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1042 displayfname = fname; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1043 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1044 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1045 if (lnameMatchIndex > -1) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1046 displaylname = highlightMatch(lname, query, lnameMatchIndex); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1047 } else { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1048 displaylname = lname; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1049 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1050 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1051 if (nnameMatchIndex > -1) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1052 displaynname = "(" + highlightMatch(nname, query, nnameMatchIndex) + ")"; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1053 } else { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1054 displaynname = nname ? "(" + nname + ")" : ""; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1055 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1056 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1057 return _gravatar(displayfname + " " + displaylname + " " + displaynname, oResultData.gravatar_lnk); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1058 } else { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1059 return ''; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1060 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1061 }; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1062 membersAC.formatResult = custom_formatter; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1063 ownerAC.formatResult = custom_formatter; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1064 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1065 var myHandler = function (sType, aArgs) { |
2759
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1066 var nextId = divid.split('perm_new_member_name_')[1]; |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1067 var myAC = aArgs[0]; // reference back to the AC instance |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1068 var elLI = aArgs[1]; // reference to the selected LI element |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1069 var oData = aArgs[2]; // object literal of selected item's result data |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1070 //fill the autocomplete with value |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1071 if (oData.nname != undefined) { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1072 //users |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1073 myAC.getInputEl().value = oData.nname; |
2759
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1074 YUD.get('perm_new_member_type_'+nextId).value = 'user'; |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1075 } else { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1076 //groups |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1077 myAC.getInputEl().value = oData.grname; |
2759
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1078 YUD.get('perm_new_member_type_'+nextId).value = 'users_group'; |
2142
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1079 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1080 }; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1081 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1082 membersAC.itemSelectEvent.subscribe(myHandler); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1083 if(ownerAC.itemSelectEvent){ |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1084 ownerAC.itemSelectEvent.subscribe(myHandler); |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1085 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1086 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1087 return { |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1088 memberDS: memberDS, |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1089 ownerDS: ownerDS, |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1090 membersAC: membersAC, |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1091 ownerAC: ownerAC, |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1092 }; |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1093 } |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1094 |
a21eab6ff42f
Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents:
2128
diff
changeset
|
1095 |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1096 var MentionsAutoComplete = function (divid, cont, users_list, groups_list) { |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1097 var myUsers = users_list; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1098 var myGroups = groups_list; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1099 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1100 // Define a custom search function for the DataSource of users |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1101 var matchUsers = function (sQuery) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1102 var org_sQuery = sQuery; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1103 if(this.mentionQuery == null){ |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1104 return [] |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1105 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1106 sQuery = this.mentionQuery; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1107 // Case insensitive matching |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1108 var query = sQuery.toLowerCase(); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1109 var i = 0; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1110 var l = myUsers.length; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1111 var matches = []; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1112 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1113 // Match against each name of each contact |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1114 for (; i < l; i++) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1115 contact = myUsers[i]; |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1116 if (((contact.fname+"").toLowerCase().indexOf(query) > -1) || |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1117 ((contact.lname+"").toLowerCase().indexOf(query) > -1) || |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1118 ((contact.nname) && ((contact.nname).toLowerCase().indexOf(query) > -1))) { |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1119 matches[matches.length] = contact; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1120 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1121 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1122 return matches |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1123 }; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1124 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1125 //match all |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1126 var matchAll = function (sQuery) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1127 u = matchUsers(sQuery); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1128 return u |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1129 }; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1130 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1131 // DataScheme for owner |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1132 var ownerDS = new YAHOO.util.FunctionDataSource(matchUsers); |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1133 |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1134 ownerDS.responseSchema = { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1135 fields: ["id", "fname", "lname", "nname", "gravatar_lnk"] |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1136 }; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1137 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1138 // Instantiate AutoComplete for mentions |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1139 var ownerAC = new YAHOO.widget.AutoComplete(divid, cont, ownerDS); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1140 ownerAC.useShadow = false; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1141 ownerAC.resultTypeList = false; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1142 ownerAC.suppressInputUpdate = true; |
2611
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
1143 ownerAC.animVert = false; |
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
1144 ownerAC.animHoriz = false; |
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
1145 ownerAC.animSpeed = 0.1; |
e83be26bb8d8
disable animation on autocomplete widget
Marcin Kuzminski <marcin@python-works.com>
parents:
2610
diff
changeset
|
1146 |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1147 // Helper highlight function for the formatter |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1148 var highlightMatch = function (full, snippet, matchindex) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1149 return full.substring(0, matchindex) |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1150 + "<span class='match'>" |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1151 + full.substr(matchindex, snippet.length) |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1152 + "</span>" + full.substring(matchindex + snippet.length); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1153 }; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1154 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1155 // Custom formatter to highlight the matching letters |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1156 ownerAC.formatResult = function (oResultData, sQuery, sResultMatch) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1157 var org_sQuery = sQuery; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1158 if(this.dataSource.mentionQuery != null){ |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1159 sQuery = this.dataSource.mentionQuery; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1160 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1161 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1162 var query = sQuery.toLowerCase(); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1163 var _gravatar = function(res, em, group){ |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1164 if (group !== undefined){ |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1165 em = '/images/icons/group.png' |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1166 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1167 tmpl = '<div class="ac-container-wrap"><img class="perm-gravatar-ac" src="{0}"/>{1}</div>' |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1168 return tmpl.format(em,res) |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1169 } |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1170 if (oResultData.nname != undefined) { |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1171 var fname = oResultData.fname || ""; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1172 var lname = oResultData.lname || ""; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1173 var nname = oResultData.nname; |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1174 |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1175 // Guard against null value |
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1176 var fnameMatchIndex = fname.toLowerCase().indexOf(query), |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1177 lnameMatchIndex = lname.toLowerCase().indexOf(query), |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1178 nnameMatchIndex = nname.toLowerCase().indexOf(query), |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1179 displayfname, displaylname, displaynname; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1180 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1181 if (fnameMatchIndex > -1) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1182 displayfname = highlightMatch(fname, query, fnameMatchIndex); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1183 } else { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1184 displayfname = fname; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1185 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1186 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1187 if (lnameMatchIndex > -1) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1188 displaylname = highlightMatch(lname, query, lnameMatchIndex); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1189 } else { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1190 displaylname = lname; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1191 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1192 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1193 if (nnameMatchIndex > -1) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1194 displaynname = "(" + highlightMatch(nname, query, nnameMatchIndex) + ")"; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1195 } else { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1196 displaynname = nname ? "(" + nname + ")" : ""; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1197 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1198 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1199 return _gravatar(displayfname + " " + displaylname + " " + displaynname, oResultData.gravatar_lnk); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1200 } else { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1201 return ''; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1202 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1203 }; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1204 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1205 if(ownerAC.itemSelectEvent){ |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1206 ownerAC.itemSelectEvent.subscribe(function (sType, aArgs) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1207 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1208 var myAC = aArgs[0]; // reference back to the AC instance |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1209 var elLI = aArgs[1]; // reference to the selected LI element |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1210 var oData = aArgs[2]; // object literal of selected item's result data |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1211 //fill the autocomplete with value |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1212 if (oData.nname != undefined) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1213 //users |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1214 //Replace the mention name with replaced |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1215 var re = new RegExp(); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1216 var org = myAC.getInputEl().value; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1217 var chunks = myAC.dataSource.chunks |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1218 // replace middle chunk(the search term) with actuall match |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1219 chunks[1] = chunks[1].replace('@'+myAC.dataSource.mentionQuery, |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1220 '@'+oData.nname+' '); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1221 myAC.getInputEl().value = chunks.join('') |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1222 YUD.get(myAC.getInputEl()).focus(); // Y U NO WORK !? |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1223 } else { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1224 //groups |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1225 myAC.getInputEl().value = oData.grname; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1226 YUD.get('perm_new_member_type').value = 'users_group'; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1227 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1228 }); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1229 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1230 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1231 // in this keybuffer we will gather current value of search ! |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1232 // since we need to get this just when someone does `@` then we do the |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1233 // search |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1234 ownerAC.dataSource.chunks = []; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1235 ownerAC.dataSource.mentionQuery = null; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1236 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1237 ownerAC.get_mention = function(msg, max_pos) { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1238 var org = msg; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1239 var re = new RegExp('(?:^@|\s@)([a-zA-Z0-9]{1}[a-zA-Z0-9\-\_\.]+)$') |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1240 var chunks = []; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1241 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1242 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1243 // cut first chunk until curret pos |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1244 var to_max = msg.substr(0, max_pos); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1245 var at_pos = Math.max(0,to_max.lastIndexOf('@')-1); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1246 var msg2 = to_max.substr(at_pos); |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1247 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1248 chunks.push(org.substr(0,at_pos))// prefix chunk |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1249 chunks.push(msg2) // search chunk |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1250 chunks.push(org.substr(max_pos)) // postfix chunk |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1251 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1252 // clean up msg2 for filtering and regex match |
2369
c2f131502037
Autocomplete fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
2368
diff
changeset
|
1253 var msg2 = msg2.lstrip(' ').lstrip('\n'); |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1254 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1255 if(re.test(msg2)){ |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1256 var unam = re.exec(msg2)[1]; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1257 return [unam, chunks]; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1258 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1259 return [null, null]; |
2612
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1260 }; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1261 |
2698
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1262 if (ownerAC.textboxKeyUpEvent){ |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1263 ownerAC.textboxKeyUpEvent.subscribe(function(type, args){ |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1264 |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1265 var ac_obj = args[0]; |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1266 var currentMessage = args[1]; |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1267 var currentCaretPosition = args[0]._elTextbox.selectionStart; |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1268 |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1269 var unam = ownerAC.get_mention(currentMessage, currentCaretPosition); |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1270 var curr_search = null; |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1271 if(unam[0]){ |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1272 curr_search = unam[0]; |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1273 } |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1274 |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1275 ownerAC.dataSource.chunks = unam[1]; |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1276 ownerAC.dataSource.mentionQuery = curr_search; |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1277 |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1278 }) |
4debfe3b50be
ie8 fixes for inline comments :/
Marcin Kuzminski <marcin@python-works.com>
parents:
2694
diff
changeset
|
1279 } |
2368
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1280 return { |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1281 ownerDS: ownerDS, |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1282 ownerAC: ownerAC, |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1283 }; |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1284 } |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1285 |
5143b8df576c
Added mentions autocomplete into main comments form
Marcin Kuzminski <marcin@python-works.com>
parents:
2189
diff
changeset
|
1286 |
2612
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1287 var PullRequestAutoComplete = function (divid, cont, users_list, groups_list) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1288 var myUsers = users_list; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1289 var myGroups = groups_list; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1290 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1291 // Define a custom search function for the DataSource of users |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1292 var matchUsers = function (sQuery) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1293 // Case insensitive matching |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1294 var query = sQuery.toLowerCase(); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1295 var i = 0; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1296 var l = myUsers.length; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1297 var matches = []; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1298 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1299 // Match against each name of each contact |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1300 for (; i < l; i++) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1301 contact = myUsers[i]; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1302 if (((contact.fname+"").toLowerCase().indexOf(query) > -1) || |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1303 ((contact.lname+"").toLowerCase().indexOf(query) > -1) || |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1304 ((contact.nname) && ((contact.nname).toLowerCase().indexOf(query) > -1))) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1305 matches[matches.length] = contact; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1306 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1307 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1308 return matches; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1309 }; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1310 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1311 // Define a custom search function for the DataSource of usersGroups |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1312 var matchGroups = function (sQuery) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1313 // Case insensitive matching |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1314 var query = sQuery.toLowerCase(); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1315 var i = 0; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1316 var l = myGroups.length; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1317 var matches = []; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1318 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1319 // Match against each name of each contact |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1320 for (; i < l; i++) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1321 matched_group = myGroups[i]; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1322 if (matched_group.grname.toLowerCase().indexOf(query) > -1) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1323 matches[matches.length] = matched_group; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1324 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1325 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1326 return matches; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1327 }; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1328 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1329 //match all |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1330 var matchAll = function (sQuery) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1331 u = matchUsers(sQuery); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1332 return u |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1333 }; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1334 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1335 // DataScheme for owner |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1336 var ownerDS = new YAHOO.util.FunctionDataSource(matchUsers); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1337 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1338 ownerDS.responseSchema = { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1339 fields: ["id", "fname", "lname", "nname", "gravatar_lnk"] |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1340 }; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1341 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1342 // Instantiate AutoComplete for mentions |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1343 var reviewerAC = new YAHOO.widget.AutoComplete(divid, cont, ownerDS); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1344 reviewerAC.useShadow = false; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1345 reviewerAC.resultTypeList = false; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1346 reviewerAC.suppressInputUpdate = true; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1347 reviewerAC.animVert = false; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1348 reviewerAC.animHoriz = false; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1349 reviewerAC.animSpeed = 0.1; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1350 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1351 // Helper highlight function for the formatter |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1352 var highlightMatch = function (full, snippet, matchindex) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1353 return full.substring(0, matchindex) |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1354 + "<span class='match'>" |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1355 + full.substr(matchindex, snippet.length) |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1356 + "</span>" + full.substring(matchindex + snippet.length); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1357 }; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1358 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1359 // Custom formatter to highlight the matching letters |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1360 reviewerAC.formatResult = function (oResultData, sQuery, sResultMatch) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1361 var org_sQuery = sQuery; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1362 if(this.dataSource.mentionQuery != null){ |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1363 sQuery = this.dataSource.mentionQuery; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1364 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1365 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1366 var query = sQuery.toLowerCase(); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1367 var _gravatar = function(res, em, group){ |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1368 if (group !== undefined){ |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1369 em = '/images/icons/group.png' |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1370 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1371 tmpl = '<div class="ac-container-wrap"><img class="perm-gravatar-ac" src="{0}"/>{1}</div>' |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1372 return tmpl.format(em,res) |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1373 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1374 if (oResultData.nname != undefined) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1375 var fname = oResultData.fname || ""; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1376 var lname = oResultData.lname || ""; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1377 var nname = oResultData.nname; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1378 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1379 // Guard against null value |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1380 var fnameMatchIndex = fname.toLowerCase().indexOf(query), |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1381 lnameMatchIndex = lname.toLowerCase().indexOf(query), |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1382 nnameMatchIndex = nname.toLowerCase().indexOf(query), |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1383 displayfname, displaylname, displaynname; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1384 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1385 if (fnameMatchIndex > -1) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1386 displayfname = highlightMatch(fname, query, fnameMatchIndex); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1387 } else { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1388 displayfname = fname; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1389 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1390 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1391 if (lnameMatchIndex > -1) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1392 displaylname = highlightMatch(lname, query, lnameMatchIndex); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1393 } else { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1394 displaylname = lname; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1395 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1396 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1397 if (nnameMatchIndex > -1) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1398 displaynname = "(" + highlightMatch(nname, query, nnameMatchIndex) + ")"; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1399 } else { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1400 displaynname = nname ? "(" + nname + ")" : ""; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1401 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1402 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1403 return _gravatar(displayfname + " " + displaylname + " " + displaynname, oResultData.gravatar_lnk); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1404 } else { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1405 return ''; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1406 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1407 }; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1408 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1409 //members cache to catch duplicates |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1410 reviewerAC.dataSource.cache = []; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1411 // hack into select event |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1412 if(reviewerAC.itemSelectEvent){ |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1413 reviewerAC.itemSelectEvent.subscribe(function (sType, aArgs) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1414 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1415 var myAC = aArgs[0]; // reference back to the AC instance |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1416 var elLI = aArgs[1]; // reference to the selected LI element |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1417 var oData = aArgs[2]; // object literal of selected item's result data |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1418 var members = YUD.get('review_members'); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1419 //fill the autocomplete with value |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1420 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1421 if (oData.nname != undefined) { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1422 if (myAC.dataSource.cache.indexOf(oData.id) != -1){ |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1423 return |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1424 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1425 |
2613
ad3573d744ef
added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents:
2612
diff
changeset
|
1426 var tmpl = '<li id="reviewer_{2}">'+ |
2612
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1427 '<div class="reviewers_member">'+ |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1428 '<div class="gravatar"><img alt="gravatar" src="{0}"/> </div>'+ |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1429 '<div style="float:left">{1}</div>'+ |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1430 '<input type="hidden" value="{2}" name="review_members" />'+ |
2613
ad3573d744ef
added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents:
2612
diff
changeset
|
1431 '<span class="delete_icon action_button" onclick="removeReviewer({2})"></span>'+ |
2612
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1432 '</div>'+ |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1433 '</li>' |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1434 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1435 var displayname = "{0} {1} ({2})".format(oData.fname,oData.lname,oData.nname); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1436 var element = tmpl.format(oData.gravatar_lnk,displayname,oData.id); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1437 members.innerHTML += element; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1438 myAC.dataSource.cache.push(oData.id); |
2613
ad3573d744ef
added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents:
2612
diff
changeset
|
1439 YUD.get('user').value = '' |
2612
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1440 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1441 }); |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1442 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1443 return { |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1444 ownerDS: ownerDS, |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1445 reviewerAC: reviewerAC, |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1446 }; |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1447 } |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1448 |
9364776d1331
Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents:
2611
diff
changeset
|
1449 |
1778
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1450 /** |
1779
9edd6ac132f0
Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents:
1778
diff
changeset
|
1451 * QUICK REPO MENU |
9edd6ac132f0
Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents:
1778
diff
changeset
|
1452 */ |
9edd6ac132f0
Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents:
1778
diff
changeset
|
1453 var quick_repo_menu = function(){ |
2088
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1454 YUE.on(YUQ('.quick_repo_menu'),'mouseenter',function(e){ |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1455 var menu = e.currentTarget.firstElementChild.firstElementChild; |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1456 if(YUD.hasClass(menu,'hidden')){ |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1457 YUD.replaceClass(e.currentTarget,'hidden', 'active'); |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1458 YUD.replaceClass(menu, 'hidden', 'active'); |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1459 } |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1460 }) |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1461 YUE.on(YUQ('.quick_repo_menu'),'mouseleave',function(e){ |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1462 var menu = e.currentTarget.firstElementChild.firstElementChild; |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1463 if(YUD.hasClass(menu,'active')){ |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1464 YUD.replaceClass(e.currentTarget, 'active', 'hidden'); |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1465 YUD.replaceClass(menu, 'active', 'hidden'); |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1466 } |
382df4e69dfc
quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents:
2087
diff
changeset
|
1467 }) |
1779
9edd6ac132f0
Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents:
1778
diff
changeset
|
1468 }; |
9edd6ac132f0
Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents:
1778
diff
changeset
|
1469 |
9edd6ac132f0
Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents:
1778
diff
changeset
|
1470 |
9edd6ac132f0
Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents:
1778
diff
changeset
|
1471 /** |
1778
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1472 * TABLE SORTING |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1473 */ |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1474 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1475 // returns a node from given html; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1476 var fromHTML = function(html){ |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1477 var _html = document.createElement('element'); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1478 _html.innerHTML = html; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1479 return _html; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1480 } |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1481 var get_rev = function(node){ |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1482 var n = node.firstElementChild.firstElementChild; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1483 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1484 if (n===null){ |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1485 return -1 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1486 } |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1487 else{ |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1488 out = n.firstElementChild.innerHTML.split(':')[0].replace('r',''); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1489 return parseInt(out); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1490 } |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1491 } |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1492 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1493 var get_name = function(node){ |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1494 var name = node.firstElementChild.children[2].innerHTML; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1495 return name |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1496 } |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1497 var get_group_name = function(node){ |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1498 var name = node.firstElementChild.children[1].innerHTML; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1499 return name |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1500 } |
1782
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1501 var get_date = function(node){ |
2548
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1502 var date_ = YUD.getAttribute(node.firstElementChild,'date'); |
1782
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1503 return date_ |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1504 } |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1505 |
2548
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1506 var get_age = function(node){ |
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1507 return node |
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1508 } |
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1509 |
2658
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1510 var get_link = function(node){ |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1511 return node.firstElementChild.text; |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1512 } |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1513 |
1778
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1514 var revisionSort = function(a, b, desc, field) { |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1515 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1516 var a_ = fromHTML(a.getData(field)); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1517 var b_ = fromHTML(b.getData(field)); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1518 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1519 // extract revisions from string nodes |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1520 a_ = get_rev(a_) |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1521 b_ = get_rev(b_) |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1522 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1523 var comp = YAHOO.util.Sort.compare; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1524 var compState = comp(a_, b_, desc); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1525 return compState; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1526 }; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1527 var ageSort = function(a, b, desc, field) { |
2548
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1528 var a_ = fromHTML(a.getData(field)); |
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1529 var b_ = fromHTML(b.getData(field)); |
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1530 |
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1531 // extract name from table |
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1532 a_ = get_date(a_) |
0ff919f1c283
Fixed sorting by data when using custom date format from settings
Marcin Kuzminski <marcin@python-works.com>
parents:
2441
diff
changeset
|
1533 b_ = get_date(b_) |
1778
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1534 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1535 var comp = YAHOO.util.Sort.compare; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1536 var compState = comp(a_, b_, desc); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1537 return compState; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1538 }; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1539 |
2699
4eef5eeb81a3
fixed sorting by last_login in users admin page
Marcin Kuzminski <marcin@python-works.com>
parents:
2698
diff
changeset
|
1540 var lastLoginSort = function(a, b, desc, field) { |
4eef5eeb81a3
fixed sorting by last_login in users admin page
Marcin Kuzminski <marcin@python-works.com>
parents:
2698
diff
changeset
|
1541 var a_ = a.getData('last_login_raw') || 0; |
4eef5eeb81a3
fixed sorting by last_login in users admin page
Marcin Kuzminski <marcin@python-works.com>
parents:
2698
diff
changeset
|
1542 var b_ = b.getData('last_login_raw') || 0; |
4eef5eeb81a3
fixed sorting by last_login in users admin page
Marcin Kuzminski <marcin@python-works.com>
parents:
2698
diff
changeset
|
1543 |
4eef5eeb81a3
fixed sorting by last_login in users admin page
Marcin Kuzminski <marcin@python-works.com>
parents:
2698
diff
changeset
|
1544 var comp = YAHOO.util.Sort.compare; |
4eef5eeb81a3
fixed sorting by last_login in users admin page
Marcin Kuzminski <marcin@python-works.com>
parents:
2698
diff
changeset
|
1545 var compState = comp(a_, b_, desc); |
4eef5eeb81a3
fixed sorting by last_login in users admin page
Marcin Kuzminski <marcin@python-works.com>
parents:
2698
diff
changeset
|
1546 return compState; |
4eef5eeb81a3
fixed sorting by last_login in users admin page
Marcin Kuzminski <marcin@python-works.com>
parents:
2698
diff
changeset
|
1547 }; |
4eef5eeb81a3
fixed sorting by last_login in users admin page
Marcin Kuzminski <marcin@python-works.com>
parents:
2698
diff
changeset
|
1548 |
1778
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1549 var nameSort = function(a, b, desc, field) { |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1550 var a_ = fromHTML(a.getData(field)); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1551 var b_ = fromHTML(b.getData(field)); |
2658
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1552 |
1778
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1553 // extract name from table |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1554 a_ = get_name(a_) |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1555 b_ = get_name(b_) |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1556 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1557 var comp = YAHOO.util.Sort.compare; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1558 var compState = comp(a_, b_, desc); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1559 return compState; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1560 }; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1561 |
2127
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1562 var permNameSort = function(a, b, desc, field) { |
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1563 var a_ = fromHTML(a.getData(field)); |
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1564 var b_ = fromHTML(b.getData(field)); |
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1565 // extract name from table |
2128
e29c688e6885
linkify perms and make global ones display better
Marcin Kuzminski <marcin@python-works.com>
parents:
2127
diff
changeset
|
1566 |
e29c688e6885
linkify perms and make global ones display better
Marcin Kuzminski <marcin@python-works.com>
parents:
2127
diff
changeset
|
1567 a_ = a_.children[0].innerHTML; |
e29c688e6885
linkify perms and make global ones display better
Marcin Kuzminski <marcin@python-works.com>
parents:
2127
diff
changeset
|
1568 b_ = b_.children[0].innerHTML; |
2127
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1569 |
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1570 var comp = YAHOO.util.Sort.compare; |
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1571 var compState = comp(a_, b_, desc); |
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1572 return compState; |
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1573 }; |
b745d5d2563c
implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
2088
diff
changeset
|
1574 |
1778
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1575 var groupNameSort = function(a, b, desc, field) { |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1576 var a_ = fromHTML(a.getData(field)); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1577 var b_ = fromHTML(b.getData(field)); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1578 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1579 // extract name from table |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1580 a_ = get_group_name(a_) |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1581 b_ = get_group_name(b_) |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1582 |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1583 var comp = YAHOO.util.Sort.compare; |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1584 var compState = comp(a_, b_, desc); |
defcf245f3e9
fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents:
1772
diff
changeset
|
1585 return compState; |
1782
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1586 }; |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1587 var dateSort = function(a, b, desc, field) { |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1588 var a_ = fromHTML(a.getData(field)); |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1589 var b_ = fromHTML(b.getData(field)); |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1590 |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1591 // extract name from table |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1592 a_ = get_date(a_) |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1593 b_ = get_date(b_) |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1594 |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1595 var comp = YAHOO.util.Sort.compare; |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1596 var compState = comp(a_, b_, desc); |
eaf09acf6872
added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents:
1779
diff
changeset
|
1597 return compState; |
2394
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1598 }; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1599 |
2658
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1600 var linkSort = function(a, b, desc, field) { |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1601 var a_ = fromHTML(a.getData(field)); |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1602 var b_ = fromHTML(a.getData(field)); |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1603 |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1604 // extract url text from string nodes |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1605 a_ = get_link(a_) |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1606 b_ = get_link(b_) |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1607 |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1608 var comp = YAHOO.util.Sort.compare; |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1609 var compState = comp(a_, b_, desc); |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1610 return compState; |
80d837028c40
implemented admin panel Users table with YUI datatable
Marcin Kuzminski <marcin@python-works.com>
parents:
2614
diff
changeset
|
1611 } |
2394
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1612 |
2759
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1613 var addPermAction = function(_html, users_list, groups_list){ |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1614 var elmts = YUD.getElementsByClassName('last_new_member'); |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1615 var last_node = elmts[elmts.length-1]; |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1616 if (last_node){ |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1617 var next_id = (YUD.getElementsByClassName('new_members')).length; |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1618 _html = _html.format(next_id); |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1619 last_node.innerHTML = _html; |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1620 YUD.setStyle(last_node, 'display', ''); |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1621 YUD.removeClass(last_node, 'last_new_member'); |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1622 MembersAutoComplete("perm_new_member_name_"+next_id, |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1623 "perm_container_"+next_id, users_list, groups_list); |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1624 //create new last NODE |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1625 var el = document.createElement('tr'); |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1626 el.id = 'add_perm_input'; |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1627 YUD.addClass(el,'last_new_member'); |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1628 YUD.addClass(el,'new_members'); |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1629 YUD.insertAfter(el, last_node); |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1630 } |
c61c2ccea2b4
#538 form for permissions can handle multiple users at once
Marcin Kuzminski <marcin@python-works.com>
parents:
2723
diff
changeset
|
1631 } |
2394
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1632 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1633 /* Multi selectors */ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1634 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1635 var MultiSelectWidget = function(selected_id, available_id, form_id){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1636 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1637 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1638 //definition of containers ID's |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1639 var selected_container = selected_id; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1640 var available_container = available_id; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1641 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1642 //temp container for selected storage. |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1643 var cache = new Array(); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1644 var av_cache = new Array(); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1645 var c = YUD.get(selected_container); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1646 var ac = YUD.get(available_container); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1647 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1648 //get only selected options for further fullfilment |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1649 for(var i = 0;node =c.options[i];i++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1650 if(node.selected){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1651 //push selected to my temp storage left overs :) |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1652 cache.push(node); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1653 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1654 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1655 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1656 //get all available options to cache |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1657 for(var i = 0;node =ac.options[i];i++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1658 //push selected to my temp storage left overs :) |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1659 av_cache.push(node); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1660 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1661 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1662 //fill available only with those not in choosen |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1663 ac.options.length=0; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1664 tmp_cache = new Array(); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1665 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1666 for(var i = 0;node = av_cache[i];i++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1667 var add = true; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1668 for(var i2 = 0;node_2 = cache[i2];i2++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1669 if(node.value == node_2.value){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1670 add=false; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1671 break; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1672 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1673 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1674 if(add){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1675 tmp_cache.push(new Option(node.text, node.value, false, false)); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1676 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1677 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1678 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1679 for(var i = 0;node = tmp_cache[i];i++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1680 ac.options[i] = node; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1681 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1682 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1683 function prompts_action_callback(e){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1684 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1685 var choosen = YUD.get(selected_container); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1686 var available = YUD.get(available_container); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1687 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1688 //get checked and unchecked options from field |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1689 function get_checked(from_field){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1690 //temp container for storage. |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1691 var sel_cache = new Array(); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1692 var oth_cache = new Array(); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1693 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1694 for(var i = 0;node = from_field.options[i];i++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1695 if(node.selected){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1696 //push selected fields :) |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1697 sel_cache.push(node); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1698 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1699 else{ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1700 oth_cache.push(node) |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1701 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1702 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1703 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1704 return [sel_cache,oth_cache] |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1705 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1706 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1707 //fill the field with given options |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1708 function fill_with(field,options){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1709 //clear firtst |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1710 field.options.length=0; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1711 for(var i = 0;node = options[i];i++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1712 field.options[i]=new Option(node.text, node.value, |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1713 false, false); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1714 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1715 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1716 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1717 //adds to current field |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1718 function add_to(field,options){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1719 for(var i = 0;node = options[i];i++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1720 field.appendChild(new Option(node.text, node.value, |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1721 false, false)); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1722 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1723 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1724 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1725 // add action |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1726 if (this.id=='add_element'){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1727 var c = get_checked(available); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1728 add_to(choosen,c[0]); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1729 fill_with(available,c[1]); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1730 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1731 // remove action |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1732 if (this.id=='remove_element'){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1733 var c = get_checked(choosen); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1734 add_to(available,c[0]); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1735 fill_with(choosen,c[1]); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1736 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1737 // add all elements |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1738 if(this.id=='add_all_elements'){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1739 for(var i=0; node = available.options[i];i++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1740 choosen.appendChild(new Option(node.text, |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1741 node.value, false, false)); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1742 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1743 available.options.length = 0; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1744 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1745 //remove all elements |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1746 if(this.id=='remove_all_elements'){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1747 for(var i=0; node = choosen.options[i];i++){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1748 available.appendChild(new Option(node.text, |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1749 node.value, false, false)); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1750 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1751 choosen.options.length = 0; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1752 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1753 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1754 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1755 |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1756 YUE.addListener(['add_element','remove_element', |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1757 'add_all_elements','remove_all_elements'],'click', |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1758 prompts_action_callback) |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1759 if (form_id !== undefined) { |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1760 YUE.addListener(form_id,'submit',function(){ |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1761 var choosen = YUD.get(selected_container); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1762 for (var i = 0; i < choosen.options.length; i++) { |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1763 choosen.options[i].selected = 'selected'; |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1764 } |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1765 }); |
6776f4e569d7
Moved select widget to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents:
2369
diff
changeset
|
1766 } |
2723
04aa0ea1ddd0
fixed comment addition and deletion functionality on IE9
Dies Koper <diesk@fast.au.fujitsu.com>
parents:
2699
diff
changeset
|
1767 } |