Show More
@@ -339,6 +339,58 var show_changeset_tooltip = function(){ | |||||
339 | }); |
|
339 | }); | |
340 | }; |
|
340 | }; | |
341 |
|
341 | |||
|
342 | var onSuccessFollow = function(target){ | |||
|
343 | var f = YUD.get(target.id); | |||
|
344 | var f_cnt = YUD.get('current_followers_count'); | |||
|
345 | ||||
|
346 | if(YUD.hasClass(f, 'follow')){ | |||
|
347 | f.setAttribute('class','following'); | |||
|
348 | f.setAttribute('title',_TM['Stop following this repository']); | |||
|
349 | ||||
|
350 | if(f_cnt){ | |||
|
351 | var cnt = Number(f_cnt.innerHTML)+1; | |||
|
352 | f_cnt.innerHTML = cnt; | |||
|
353 | } | |||
|
354 | } | |||
|
355 | else{ | |||
|
356 | f.setAttribute('class','follow'); | |||
|
357 | f.setAttribute('title',_TM['Start following this repository']); | |||
|
358 | if(f_cnt){ | |||
|
359 | var cnt = Number(f_cnt.innerHTML)-1; | |||
|
360 | f_cnt.innerHTML = cnt; | |||
|
361 | } | |||
|
362 | } | |||
|
363 | } | |||
|
364 | ||||
|
365 | var toggleFollowingUser = function(target,fallows_user_id,token,user_id){ | |||
|
366 | args = 'follows_user_id='+fallows_user_id; | |||
|
367 | args+= '&auth_token='+token; | |||
|
368 | if(user_id != undefined){ | |||
|
369 | args+="&user_id="+user_id; | |||
|
370 | } | |||
|
371 | YUC.asyncRequest('POST',TOGGLE_FOLLOW_URL,{ | |||
|
372 | success:function(o){ | |||
|
373 | onSuccessFollow(target); | |||
|
374 | } | |||
|
375 | },args); | |||
|
376 | return false; | |||
|
377 | } | |||
|
378 | ||||
|
379 | var toggleFollowingRepo = function(target,fallows_repo_id,token,user_id){ | |||
|
380 | ||||
|
381 | args = 'follows_repo_id='+fallows_repo_id; | |||
|
382 | args+= '&auth_token='+token; | |||
|
383 | if(user_id != undefined){ | |||
|
384 | args+="&user_id="+user_id; | |||
|
385 | } | |||
|
386 | YUC.asyncRequest('POST',TOGGLE_FOLLOW_URL,{ | |||
|
387 | success:function(o){ | |||
|
388 | onSuccessFollow(target); | |||
|
389 | } | |||
|
390 | },args); | |||
|
391 | return false; | |||
|
392 | } | |||
|
393 | ||||
342 |
|
394 | |||
343 | /** |
|
395 | /** | |
344 | * TOOLTIP IMPL. |
|
396 | * TOOLTIP IMPL. |
@@ -53,6 +53,7 | |||||
53 | 'Selection link': "${_('Selection link')}", |
|
53 | 'Selection link': "${_('Selection link')}", | |
54 | }; |
|
54 | }; | |
55 | var _TM = TRANSLATION_MAP; |
|
55 | var _TM = TRANSLATION_MAP; | |
|
56 | var TOGGLE_FOLLOW_URL = "${h.url('toggle_following')}"; | |||
56 | </script> |
|
57 | </script> | |
57 | <script type="text/javascript" src="${h.url('/js/yui.2.9.js', ver=c.rhodecode_version)}"></script> |
|
58 | <script type="text/javascript" src="${h.url('/js/yui.2.9.js', ver=c.rhodecode_version)}"></script> | |
58 | <!--[if lt IE 9]> |
|
59 | <!--[if lt IE 9]> | |
@@ -63,10 +64,8 | |||||
63 | <script type="text/javascript" src="${h.url('/js/rhodecode.js', ver=c.rhodecode_version)}"></script> |
|
64 | <script type="text/javascript" src="${h.url('/js/rhodecode.js', ver=c.rhodecode_version)}"></script> | |
64 | ## EXTRA FOR JS |
|
65 | ## EXTRA FOR JS | |
65 | ${self.js_extra()} |
|
66 | ${self.js_extra()} | |
66 |
|
||||
67 | <script type="text/javascript"> |
|
67 | <script type="text/javascript"> | |
68 | (function(window,undefined){ |
|
68 | (function(window,undefined){ | |
69 |
|
||||
70 | // Prepare |
|
69 | // Prepare | |
71 | var History = window.History; // Note: We are using a capital H instead of a lower h |
|
70 | var History = window.History; // Note: We are using a capital H instead of a lower h | |
72 | if ( !History.enabled ) { |
|
71 | if ( !History.enabled ) { | |
@@ -75,68 +74,16 | |||||
75 | return false; |
|
74 | return false; | |
76 | } |
|
75 | } | |
77 | })(window); |
|
76 | })(window); | |
78 | var follow_base_url = "${h.url('toggle_following')}"; |
|
77 | ||
79 |
|
78 | YUE.onDOMReady(function(){ | ||
80 | var onSuccessFollow = function(target){ |
|
79 | tooltip_activate(); | |
81 | var f = YUD.get(target.id); |
|
80 | show_more_event(); | |
82 | var f_cnt = YUD.get('current_followers_count'); |
|
81 | show_changeset_tooltip(); | |
83 |
|
||||
84 | if(f.getAttribute('class')=='follow'){ |
|
|||
85 | f.setAttribute('class','following'); |
|
|||
86 | f.setAttribute('title',_TM['Stop following this repository']); |
|
|||
87 |
|
||||
88 | if(f_cnt){ |
|
|||
89 | var cnt = Number(f_cnt.innerHTML)+1; |
|
|||
90 | f_cnt.innerHTML = cnt; |
|
|||
91 | } |
|
|||
92 | } |
|
|||
93 | else{ |
|
|||
94 | f.setAttribute('class','follow'); |
|
|||
95 | f.setAttribute('title',_TM['Start following this repository']); |
|
|||
96 | if(f_cnt){ |
|
|||
97 | var cnt = Number(f_cnt.innerHTML)-1; |
|
|||
98 | f_cnt.innerHTML = cnt; |
|
|||
99 | } |
|
|||
100 | } |
|
|||
101 | } |
|
|||
102 |
|
82 | |||
103 | var toggleFollowingUser = function(target,fallows_user_id,token,user_id){ |
|
83 | YUE.on('quick_login_link','click',function(e){ | |
104 | args = 'follows_user_id='+fallows_user_id; |
|
|||
105 | args+= '&auth_token='+token; |
|
|||
106 | if(user_id != undefined){ |
|
|||
107 | args+="&user_id="+user_id; |
|
|||
108 | } |
|
|||
109 | YUC.asyncRequest('POST',follow_base_url,{ |
|
|||
110 | success:function(o){ |
|
|||
111 | onSuccessFollow(target); |
|
|||
112 | } |
|
|||
113 | },args); |
|
|||
114 | return false; |
|
|||
115 | } |
|
|||
116 |
|
||||
117 | var toggleFollowingRepo = function(target,fallows_repo_id,token,user_id){ |
|
|||
118 |
|
||||
119 | args = 'follows_repo_id='+fallows_repo_id; |
|
|||
120 | args+= '&auth_token='+token; |
|
|||
121 | if(user_id != undefined){ |
|
|||
122 | args+="&user_id="+user_id; |
|
|||
123 | } |
|
|||
124 | YUC.asyncRequest('POST',follow_base_url,{ |
|
|||
125 | success:function(o){ |
|
|||
126 | onSuccessFollow(target); |
|
|||
127 | } |
|
|||
128 | },args); |
|
|||
129 | return false; |
|
|||
130 | } |
|
|||
131 | YUE.onDOMReady(function(){ |
|
|||
132 | tooltip_activate(); |
|
|||
133 | show_more_event(); |
|
|||
134 | show_changeset_tooltip(); |
|
|||
135 |
|
||||
136 | YUE.on('quick_login_link','click',function(e){ |
|
|||
137 | // make sure we don't redirect |
|
84 | // make sure we don't redirect | |
138 | YUE.preventDefault(e); |
|
85 | YUE.preventDefault(e); | |
139 |
|
86 | |||
140 | if(YUD.hasClass('quick_login_link','enabled')){ |
|
87 | if(YUD.hasClass('quick_login_link','enabled')){ | |
141 | YUD.setStyle('quick_login','display','none'); |
|
88 | YUD.setStyle('quick_login','display','none'); | |
142 | YUD.removeClass('quick_login_link','enabled'); |
|
89 | YUD.removeClass('quick_login_link','enabled'); | |
@@ -149,7 +96,7 | |||||
149 | usr.focus(); |
|
96 | usr.focus(); | |
150 | } |
|
97 | } | |
151 | } |
|
98 | } | |
152 | }); |
|
99 | }); | |
153 | }) |
|
100 | }) | |
154 | </script> |
|
101 | </script> | |
155 | </%def> |
|
102 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now