##// END OF EJS Templates
Added icons with numbers of followers and number of forks
marcink -
r747:2f89beda beta
parent child Browse files
Show More
@@ -22,14 +22,19 b' class BaseController(WSGIController):'
22 c.backends = BACKENDS.keys()
22 c.backends = BACKENDS.keys()
23
23
24 if c.repo_name:
24 if c.repo_name:
25 cached_repo = ScmModel().get(c.repo_name)
25 scm_model = ScmModel()
26 cached_repo = scm_model.get(c.repo_name)
26
27
27 if cached_repo:
28 if cached_repo:
28 c.repository_tags = cached_repo.tags
29 c.repository_tags = cached_repo.tags
29 c.repository_branches = cached_repo.branches
30 c.repository_branches = cached_repo.branches
31 c.repository_followers = scm_model.get_followers(cached_repo.dbrepo.repo_id)
32 c.repository_forks = scm_model.get_forks(cached_repo.dbrepo.repo_id)
30 else:
33 else:
31 c.repository_tags = {}
34 c.repository_tags = {}
32 c.repository_branches = {}
35 c.repository_branches = {}
36 c.repository_followers = 0
37 c.repository_forks = 0
33
38
34 self.sa = meta.Session()
39 self.sa = meta.Session()
35
40
@@ -310,6 +310,13 b' class ScmModel(object):'
310
310
311 return f is not None
311 return f is not None
312
312
313 def get_followers(self, repo_id):
314 return self.sa.query(UserFollowing)\
315 .filter(UserFollowing.follows_repo_id == repo_id).count()
316
317 def get_forks(self, repo_id):
318 return self.sa.query(Repository)\
319 .filter(Repository.fork_id == repo_id).count()
313
320
314 def _should_invalidate(self, repo_name):
321 def _should_invalidate(self, repo_name):
315 """
322 """
@@ -302,6 +302,10 b' background:#369 url("../../images/quick_'
302 padding:0;
302 padding:0;
303 }
303 }
304
304
305 #header #header-inner #quick li span.short {
306 padding:9px 6px 8px 6px;
307 }
308
305 #header #header-inner #quick li span {
309 #header #header-inner #quick li span {
306 top:0;
310 top:0;
307 right:0;
311 right:0;
@@ -328,6 +332,15 b' border-right:1px solid #2e5c89;'
328 padding:8px 8px 4px;
332 padding:8px 8px 4px;
329 }
333 }
330
334
335 #header #header-inner #quick li span.icon_short {
336 top:0;
337 left:0;
338 border-left:none;
339 background:url("../../images/quick_l.png") no-repeat top left;
340 border-right:1px solid #2e5c89;
341 padding:9px 4px 4px;
342 }
343
331 #header #header-inner #quick li a:hover {
344 #header #header-inner #quick li a:hover {
332 background:#4e4e4e url("../../images/quick_l_selected.png") no-repeat top left;
345 background:#4e4e4e url("../../images/quick_l_selected.png") no-repeat top left;
333 }
346 }
@@ -337,12 +350,13 b' border-left:1px solid #545454;'
337 background:url("../../images/quick_r_selected.png") no-repeat top right;
350 background:url("../../images/quick_r_selected.png") no-repeat top right;
338 }
351 }
339
352
340 #header #header-inner #quick li a:hover span.icon {
353 #header #header-inner #quick li a:hover span.icon,#header #header-inner #quick li a:hover span.icon_short {
341 border-left:none;
354 border-left:none;
342 border-right:1px solid #464646;
355 border-right:1px solid #464646;
343 background:url("../../images/quick_l_selected.png") no-repeat top left;
356 background:url("../../images/quick_l_selected.png") no-repeat top left;
344 }
357 }
345
358
359
346 #header #header-inner #quick ul {
360 #header #header-inner #quick ul {
347 top:29px;
361 top:29px;
348 right:0;
362 right:0;
@@ -214,17 +214,28 b''
214 </li>
214 </li>
215 %endif
215 %endif
216
216
217
218 ## %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
219 ## <li class="last">
220 ## ${h.link_to(_('delete'),'#',class_='delete')}
221 ## ${h.form(url('repo_settings_delete', repo_name=c.repo_name),method='delete')}
222 ## ${h.submit('remove_%s' % c.repo_name,'delete',class_="delete_icon action_button",onclick="return confirm('Confirm to delete this repository');")}
223 ## ${h.end_form()}
224 ## </li>
225 ## %endif
226 </ul>
217 </ul>
227 </li>
218 </li>
219
220 <li>
221 <a title="${_('Followers')}" href="#">
222 <span class="icon_short">
223 <img src="/images/icons/heart.png" alt="${_('Followers')}" />
224 </span>
225 <span class="short">${c.repository_followers}</span>
226 </a>
227 </li>
228 <li>
229 <a title="${_('Forks')}" href="#">
230 <span class="icon_short">
231 <img src="/images/icons/arrow_divide.png" alt="${_('Forks')}" />
232 </span>
233 <span class="short">${c.repository_forks}</span>
234 </a>
235 </li>
236
237
238
228 </ul>
239 </ul>
229 %else:
240 %else:
230 ##ROOT MENU
241 ##ROOT MENU
General Comments 0
You need to be logged in to leave comments. Login now