##// END OF EJS Templates
menu: expose artifacts count into menu
marcink -
r3984:9bf54585 default
parent child Browse files
Show More
@@ -225,6 +225,7 b' class RepoAppView(BaseAppView):'
225 225 self.db_repo = request.db_repo
226 226 self.db_repo_name = self.db_repo.repo_name
227 227 self.db_repo_pull_requests = ScmModel().get_pull_requests(self.db_repo)
228 self.db_repo_artifacts = ScmModel().get_artifacts(self.db_repo)
228 229
229 230 def _handle_missing_requirements(self, error):
230 231 log.error(
@@ -240,6 +241,7 b' class RepoAppView(BaseAppView):'
240 241 c.rhodecode_db_repo = self.db_repo
241 242 c.repo_name = self.db_repo_name
242 243 c.repository_pull_requests = self.db_repo_pull_requests
244 c.repository_artifacts = self.db_repo_artifacts
243 245 c.repository_is_user_following = ScmModel().is_following_repo(
244 246 self.db_repo_name, self._rhodecode_user.user_id)
245 247 self.path_filter = PathFilter(None)
@@ -402,6 +402,7 b' class RepoIntegrationsView(IntegrationSe'
402 402 c.rhodecode_db_repo = self.repo
403 403 c.repo_name = self.db_repo.repo_name
404 404 c.repository_pull_requests = ScmModel().get_pull_requests(self.repo)
405 c.repository_artifacts = ScmModel().get_artifacts(self.repo)
405 406 c.repository_is_user_following = ScmModel().is_following_repo(
406 407 c.repo_name, self._rhodecode_user.user_id)
407 408 c.has_origin_repo_read_perm = False
@@ -47,8 +47,9 b' from rhodecode.lib.utils2 import (safe_s'
47 47 from rhodecode.lib.system_info import get_system_info
48 48 from rhodecode.model import BaseModel
49 49 from rhodecode.model.db import (
50 or_, false,
50 51 Repository, CacheKey, UserFollowing, UserLog, User, RepoGroup,
51 PullRequest)
52 PullRequest, FileStore)
52 53 from rhodecode.model.settings import VcsSettingsModel
53 54 from rhodecode.model.validation_schema.validators import url_validator, InvalidCloneUrl
54 55
@@ -364,6 +365,12 b' class ScmModel(BaseModel):'
364 365 .filter(PullRequest.target_repo == repo)\
365 366 .filter(PullRequest.status != PullRequest.STATUS_CLOSED).count()
366 367
368 def get_artifacts(self, repo):
369 repo = self._get_repo(repo)
370 return self.sa.query(FileStore)\
371 .filter(FileStore.repo == repo)\
372 .filter(or_(FileStore.hidden == None, FileStore.hidden == false())).count()
373
367 374 def mark_as_fork(self, repo, fork, user):
368 375 repo = self._get_repo(repo)
369 376 fork = self._get_repo(fork)
@@ -128,6 +128,16 b''
128 128 // for this specifically we do not use a variable
129 129 }
130 130
131 .menulink-counter {
132 border: 1px solid @grey2;
133 border-radius: @border-radius;
134 background: @grey7;
135 display: inline-block;
136 padding: 0px 4px;
137 text-align: center;
138 font-size: 12px;
139 }
140
131 141 .pr_notifications {
132 142 padding-left: .5em;
133 143 }
@@ -301,17 +301,19 b''
301 301 <li class="${is_active('showpullrequest')}">
302 302 <a class="menulink" href="${h.route_path('pullrequest_show_all', repo_name=c.repo_name)}" title="${h.tooltip(_('Show Pull Requests for %s') % c.repo_name)}">
303 303 <div class="menulabel">
304 %if c.repository_pull_requests == 1:
305 ${_('Pull Request')} ${c.repository_pull_requests}
306 %else:
307 ${_('Pull Requests')} ${c.repository_pull_requests}
308 %endif
304 ${_('Pull Requests')} <span class="menulink-counter">${c.repository_pull_requests}</span>
309 305 </div>
310 306 </a>
311 307 </li>
312 308 %endif
313 309
314 <li class="${is_active('artifacts')}"><a class="menulink" href="${h.route_path('repo_artifacts_list',repo_name=c.repo_name)}"><div class="menulabel">${_('Artifacts')}</div></a></li>
310 <li class="${is_active('artifacts')}">
311 <a class="menulink" href="${h.route_path('repo_artifacts_list',repo_name=c.repo_name)}">
312 <div class="menulabel">
313 ${_('Artifacts')} <span class="menulink-counter">${c.repository_artifacts}</span>
314 </div>
315 </a>
316 </li>
315 317
316 318 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
317 319 <li class="${is_active('settings')}"><a class="menulink" href="${h.route_path('edit_repo',repo_name=c.repo_name)}"><div class="menulabel">${_('Repository Settings')}</div></a></li>
General Comments 0
You need to be logged in to leave comments. Login now