##// END OF EJS Templates
landing-refs: create helpers for landing ref to make clear indication about type/name
marcink -
r4370:ef6d7bca stable
parent child Browse files
Show More
@@ -178,7 +178,7 b' class TestFilesViews(object):'
178 commit_id='tip', f_path='/'))
178 commit_id='tip', f_path='/'))
179
179
180 # make sure Files menu url is not tip but new commit
180 # make sure Files menu url is not tip but new commit
181 landing_rev = backend.repo.landing_rev[1]
181 landing_rev = backend.repo.landing_ref_name
182 files_url = route_path('repo_files:default_path',
182 files_url = route_path('repo_files:default_path',
183 repo_name=backend.repo_name,
183 repo_name=backend.repo_name,
184 commit_id=landing_rev)
184 commit_id=landing_rev)
@@ -137,7 +137,7 b' class RepoFilesView(RepoAppView):'
137 raise HTTPFound(files_url)
137 raise HTTPFound(files_url)
138
138
139 def _get_commit_and_path(self):
139 def _get_commit_and_path(self):
140 default_commit_id = self.db_repo.landing_rev[1]
140 default_commit_id = self.db_repo.landing_ref_name
141 default_f_path = '/'
141 default_f_path = '/'
142
142
143 commit_id = self.request.matchdict.get(
143 commit_id = self.request.matchdict.get(
@@ -138,10 +138,10 b' class RepoForksView(RepoAppView, DataGri'
138 url_link = h.route_path(
138 url_link = h.route_path(
139 'repo_compare',
139 'repo_compare',
140 repo_name=fork.repo_name,
140 repo_name=fork.repo_name,
141 source_ref_type=self.db_repo.landing_rev[0],
141 source_ref_type=self.db_repo.landing_ref_type,
142 source_ref=self.db_repo.landing_rev[1],
142 source_ref=self.db_repo.landing_ref_name,
143 target_ref_type=self.db_repo.landing_rev[0],
143 target_ref_type=self.db_repo.landing_ref_type,
144 target_ref=self.db_repo.landing_rev[1],
144 target_ref=self.db_repo.landing_ref_name,
145 _query=dict(merge=1, target_repo=f.repo_name))
145 _query=dict(merge=1, target_repo=f.repo_name))
146 return h.link_to(_('Compare fork'), url_link, class_='btn-link')
146 return h.link_to(_('Compare fork'), url_link, class_='btn-link')
147
147
@@ -1758,7 +1758,7 b' class Repository(Base, BaseModel):'
1758
1758
1759 @hybrid_property
1759 @hybrid_property
1760 def landing_rev(self):
1760 def landing_rev(self):
1761 # always should return [rev_type, rev]
1761 # always should return [rev_type, rev], e.g ['branch', 'master']
1762 if self._landing_revision:
1762 if self._landing_revision:
1763 _rev_info = self._landing_revision.split(':')
1763 _rev_info = self._landing_revision.split(':')
1764 if len(_rev_info) < 2:
1764 if len(_rev_info) < 2:
@@ -1766,6 +1766,14 b' class Repository(Base, BaseModel):'
1766 return [_rev_info[0], _rev_info[1]]
1766 return [_rev_info[0], _rev_info[1]]
1767 return [None, None]
1767 return [None, None]
1768
1768
1769 @property
1770 def landing_ref_type(self):
1771 return self.landing_rev[0]
1772
1773 @property
1774 def landing_ref_name(self):
1775 return self.landing_rev[1]
1776
1769 @landing_rev.setter
1777 @landing_rev.setter
1770 def landing_rev(self, val):
1778 def landing_rev(self, val):
1771 if ':' not in val:
1779 if ':' not in val:
@@ -365,7 +365,7 b''
365 <ul id="context-pages" class="navigation horizontal-list">
365 <ul id="context-pages" class="navigation horizontal-list">
366 <li class="${h.is_active('summary', active)}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
366 <li class="${h.is_active('summary', active)}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
367 <li class="${h.is_active('commits', active)}"><a class="menulink" href="${h.route_path('repo_commits', repo_name=c.repo_name)}"><div class="menulabel">${_('Commits')}</div></a></li>
367 <li class="${h.is_active('commits', active)}"><a class="menulink" href="${h.route_path('repo_commits', repo_name=c.repo_name)}"><div class="menulabel">${_('Commits')}</div></a></li>
368 <li class="${h.is_active('files', active)}"><a class="menulink" href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.rhodecode_db_repo.landing_rev[1], f_path='')}"><div class="menulabel">${_('Files')}</div></a></li>
368 <li class="${h.is_active('files', active)}"><a class="menulink" href="${h.route_path('repo_files', repo_name=c.repo_name, commit_id=c.rhodecode_db_repo.landing_ref_name, f_path='')}"><div class="menulabel">${_('Files')}</div></a></li>
369 <li class="${h.is_active('compare', active)}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
369 <li class="${h.is_active('compare', active)}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
370
370
371 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
371 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
@@ -6,7 +6,7 b" c.template_context['repo_name'] = getatt"
6 go_import_header = ''
6 go_import_header = ''
7 if hasattr(c, 'rhodecode_db_repo'):
7 if hasattr(c, 'rhodecode_db_repo'):
8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_ref_name
10 c.template_context['repo_id'] = c.rhodecode_db_repo.repo_id
10 c.template_context['repo_id'] = c.rhodecode_db_repo.repo_id
11 c.template_context['repo_view_type'] = h.get_repo_view_type(request)
11 c.template_context['repo_view_type'] = h.get_repo_view_type(request)
12
12
@@ -60,10 +60,10 b''
60 class="btn btn-small"
60 class="btn btn-small"
61 href="${h.route_path('repo_compare',
61 href="${h.route_path('repo_compare',
62 repo_name=c.rhodecode_db_repo.fork.repo_name,
62 repo_name=c.rhodecode_db_repo.fork.repo_name,
63 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
63 source_ref_type=c.rhodecode_db_repo.landing_ref_type,
64 source_ref=c.rhodecode_db_repo.landing_rev[1],
64 source_ref=c.rhodecode_db_repo.landing_ref_name,
65 target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],
65 target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_ref_type,
66 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
66 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_ref_name,
67 _query=dict(merge=1, target_repo=c.repo_name))}"
67 _query=dict(merge=1, target_repo=c.repo_name))}"
68 >
68 >
69 ${_('Compare fork with Parent (%s)' % c.rhodecode_db_repo.fork.repo_name)}
69 ${_('Compare fork with Parent (%s)' % c.rhodecode_db_repo.fork.repo_name)}
@@ -93,10 +93,10 b''
93 <a class="btn btn-default" title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
93 <a class="btn btn-default" title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
94 href="${h.route_path('repo_compare',
94 href="${h.route_path('repo_compare',
95 repo_name=c.rhodecode_db_repo.fork.repo_name,
95 repo_name=c.rhodecode_db_repo.fork.repo_name,
96 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
96 source_ref_type=c.rhodecode_db_repo.landing_ref_type,
97 source_ref=c.rhodecode_db_repo.landing_rev[1],
97 source_ref=c.rhodecode_db_repo.landing_ref_name,
98 target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],
98 target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_ref_type,
99 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
99 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_ref_name,
100 _query=dict(merge=1))}"
100 _query=dict(merge=1))}"
101 >
101 >
102 ${_('Compare with origin')}
102 ${_('Compare with origin')}
@@ -64,10 +64,10 b''
64 %if c.readme_data:
64 %if c.readme_data:
65 <div id="readme" class="anchor">
65 <div id="readme" class="anchor">
66 <div class="box">
66 <div class="box">
67 <div class="readme-title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_rev[0], c.rhodecode_db_repo.landing_rev[1]))}">
67 <div class="readme-title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_ref_type, c.rhodecode_db_repo.landing_ref_name))}">
68 <div>
68 <div>
69 <i class="icon-file-text"></i>
69 <i class="icon-file-text"></i>
70 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_rev[1],f_path=c.readme_file)}">
70 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_ref_name,f_path=c.readme_file)}">
71 ${c.readme_file}
71 ${c.readme_file}
72 </a>
72 </a>
73 </div>
73 </div>
@@ -34,10 +34,10 b''
34 <div id="readme" class="anchor">
34 <div id="readme" class="anchor">
35 <div class="box">
35 <div class="box">
36
36
37 <div class="readme-title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_rev[0], c.rhodecode_db_repo.landing_rev[1]))}">
37 <div class="readme-title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_ref_type, c.rhodecode_db_repo.landing_ref_name))}">
38 <div>
38 <div>
39 <i class="icon-file-text"></i>
39 <i class="icon-file-text"></i>
40 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_rev[1],f_path=c.readme_file)}">
40 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_ref_name,f_path=c.readme_file)}">
41 ${c.readme_file}
41 ${c.readme_file}
42 </a>
42 </a>
43 </div>
43 </div>
General Comments 0
You need to be logged in to leave comments. Login now