##// END OF EJS Templates
Added dynamic followers counter change after toggle following action
marcink -
r1070:f52aab02 beta
parent child Browse files
Show More
@@ -1,392 +1,404
1 1 ## -*- coding: utf-8 -*-
2 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 3 <html xmlns="http://www.w3.org/1999/xhtml" id="mainhtml">
4 4 <head>
5 5 <title>${next.title()}</title>
6 6 <link rel="icon" href="${h.url('/images/icons/database_gear.png')}" type="image/png" />
7 7 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
8 8 <meta name="robots" content="index, nofollow"/>
9 9 <!-- stylesheets -->
10 10 ${self.css()}
11 11 <!-- scripts -->
12 12 ${self.js()}
13 13 %if c.ga_code:
14 14 <script type="text/javascript">
15 15
16 16 var _gaq = _gaq || [];
17 17 _gaq.push(['_setAccount', '${c.ga_code}']);
18 18 _gaq.push(['_trackPageview']);
19 19
20 20 (function() {
21 21 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
22 22 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
23 23 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
24 24 })();
25 25
26 26
27 27 </script>
28 28 %endif
29 29 </head>
30 30 <body>
31 31 <!-- header -->
32 32 <div id="header">
33 33 <!-- user -->
34 34 <ul id="logged-user">
35 35 <li class="first">
36 36 <div class="gravatar">
37 37 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,20)}" />
38 38 </div>
39 39 <div class="account">
40 40 %if c.rhodecode_user.username == 'default':
41 41 %if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
42 42 ${h.link_to('anonymous',h.url('register'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))}
43 43 %else:
44 44 ${h.link_to('anonymous',h.url('#'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))}
45 45 %endif
46 46
47 47 %else:
48 48 ${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'),title='%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname))}
49 49 %endif
50 50 </div>
51 51 </li>
52 52 <li>
53 53 <a href="${h.url('home')}">${_('Home')}</a>
54 54 </li>
55 55 %if c.rhodecode_user.username != 'default':
56 56 <li>
57 57 <a href="${h.url('journal')}">${_('Journal')}</a>
58 58 ##(${c.unread_journal})</a>
59 59 </li>
60 60 %endif
61 61 %if c.rhodecode_user.username == 'default':
62 62 <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li>
63 63 %else:
64 64 <li class="last highlight">${h.link_to(u'Log Out',h.url('logout_home'))}</li>
65 65 %endif
66 66 </ul>
67 67 <!-- end user -->
68 68 <div id="header-inner" class="title top-left-rounded-corner top-right-rounded-corner">
69 69 <!-- logo -->
70 70 <div id="logo">
71 71 <h1><a href="${h.url('home')}">${c.rhodecode_name}</a></h1>
72 72 </div>
73 73 <!-- end logo -->
74 74 <!-- menu -->
75 75 ${self.page_nav()}
76 76 <!-- quick -->
77 77 </div>
78 78 </div>
79 79 <!-- end header -->
80 80
81 81 <!-- CONTENT -->
82 82 <div id="content">
83 83 <div class="flash_msg">
84 84 <% messages = h.flash.pop_messages() %>
85 85 % if messages:
86 86 <ul id="flash-messages">
87 87 % for message in messages:
88 88 <li class="${message.category}_msg">${message}</li>
89 89 % endfor
90 90 </ul>
91 91 % endif
92 92 </div>
93 93 <div id="main">
94 94 ${next.main()}
95 95 </div>
96 96 </div>
97 97 <!-- END CONTENT -->
98 98
99 99 <!-- footer -->
100 100 <div id="footer">
101 101 <div id="footer-inner" class="title bottom-left-rounded-corner bottom-right-rounded-corner">
102 102 <div>
103 103 <p class="footer-link">${h.link_to(_('Submit a bug'),h.url('bugtracker'))}</p>
104 104 <p class="footer-link">${h.link_to(_('GPL license'),h.url('gpl_license'))}</p>
105 105 <p>RhodeCode ${c.rhodecode_version} &copy; 2010-2011 by Marcin Kuzminski</p>
106 106 </div>
107 107 </div>
108 108 <script type="text/javascript">
109 109 function tooltip_activate(){
110 110 ${h.tooltip.activate()}
111 111 }
112 112 tooltip_activate();
113 113 </script>
114 114 </div>
115 115 <!-- end footer -->
116 116 </body>
117 117
118 118 </html>
119 119
120 120 ### MAKO DEFS ###
121 121 <%def name="page_nav()">
122 122 ${self.menu()}
123 123 </%def>
124 124
125 125 <%def name="menu(current=None)">
126 126 <%
127 127 def is_current(selected):
128 128 if selected == current:
129 129 return h.literal('class="current"')
130 130 %>
131 131 %if current not in ['home','admin']:
132 132 ##REGULAR MENU
133 133 <ul id="quick">
134 134 <!-- repo switcher -->
135 135 <li>
136 136 <a id="repo_switcher" title="${_('Switch repository')}" href="#">
137 137 <span class="icon">
138 138 <img src="${h.url("/images/icons/database.png")}" alt="${_('Products')}" />
139 139 </span>
140 140 <span>&darr;</span>
141 141 </a>
142 142 <ul class="repo_switcher">
143 143 %for repo in c.cached_repo_list:
144 144
145 145 %if repo['dbrepo']['private']:
146 146 <li><img src="${h.url("/images/icons/lock.png")}" alt="${_('Private repository')}" class="repo_switcher_type"/>${h.link_to(repo['repo'].name,h.url('summary_home',repo_name=repo['repo'].name),class_="%s" % repo['dbrepo']['repo_type'])}</li>
147 147 %else:
148 148 <li><img src="${h.url("/images/icons/lock_open.png")}" alt="${_('Public repository')}" class="repo_switcher_type" />${h.link_to(repo['repo'].name,h.url('summary_home',repo_name=repo['repo'].name),class_="%s" % repo['dbrepo']['repo_type'])}</li>
149 149 %endif
150 150 %endfor
151 151 </ul>
152 152 </li>
153 153
154 154 <li ${is_current('summary')}>
155 155 <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=c.repo_name)}">
156 156 <span class="icon">
157 157 <img src="${h.url("/images/icons/clipboard_16.png")}" alt="${_('Summary')}" />
158 158 </span>
159 159 <span>${_('Summary')}</span>
160 160 </a>
161 161 </li>
162 162 ##<li ${is_current('shortlog')}>
163 163 ## <a title="${_('Shortlog')}" href="${h.url('shortlog_home',repo_name=c.repo_name)}">
164 164 ## <span class="icon">
165 165 ## <img src="${h.url("/images/icons/application_view_list.png")}" alt="${_('Shortlog')}" />
166 166 ## </span>
167 167 ## <span>${_('Shortlog')}</span>
168 168 ## </a>
169 169 ##</li>
170 170 <li ${is_current('changelog')}>
171 171 <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=c.repo_name)}">
172 172 <span class="icon">
173 173 <img src="${h.url("/images/icons/time.png")}" alt="${_('Changelog')}" />
174 174 </span>
175 175 <span>${_('Changelog')}</span>
176 176 </a>
177 177 </li>
178 178
179 179 <li ${is_current('switch_to')}>
180 180 <a title="${_('Switch to')}" href="#">
181 181 <span class="icon">
182 182 <img src="${h.url("/images/icons/arrow_switch.png")}" alt="${_('Switch to')}" />
183 183 </span>
184 184 <span>${_('Switch to')}</span>
185 185 </a>
186 186 <ul>
187 187 <li>
188 188 ${h.link_to('%s (%s)' % (_('branches'),len(c.rhodecode_repo.branches.values()),),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')}
189 189 <ul>
190 190 %if c.rhodecode_repo.branches.values():
191 191 %for cnt,branch in enumerate(c.rhodecode_repo.branches.items()):
192 192 <li>${h.link_to('%s - %s' % (branch[0],h.short_id(branch[1])),h.url('files_home',repo_name=c.repo_name,revision=branch[1]))}</li>
193 193 %endfor
194 194 %else:
195 195 <li>${h.link_to(_('There are no branches yet'),'#')}</li>
196 196 %endif
197 197 </ul>
198 198 </li>
199 199 <li>
200 200 ${h.link_to('%s (%s)' % (_('tags'),len(c.rhodecode_repo.tags.values()),),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')}
201 201 <ul>
202 202 %if c.rhodecode_repo.tags.values():
203 203 %for cnt,tag in enumerate(c.rhodecode_repo.tags.items()):
204 204 <li>${h.link_to('%s - %s' % (tag[0],h.short_id(tag[1])),h.url('files_home',repo_name=c.repo_name,revision=tag[1]))}</li>
205 205 %endfor
206 206 %else:
207 207 <li>${h.link_to(_('There are no tags yet'),'#')}</li>
208 208 %endif
209 209 </ul>
210 210 </li>
211 211 </ul>
212 212 </li>
213 213 <li ${is_current('files')}>
214 214 <a title="${_('Files')}" href="${h.url('files_home',repo_name=c.repo_name)}">
215 215 <span class="icon">
216 216 <img src="${h.url("/images/icons/file.png")}" alt="${_('Files')}" />
217 217 </span>
218 218 <span>${_('Files')}</span>
219 219 </a>
220 220 </li>
221 221
222 222 <li ${is_current('options')}>
223 223 <a title="${_('Options')}" href="#">
224 224 <span class="icon">
225 225 <img src="${h.url("/images/icons/table_gear.png")}" alt="${_('Admin')}" />
226 226 </span>
227 227 <span>${_('Options')}</span>
228 228 </a>
229 229 <ul>
230 230 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
231 231 %if h.HasPermissionAll('hg.admin')('access settings on repository'):
232 232 <li>${h.link_to(_('settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')}</li>
233 233 %else:
234 234 <li>${h.link_to(_('settings'),h.url('repo_settings_home',repo_name=c.repo_name),class_='settings')}</li>
235 235 %endif
236 236 %endif
237 237 <li>${h.link_to(_('fork'),h.url('repo_fork_home',repo_name=c.repo_name),class_='fork')}</li>
238 238 <li>${h.link_to(_('search'),h.url('search_repo',search_repo=c.repo_name),class_='search')}</li>
239 239
240 240 %if h.HasPermissionAll('hg.admin')('access admin main page'):
241 241 <li>
242 242 ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}
243 243 <%def name="admin_menu()">
244 244 <ul>
245 245 <li>${h.link_to(_('journal'),h.url('admin_home'),class_='journal')}</li>
246 246 <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
247 247 <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
248 248 <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li>
249 249 <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
250 250 <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li>
251 251 <li class="last">${h.link_to(_('settings'),h.url('admin_settings'),class_='settings')}</li>
252 252 </ul>
253 253 </%def>
254 254
255 255 ${admin_menu()}
256 256 </li>
257 257 %endif
258 258
259 259 </ul>
260 260 </li>
261 261
262 262 <li>
263 263 <a title="${_('Followers')}" href="#">
264 264 <span class="icon_short">
265 265 <img src="${h.url("/images/icons/heart.png")}" alt="${_('Followers')}" />
266 266 </span>
267 <span class="short">${c.repository_followers}</span>
267 <span id="current_followers_count" class="short">${c.repository_followers}</span>
268 268 </a>
269 269 </li>
270 270 <li>
271 271 <a title="${_('Forks')}" href="#">
272 272 <span class="icon_short">
273 273 <img src="${h.url("/images/icons/arrow_divide.png")}" alt="${_('Forks')}" />
274 274 </span>
275 275 <span class="short">${c.repository_forks}</span>
276 276 </a>
277 277 </li>
278 278
279 279
280 280
281 281 </ul>
282 282 %else:
283 283 ##ROOT MENU
284 284 <ul id="quick">
285 285 <li>
286 286 <a title="${_('Home')}" href="${h.url('home')}">
287 287 <span class="icon">
288 288 <img src="${h.url("/images/icons/home_16.png")}" alt="${_('Home')}" />
289 289 </span>
290 290 <span>${_('Home')}</span>
291 291 </a>
292 292 </li>
293 293 %if c.rhodecode_user.username != 'default':
294 294 <li>
295 295 <a title="${_('Journal')}" href="${h.url('journal')}">
296 296 <span class="icon">
297 297 <img src="${h.url("/images/icons/book.png")}" alt="${_('Journal')}" />
298 298 </span>
299 299 <span>${_('Journal')}</span>
300 300 </a>
301 301 </li>
302 302 %endif
303 303 <li>
304 304 <a title="${_('Search')}" href="${h.url('search')}">
305 305 <span class="icon">
306 306 <img src="${h.url("/images/icons/search_16.png")}" alt="${_('Search')}" />
307 307 </span>
308 308 <span>${_('Search')}</span>
309 309 </a>
310 310 </li>
311 311
312 312 %if h.HasPermissionAll('hg.admin')('access admin main page'):
313 313 <li ${is_current('admin')}>
314 314 <a title="${_('Admin')}" href="${h.url('admin_home')}">
315 315 <span class="icon">
316 316 <img src="${h.url("/images/icons/cog_edit.png")}" alt="${_('Admin')}" />
317 317 </span>
318 318 <span>${_('Admin')}</span>
319 319 </a>
320 320 ${admin_menu()}
321 321 </li>
322 322 %endif
323 323 </ul>
324 324 %endif
325 325 </%def>
326 326
327 327
328 328 <%def name="css()">
329 329 <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css')}" media="screen" />
330 330 <link rel="stylesheet" type="text/css" href="${h.url('/css/pygments.css')}" />
331 331 <link rel="stylesheet" type="text/css" href="${h.url('/css/diff.css')}" />
332 332 </%def>
333 333
334 334 <%def name="js()">
335 335 ##<script type="text/javascript" src="${h.url('/js/yui/utilities/utilities.js')}"></script>
336 336 ##<script type="text/javascript" src="${h.url('/js/yui/container/container.js')}"></script>
337 337 ##<script type="text/javascript" src="${h.url('/js/yui/datasource/datasource.js')}"></script>
338 338 ##<script type="text/javascript" src="${h.url('/js/yui/autocomplete/autocomplete.js')}"></script>
339 339 ##<script type="text/javascript" src="${h.url('/js/yui/selector/selector-min.js')}"></script>
340 340
341 341 <script type="text/javascript" src="${h.url('/js/yui2a.js')}"></script>
342 342 <!--[if IE]><script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script><![endif]-->
343 343 <script type="text/javascript" src="${h.url('/js/yui.flot.js')}"></script>
344 344
345 345 <script type="text/javascript">
346 346 var base_url = "${h.url('toggle_following')}";
347 347 var YUC = YAHOO.util.Connect;
348 348 var YUD = YAHOO.util.Dom;
349 349 var YUE = YAHOO.util.Event;
350 350
351 351 function onSuccess(target){
352 352
353 353 var f = YUD.get(target.id);
354 var f_cnt = YUD.get('current_followers_count');
355
354 356 if(f.getAttribute('class')=='follow'){
355 357 f.setAttribute('class','following');
356 358 f.setAttribute('title',"${_('Stop following this repository')}");
359
360 if(f_cnt){
361 var cnt = Number(f_cnt.innerHTML)+1;
362 f_cnt.innerHTML = cnt;
363 }
364
357 365 }
358 366 else{
359 367 f.setAttribute('class','follow');
360 368 f.setAttribute('title',"${_('Start following this repository')}");
369 if(f_cnt){
370 var cnt = Number(f_cnt.innerHTML)+1;
371 f_cnt.innerHTML = cnt;
372 }
361 373 }
362 374 }
363 375
364 376 function toggleFollowingUser(fallows_user_id,token){
365 377 args = 'follows_user_id='+fallows_user_id;
366 378 args+= '&amp;auth_token='+token;
367 379 YUC.asyncRequest('POST',base_url,{
368 380 success:function(o){
369 381 onSuccess();
370 382 }
371 383 },args); return false;
372 384 }
373 385
374 386 function toggleFollowingRepo(target,fallows_repo_id,token){
375 387
376 388 args = 'follows_repo_id='+fallows_repo_id;
377 389 args+= '&amp;auth_token='+token;
378 390 YUC.asyncRequest('POST',base_url,{
379 391 success:function(o){
380 392 onSuccess(target);
381 393 }
382 394 },args); return false;
383 395 }
384 396 </script>
385 397
386 398 </%def>
387 399
388 400 <%def name="breadcrumbs()">
389 401 <div class="breadcrumbs">
390 402 ${self.breadcrumbs_links()}
391 403 </div>
392 404 </%def> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now