Show More
@@ -225,6 +225,7 b' class RepoAppView(BaseAppView):' | |||||
225 | self.db_repo = request.db_repo |
|
225 | self.db_repo = request.db_repo | |
226 | self.db_repo_name = self.db_repo.repo_name |
|
226 | self.db_repo_name = self.db_repo.repo_name | |
227 | self.db_repo_pull_requests = ScmModel().get_pull_requests(self.db_repo) |
|
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 | def _handle_missing_requirements(self, error): |
|
230 | def _handle_missing_requirements(self, error): | |
230 | log.error( |
|
231 | log.error( | |
@@ -240,6 +241,7 b' class RepoAppView(BaseAppView):' | |||||
240 | c.rhodecode_db_repo = self.db_repo |
|
241 | c.rhodecode_db_repo = self.db_repo | |
241 | c.repo_name = self.db_repo_name |
|
242 | c.repo_name = self.db_repo_name | |
242 | c.repository_pull_requests = self.db_repo_pull_requests |
|
243 | c.repository_pull_requests = self.db_repo_pull_requests | |
|
244 | c.repository_artifacts = self.db_repo_artifacts | |||
243 | c.repository_is_user_following = ScmModel().is_following_repo( |
|
245 | c.repository_is_user_following = ScmModel().is_following_repo( | |
244 | self.db_repo_name, self._rhodecode_user.user_id) |
|
246 | self.db_repo_name, self._rhodecode_user.user_id) | |
245 | self.path_filter = PathFilter(None) |
|
247 | self.path_filter = PathFilter(None) |
@@ -402,6 +402,7 b' class RepoIntegrationsView(IntegrationSe' | |||||
402 | c.rhodecode_db_repo = self.repo |
|
402 | c.rhodecode_db_repo = self.repo | |
403 | c.repo_name = self.db_repo.repo_name |
|
403 | c.repo_name = self.db_repo.repo_name | |
404 | c.repository_pull_requests = ScmModel().get_pull_requests(self.repo) |
|
404 | c.repository_pull_requests = ScmModel().get_pull_requests(self.repo) | |
|
405 | c.repository_artifacts = ScmModel().get_artifacts(self.repo) | |||
405 | c.repository_is_user_following = ScmModel().is_following_repo( |
|
406 | c.repository_is_user_following = ScmModel().is_following_repo( | |
406 | c.repo_name, self._rhodecode_user.user_id) |
|
407 | c.repo_name, self._rhodecode_user.user_id) | |
407 | c.has_origin_repo_read_perm = False |
|
408 | c.has_origin_repo_read_perm = False |
@@ -47,8 +47,9 b' from rhodecode.lib.utils2 import (safe_s' | |||||
47 | from rhodecode.lib.system_info import get_system_info |
|
47 | from rhodecode.lib.system_info import get_system_info | |
48 | from rhodecode.model import BaseModel |
|
48 | from rhodecode.model import BaseModel | |
49 | from rhodecode.model.db import ( |
|
49 | from rhodecode.model.db import ( | |
|
50 | or_, false, | |||
50 | Repository, CacheKey, UserFollowing, UserLog, User, RepoGroup, |
|
51 | Repository, CacheKey, UserFollowing, UserLog, User, RepoGroup, | |
51 | PullRequest) |
|
52 | PullRequest, FileStore) | |
52 | from rhodecode.model.settings import VcsSettingsModel |
|
53 | from rhodecode.model.settings import VcsSettingsModel | |
53 | from rhodecode.model.validation_schema.validators import url_validator, InvalidCloneUrl |
|
54 | from rhodecode.model.validation_schema.validators import url_validator, InvalidCloneUrl | |
54 |
|
55 | |||
@@ -364,6 +365,12 b' class ScmModel(BaseModel):' | |||||
364 | .filter(PullRequest.target_repo == repo)\ |
|
365 | .filter(PullRequest.target_repo == repo)\ | |
365 | .filter(PullRequest.status != PullRequest.STATUS_CLOSED).count() |
|
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 | def mark_as_fork(self, repo, fork, user): |
|
374 | def mark_as_fork(self, repo, fork, user): | |
368 | repo = self._get_repo(repo) |
|
375 | repo = self._get_repo(repo) | |
369 | fork = self._get_repo(fork) |
|
376 | fork = self._get_repo(fork) |
@@ -128,6 +128,16 b'' | |||||
128 | // for this specifically we do not use a variable |
|
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 | .pr_notifications { |
|
141 | .pr_notifications { | |
132 | padding-left: .5em; |
|
142 | padding-left: .5em; | |
133 | } |
|
143 | } |
@@ -301,17 +301,19 b'' | |||||
301 | <li class="${is_active('showpullrequest')}"> |
|
301 | <li class="${is_active('showpullrequest')}"> | |
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)}"> |
|
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 | <div class="menulabel"> |
|
303 | <div class="menulabel"> | |
304 | %if c.repository_pull_requests == 1: |
|
304 | ${_('Pull Requests')} <span class="menulink-counter">${c.repository_pull_requests}</span> | |
305 | ${_('Pull Request')} ${c.repository_pull_requests} |
|
|||
306 | %else: |
|
|||
307 | ${_('Pull Requests')} ${c.repository_pull_requests} |
|
|||
308 | %endif |
|
|||
309 | </div> |
|
305 | </div> | |
310 | </a> |
|
306 | </a> | |
311 | </li> |
|
307 | </li> | |
312 | %endif |
|
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 | %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): |
|
318 | %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): | |
317 | <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> |
|
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