Show More
@@ -26,7 +26,6 b' from pyramid.httpexceptions import HTTPF' | |||
|
26 | 26 | from rhodecode.lib import helpers as h |
|
27 | 27 | from rhodecode.lib.utils2 import StrictAttributeDict, safe_int, datetime_to_time |
|
28 | 28 | from rhodecode.lib.vcs.exceptions import RepositoryRequirementError |
|
29 | from rhodecode.lib.ext_json import json | |
|
30 | 29 | from rhodecode.model import repo |
|
31 | 30 | from rhodecode.model import repo_group |
|
32 | 31 | from rhodecode.model.db import User |
@@ -218,28 +217,35 b' class BaseReferencesView(RepoAppView):' | |||
|
218 | 217 | return c |
|
219 | 218 | |
|
220 | 219 | def load_refs_context(self, ref_items, partials_template): |
|
221 | _data = [] | |
|
222 | 220 | _render = self.request.get_partial_renderer(partials_template) |
|
223 | 221 | pre_load = ["author", "date", "message"] |
|
224 | 222 | |
|
225 | 223 | is_svn = h.is_svn(self.rhodecode_vcs_repo) |
|
224 | is_hg = h.is_hg(self.rhodecode_vcs_repo) | |
|
225 | ||
|
226 | 226 | format_ref_id = get_format_ref_id(self.rhodecode_vcs_repo) |
|
227 | 227 | |
|
228 | closed_refs = {} | |
|
229 | if is_hg: | |
|
230 | closed_refs = self.rhodecode_vcs_repo.branches_closed | |
|
231 | ||
|
232 | data = [] | |
|
228 | 233 | for ref_name, commit_id in ref_items: |
|
229 | 234 | commit = self.rhodecode_vcs_repo.get_commit( |
|
230 | 235 | commit_id=commit_id, pre_load=pre_load) |
|
236 | closed = ref_name in closed_refs | |
|
231 | 237 | |
|
232 | 238 | # TODO: johbo: Unify generation of reference links |
|
233 | 239 | use_commit_id = '/' in ref_name or is_svn |
|
234 | 240 | files_url = h.url( |
|
235 | 241 | 'files_home', |
|
236 |
repo_name= |
|
|
242 | repo_name=self.db_repo_name, | |
|
237 | 243 | f_path=ref_name if is_svn else '', |
|
238 | 244 | revision=commit_id if use_commit_id else ref_name, |
|
239 | 245 | at=ref_name) |
|
240 | 246 | |
|
241 |
|
|
|
242 | "name": _render('name', ref_name, files_url), | |
|
247 | data.append({ | |
|
248 | "name": _render('name', ref_name, files_url, closed), | |
|
243 | 249 | "name_raw": ref_name, |
|
244 | 250 | "date": _render('date', commit.date), |
|
245 | 251 | "date_raw": datetime_to_time(commit.date), |
@@ -250,8 +256,8 b' class BaseReferencesView(RepoAppView):' | |||
|
250 | 256 | "compare": _render( |
|
251 | 257 | 'compare', format_ref_id(ref_name, commit.raw_id)), |
|
252 | 258 | }) |
|
253 | c.has_references = bool(_data) | |
|
254 | c.data = json.dumps(_data) | |
|
259 | ||
|
260 | return data | |
|
255 | 261 | |
|
256 | 262 | |
|
257 | 263 | class RepoRoutePredicate(object): |
@@ -23,8 +23,10 b' from pyramid.httpexceptions import HTTPN' | |||
|
23 | 23 | from pyramid.view import view_config |
|
24 | 24 | |
|
25 | 25 | from rhodecode.apps._base import BaseReferencesView |
|
26 | from rhodecode.lib.ext_json import json | |
|
27 | from rhodecode.lib import helpers as h | |
|
26 | 28 | from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator) |
|
27 | from rhodecode.lib import helpers as h | |
|
29 | ||
|
28 | 30 | |
|
29 | 31 | log = logging.getLogger(__name__) |
|
30 | 32 | |
@@ -44,7 +46,9 b' class RepoBookmarksView(BaseReferencesVi' | |||
|
44 | 46 | raise HTTPNotFound() |
|
45 | 47 | |
|
46 | 48 | ref_items = self.rhodecode_vcs_repo.bookmarks.items() |
|
47 | self.load_refs_context( | |
|
49 | data = self.load_refs_context( | |
|
48 | 50 | ref_items=ref_items, partials_template='bookmarks/bookmarks_data.mako') |
|
49 | 51 | |
|
52 | c.has_references = bool(data) | |
|
53 | c.data = json.dumps(data) | |
|
50 | 54 | return self._get_template_context(c) |
@@ -22,6 +22,7 b' import logging' | |||
|
22 | 22 | from pyramid.view import view_config |
|
23 | 23 | |
|
24 | 24 | from rhodecode.apps._base import BaseReferencesView |
|
25 | from rhodecode.lib.ext_json import json | |
|
25 | 26 | from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator) |
|
26 | 27 | |
|
27 | 28 | |
@@ -38,14 +39,11 b' class RepoBranchesView(BaseReferencesVie' | |||
|
38 | 39 | renderer='rhodecode:templates/branches/branches.mako') |
|
39 | 40 | def branches(self): |
|
40 | 41 | c = self.load_default_context() |
|
41 | c.closed_branches = self.rhodecode_vcs_repo.branches_closed | |
|
42 | # NOTE(marcink): | |
|
43 | # we need this trick because of PartialRenderer still uses the | |
|
44 | # global 'c', we might not need this after full pylons migration | |
|
45 | self._register_global_c(c) | |
|
46 | 42 | |
|
47 | 43 | ref_items = self.rhodecode_vcs_repo.branches_all.items() |
|
48 | self.load_refs_context( | |
|
44 | data = self.load_refs_context( | |
|
49 | 45 | ref_items=ref_items, partials_template='branches/branches_data.mako') |
|
50 | 46 | |
|
47 | c.has_references = bool(data) | |
|
48 | c.data = json.dumps(data) | |
|
51 | 49 | return self._get_template_context(c) |
@@ -22,6 +22,7 b' import logging' | |||
|
22 | 22 | from pyramid.view import view_config |
|
23 | 23 | |
|
24 | 24 | from rhodecode.apps._base import BaseReferencesView |
|
25 | from rhodecode.lib.ext_json import json | |
|
25 | 26 | from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator) |
|
26 | 27 | |
|
27 | 28 | log = logging.getLogger(__name__) |
@@ -39,7 +40,9 b' class RepoTagsView(BaseReferencesView):' | |||
|
39 | 40 | c = self.load_default_context() |
|
40 | 41 | |
|
41 | 42 | ref_items = self.rhodecode_vcs_repo.tags.items() |
|
42 | self.load_refs_context( | |
|
43 | data = self.load_refs_context( | |
|
43 | 44 | ref_items=ref_items, partials_template='tags/tags_data.mako') |
|
44 | 45 | |
|
46 | c.has_references = bool(data) | |
|
47 | c.data = json.dumps(data) | |
|
45 | 48 | return self._get_template_context(c) |
@@ -9,7 +9,7 b'' | |||
|
9 | 9 | </%def> |
|
10 | 10 | |
|
11 | 11 | |
|
12 | <%def name="name(name, files_url)"> | |
|
12 | <%def name="name(name, files_url, closed)"> | |
|
13 | 13 | <span class="tag booktag" title="${h.tooltip(_('Bookmark %s') % (name,))}"> |
|
14 | 14 | <a href="${files_url}"> |
|
15 | 15 | <i class="icon-bookmark"></i> |
@@ -8,10 +8,10 b'' | |||
|
8 | 8 | <input class="compare-radio-button" type="radio" name="compare_target" value="${commit_id}"/> |
|
9 | 9 | </%def> |
|
10 | 10 | |
|
11 | <%def name="name(name, files_url)"> | |
|
11 | <%def name="name(name, files_url, closed)"> | |
|
12 | 12 | <span class="tag branchtag" title="${h.tooltip(_('Branch %s') % (name,))}"> |
|
13 | 13 | <a href="${files_url}"><i class="icon-code-fork"></i>${name} |
|
14 |
%if |
|
|
14 | %if closed: | |
|
15 | 15 | [closed] |
|
16 | 16 | %endif |
|
17 | 17 | </a> |
@@ -8,7 +8,7 b'' | |||
|
8 | 8 | <input class="compare-radio-button" type="radio" name="compare_target" value="${commit_id}"/> |
|
9 | 9 | </%def> |
|
10 | 10 | |
|
11 | <%def name="name(name, files_url)"> | |
|
11 | <%def name="name(name, files_url, closed)"> | |
|
12 | 12 | <span class="tagtag tag" title="${h.tooltip(_('Tag %s') % (name,))}"> |
|
13 | 13 | <a href="${files_url}"><i class="icon-tag"></i>${name}</a> |
|
14 | 14 | </span> |
General Comments 0
You need to be logged in to leave comments.
Login now