##// END OF EJS Templates
ui: fixed pr count on repo settings
marcink -
r3569:9cb54b7f new-ui
parent child Browse files
Show More
@@ -1,920 +1,923 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="root.mako"/>
2 <%inherit file="root.mako"/>
3
3
4 <%include file="/ejs_templates/templates.html"/>
4 <%include file="/ejs_templates/templates.html"/>
5
5
6 <div class="outerwrapper">
6 <div class="outerwrapper">
7 <!-- HEADER -->
7 <!-- HEADER -->
8 <div class="header">
8 <div class="header">
9 <div id="header-inner" class="wrapper">
9 <div id="header-inner" class="wrapper">
10 <div id="logo">
10 <div id="logo">
11 <div class="logo-wrapper">
11 <div class="logo-wrapper">
12 <a href="${h.route_path('home')}"><img src="${h.asset('images/rhodecode-logo-white-60x60.png')}" alt="RhodeCode"/></a>
12 <a href="${h.route_path('home')}"><img src="${h.asset('images/rhodecode-logo-white-60x60.png')}" alt="RhodeCode"/></a>
13 </div>
13 </div>
14 % if c.rhodecode_name:
14 % if c.rhodecode_name:
15 <div class="branding">
15 <div class="branding">
16 <a href="${h.route_path('home')}">${h.branding(c.rhodecode_name)}</a>
16 <a href="${h.route_path('home')}">${h.branding(c.rhodecode_name)}</a>
17 </div>
17 </div>
18 % endif
18 % endif
19 </div>
19 </div>
20 <!-- MENU BAR NAV -->
20 <!-- MENU BAR NAV -->
21 ${self.menu_bar_nav()}
21 ${self.menu_bar_nav()}
22 <!-- END MENU BAR NAV -->
22 <!-- END MENU BAR NAV -->
23 </div>
23 </div>
24 </div>
24 </div>
25 ${self.menu_bar_subnav()}
25 ${self.menu_bar_subnav()}
26 <!-- END HEADER -->
26 <!-- END HEADER -->
27
27
28 <!-- CONTENT -->
28 <!-- CONTENT -->
29 <div id="content" class="wrapper">
29 <div id="content" class="wrapper">
30
30
31 <rhodecode-toast id="notifications"></rhodecode-toast>
31 <rhodecode-toast id="notifications"></rhodecode-toast>
32
32
33 <div class="main">
33 <div class="main">
34 ${next.main()}
34 ${next.main()}
35 </div>
35 </div>
36 </div>
36 </div>
37 <!-- END CONTENT -->
37 <!-- END CONTENT -->
38
38
39 </div>
39 </div>
40 <!-- FOOTER -->
40 <!-- FOOTER -->
41 <div id="footer">
41 <div id="footer">
42 <div id="footer-inner" class="title wrapper">
42 <div id="footer-inner" class="title wrapper">
43 <div>
43 <div>
44 <p class="footer-link-right">
44 <p class="footer-link-right">
45 % if c.visual.show_version:
45 % if c.visual.show_version:
46 RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition}
46 RhodeCode Enterprise ${c.rhodecode_version} ${c.rhodecode_edition}
47 % endif
47 % endif
48 &copy; 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
48 &copy; 2010-${h.datetime.today().year}, <a href="${h.route_url('rhodecode_official')}" target="_blank">RhodeCode GmbH</a>. All rights reserved.
49 % if c.visual.rhodecode_support_url:
49 % if c.visual.rhodecode_support_url:
50 <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>
50 <a href="${c.visual.rhodecode_support_url}" target="_blank">${_('Support')}</a>
51 % endif
51 % endif
52 </p>
52 </p>
53 <% sid = 'block' if request.GET.get('showrcid') else 'none' %>
53 <% sid = 'block' if request.GET.get('showrcid') else 'none' %>
54 <p class="server-instance" style="display:${sid}">
54 <p class="server-instance" style="display:${sid}">
55 ## display hidden instance ID if specially defined
55 ## display hidden instance ID if specially defined
56 % if c.rhodecode_instanceid:
56 % if c.rhodecode_instanceid:
57 ${_('RhodeCode instance id: {}').format(c.rhodecode_instanceid)}
57 ${_('RhodeCode instance id: {}').format(c.rhodecode_instanceid)}
58 % endif
58 % endif
59 </p>
59 </p>
60 </div>
60 </div>
61 </div>
61 </div>
62 </div>
62 </div>
63
63
64 <!-- END FOOTER -->
64 <!-- END FOOTER -->
65
65
66 ### MAKO DEFS ###
66 ### MAKO DEFS ###
67
67
68 <%def name="menu_bar_subnav()">
68 <%def name="menu_bar_subnav()">
69 </%def>
69 </%def>
70
70
71 <%def name="breadcrumbs(class_='breadcrumbs')">
71 <%def name="breadcrumbs(class_='breadcrumbs')">
72 <div class="${class_}">
72 <div class="${class_}">
73 ${self.breadcrumbs_links()}
73 ${self.breadcrumbs_links()}
74 </div>
74 </div>
75 </%def>
75 </%def>
76
76
77 <%def name="admin_menu(active=None)">
77 <%def name="admin_menu(active=None)">
78 <div id="context-bar">
78 <div id="context-bar">
79 <div class="wrapper">
79 <div class="wrapper">
80 <ul id="context-pages" class="navigation horizontal-list">
80 <ul id="context-pages" class="navigation horizontal-list">
81 <%
81 <%
82 repositories=c.rhodecode_user.repositories_admin
82 repositories=c.rhodecode_user.repositories_admin
83 repository_groups=c.rhodecode_user.repository_groups_admin
83 repository_groups=c.rhodecode_user.repository_groups_admin
84 user_groups=c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')()
84 user_groups=c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')()
85 def is_active(selected):
85 def is_active(selected):
86 if selected == active:
86 if selected == active:
87 return "active"
87 return "active"
88 %>
88 %>
89 ## super admin case
89 ## super admin case
90 % if c.rhodecode_user.is_admin:
90 % if c.rhodecode_user.is_admin:
91 <li class="${is_active('audit_logs')}"><a href="${h.route_path('admin_audit_logs')}">${_('Admin audit logs')}</a></li>
91 <li class="${is_active('audit_logs')}"><a href="${h.route_path('admin_audit_logs')}">${_('Admin audit logs')}</a></li>
92 <li class="${is_active('repositories')}"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
92 <li class="${is_active('repositories')}"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
93 <li class="${is_active('repository_groups')}"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
93 <li class="${is_active('repository_groups')}"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
94 <li class="${is_active('users')}"><a href="${h.route_path('users')}">${_('Users')}</a></li>
94 <li class="${is_active('users')}"><a href="${h.route_path('users')}">${_('Users')}</a></li>
95 <li class="${is_active('user_groups')}"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
95 <li class="${is_active('user_groups')}"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
96 <li class="${is_active('permissions')}"><a href="${h.route_path('admin_permissions_application')}">${_('Permissions')}</a></li>
96 <li class="${is_active('permissions')}"><a href="${h.route_path('admin_permissions_application')}">${_('Permissions')}</a></li>
97 <li class="${is_active('authentication')}"><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li>
97 <li class="${is_active('authentication')}"><a href="${h.route_path('auth_home', traverse='')}">${_('Authentication')}</a></li>
98 <li class="${is_active('integrations')}"><a href="${h.route_path('global_integrations_home')}">${_('Integrations')}</a></li>
98 <li class="${is_active('integrations')}"><a href="${h.route_path('global_integrations_home')}">${_('Integrations')}</a></li>
99 <li class="${is_active('defaults')}"><a href="${h.route_path('admin_defaults_repositories')}">${_('Defaults')}</a></li>
99 <li class="${is_active('defaults')}"><a href="${h.route_path('admin_defaults_repositories')}">${_('Defaults')}</a></li>
100 <li class="${is_active('settings')}"><a href="${h.route_path('admin_settings')}">${_('Settings')}</a></li>
100 <li class="${is_active('settings')}"><a href="${h.route_path('admin_settings')}">${_('Settings')}</a></li>
101
101
102 ## delegated admin
102 ## delegated admin
103 % elif repositories or repository_groups or user_groups:
103 % elif repositories or repository_groups or user_groups:
104
104
105 %if repositories:
105 %if repositories:
106 <li class="${is_active('repositories')} local-admin-repos"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
106 <li class="${is_active('repositories')} local-admin-repos"><a href="${h.route_path('repos')}">${_('Repositories')}</a></li>
107 %endif
107 %endif
108 %if repository_groups:
108 %if repository_groups:
109 <li class="${is_active('repository_groups')} local-admin-repo-groups"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
109 <li class="${is_active('repository_groups')} local-admin-repo-groups"><a href="${h.route_path('repo_groups')}">${_('Repository groups')}</a></li>
110 %endif
110 %endif
111 %if user_groups:
111 %if user_groups:
112 <li class="${is_active('user_groups')} local-admin-user-groups"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
112 <li class="${is_active('user_groups')} local-admin-user-groups"><a href="${h.route_path('user_groups')}">${_('User groups')}</a></li>
113 %endif
113 %endif
114 % endif
114 % endif
115 </ul>
115 </ul>
116 </div>
116 </div>
117 <div class="clear"></div>
117 <div class="clear"></div>
118 </div>
118 </div>
119 </%def>
119 </%def>
120
120
121
121
122 <%def name="dt_info_panel(elements)">
122 <%def name="dt_info_panel(elements)">
123 <dl class="dl-horizontal">
123 <dl class="dl-horizontal">
124 %for dt, dd, title, show_items in elements:
124 %for dt, dd, title, show_items in elements:
125 <dt>${dt}:</dt>
125 <dt>${dt}:</dt>
126 <dd title="${h.tooltip(title)}">
126 <dd title="${h.tooltip(title)}">
127 %if callable(dd):
127 %if callable(dd):
128 ## allow lazy evaluation of elements
128 ## allow lazy evaluation of elements
129 ${dd()}
129 ${dd()}
130 %else:
130 %else:
131 ${dd}
131 ${dd}
132 %endif
132 %endif
133 %if show_items:
133 %if show_items:
134 <span class="btn-collapse" data-toggle="item-${h.md5_safe(dt)[:6]}-details">${_('Show More')} </span>
134 <span class="btn-collapse" data-toggle="item-${h.md5_safe(dt)[:6]}-details">${_('Show More')} </span>
135 %endif
135 %endif
136 </dd>
136 </dd>
137
137
138 %if show_items:
138 %if show_items:
139 <div class="collapsable-content" data-toggle="item-${h.md5_safe(dt)[:6]}-details" style="display: none">
139 <div class="collapsable-content" data-toggle="item-${h.md5_safe(dt)[:6]}-details" style="display: none">
140 %for item in show_items:
140 %for item in show_items:
141 <dt></dt>
141 <dt></dt>
142 <dd>${item}</dd>
142 <dd>${item}</dd>
143 %endfor
143 %endfor
144 </div>
144 </div>
145 %endif
145 %endif
146
146
147 %endfor
147 %endfor
148 </dl>
148 </dl>
149 </%def>
149 </%def>
150
150
151
151
152 <%def name="gravatar(email, size=16)">
152 <%def name="gravatar(email, size=16)">
153 <%
153 <%
154 if (size > 16):
154 if (size > 16):
155 gravatar_class = 'gravatar gravatar-large'
155 gravatar_class = 'gravatar gravatar-large'
156 else:
156 else:
157 gravatar_class = 'gravatar'
157 gravatar_class = 'gravatar'
158 %>
158 %>
159 <%doc>
159 <%doc>
160 TODO: johbo: For now we serve double size images to make it smooth
160 TODO: johbo: For now we serve double size images to make it smooth
161 for retina. This is how it worked until now. Should be replaced
161 for retina. This is how it worked until now. Should be replaced
162 with a better solution at some point.
162 with a better solution at some point.
163 </%doc>
163 </%doc>
164 <img class="${gravatar_class}" src="${h.gravatar_url(email, size * 2)}" height="${size}" width="${size}">
164 <img class="${gravatar_class}" src="${h.gravatar_url(email, size * 2)}" height="${size}" width="${size}">
165 </%def>
165 </%def>
166
166
167
167
168 <%def name="gravatar_with_user(contact, size=16, show_disabled=False)">
168 <%def name="gravatar_with_user(contact, size=16, show_disabled=False)">
169 <% email = h.email_or_none(contact) %>
169 <% email = h.email_or_none(contact) %>
170 <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}">
170 <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}">
171 ${self.gravatar(email, size)}
171 ${self.gravatar(email, size)}
172 <span class="${'user user-disabled' if show_disabled else 'user'}"> ${h.link_to_user(contact)}</span>
172 <span class="${'user user-disabled' if show_disabled else 'user'}"> ${h.link_to_user(contact)}</span>
173 </div>
173 </div>
174 </%def>
174 </%def>
175
175
176
176
177 <%def name="repo_page_title(repo_instance)">
177 <%def name="repo_page_title(repo_instance)">
178 <div class="title-content">
178 <div class="title-content">
179 <div class="title-main">
179 <div class="title-main">
180 ## SVN/HG/GIT icons
180 ## SVN/HG/GIT icons
181 %if h.is_hg(repo_instance):
181 %if h.is_hg(repo_instance):
182 <i class="icon-hg"></i>
182 <i class="icon-hg"></i>
183 %endif
183 %endif
184 %if h.is_git(repo_instance):
184 %if h.is_git(repo_instance):
185 <i class="icon-git"></i>
185 <i class="icon-git"></i>
186 %endif
186 %endif
187 %if h.is_svn(repo_instance):
187 %if h.is_svn(repo_instance):
188 <i class="icon-svn"></i>
188 <i class="icon-svn"></i>
189 %endif
189 %endif
190
190
191 ## public/private
191 ## public/private
192 %if repo_instance.private:
192 %if repo_instance.private:
193 <i class="icon-repo-private"></i>
193 <i class="icon-repo-private"></i>
194 %else:
194 %else:
195 <i class="icon-repo-public"></i>
195 <i class="icon-repo-public"></i>
196 %endif
196 %endif
197
197
198 ## repo name with group name
198 ## repo name with group name
199 ${h.breadcrumb_repo_link(repo_instance)}
199 ${h.breadcrumb_repo_link(repo_instance)}
200
200
201 </div>
201 </div>
202
202
203 ## FORKED
203 ## FORKED
204 %if repo_instance.fork:
204 %if repo_instance.fork:
205 <p>
205 <p>
206 <i class="icon-code-fork"></i> ${_('Fork of')}
206 <i class="icon-code-fork"></i> ${_('Fork of')}
207 ${h.link_to_if(c.has_origin_repo_read_perm,repo_instance.fork.repo_name, h.route_path('repo_summary', repo_name=repo_instance.fork.repo_name))}
207 ${h.link_to_if(c.has_origin_repo_read_perm,repo_instance.fork.repo_name, h.route_path('repo_summary', repo_name=repo_instance.fork.repo_name))}
208 </p>
208 </p>
209 %endif
209 %endif
210
210
211 ## IMPORTED FROM REMOTE
211 ## IMPORTED FROM REMOTE
212 %if repo_instance.clone_uri:
212 %if repo_instance.clone_uri:
213 <p>
213 <p>
214 <i class="icon-code-fork"></i> ${_('Clone from')}
214 <i class="icon-code-fork"></i> ${_('Clone from')}
215 <a href="${h.safe_str(h.hide_credentials(repo_instance.clone_uri))}">${h.hide_credentials(repo_instance.clone_uri)}</a>
215 <a href="${h.safe_str(h.hide_credentials(repo_instance.clone_uri))}">${h.hide_credentials(repo_instance.clone_uri)}</a>
216 </p>
216 </p>
217 %endif
217 %endif
218
218
219 ## LOCKING STATUS
219 ## LOCKING STATUS
220 %if repo_instance.locked[0]:
220 %if repo_instance.locked[0]:
221 <p class="locking_locked">
221 <p class="locking_locked">
222 <i class="icon-repo-lock"></i>
222 <i class="icon-repo-lock"></i>
223 ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}}
223 ${_('Repository locked by %(user)s') % {'user': h.person_by_id(repo_instance.locked[0])}}
224 </p>
224 </p>
225 %elif repo_instance.enable_locking:
225 %elif repo_instance.enable_locking:
226 <p class="locking_unlocked">
226 <p class="locking_unlocked">
227 <i class="icon-repo-unlock"></i>
227 <i class="icon-repo-unlock"></i>
228 ${_('Repository not locked. Pull repository to lock it.')}
228 ${_('Repository not locked. Pull repository to lock it.')}
229 </p>
229 </p>
230 %endif
230 %endif
231
231
232 </div>
232 </div>
233 </%def>
233 </%def>
234
234
235 <%def name="repo_menu(active=None)">
235 <%def name="repo_menu(active=None)">
236 <%
236 <%
237 def is_active(selected):
237 def is_active(selected):
238 if selected == active:
238 if selected == active:
239 return "active"
239 return "active"
240 %>
240 %>
241
241
242 <!--- REPO CONTEXT BAR -->
242 <!--- REPO CONTEXT BAR -->
243 <div id="context-bar">
243 <div id="context-bar">
244 <div class="wrapper">
244 <div class="wrapper">
245
245
246 <div class="title">
246 <div class="title">
247 ${self.repo_page_title(c.rhodecode_db_repo)}
247 ${self.repo_page_title(c.rhodecode_db_repo)}
248 </div>
248 </div>
249
249
250 <ul id="context-pages" class="navigation horizontal-list">
250 <ul id="context-pages" class="navigation horizontal-list">
251 <li class="${is_active('summary')}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
251 <li class="${is_active('summary')}"><a class="menulink" href="${h.route_path('repo_summary', repo_name=c.repo_name)}"><div class="menulabel">${_('Summary')}</div></a></li>
252 <li class="${is_active('changelog')}"><a class="menulink" href="${h.route_path('repo_changelog', repo_name=c.repo_name)}"><div class="menulabel">${_('Changelog')}</div></a></li>
252 <li class="${is_active('changelog')}"><a class="menulink" href="${h.route_path('repo_changelog', repo_name=c.repo_name)}"><div class="menulabel">${_('Changelog')}</div></a></li>
253 <li class="${is_active('files')}"><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>
253 <li class="${is_active('files')}"><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>
254 <li class="${is_active('compare')}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
254 <li class="${is_active('compare')}"><a class="menulink" href="${h.route_path('repo_compare_select',repo_name=c.repo_name)}"><div class="menulabel">${_('Compare')}</div></a></li>
255
255
256 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
256 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
257 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
257 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
258 <li class="${is_active('showpullrequest')}">
258 <li class="${is_active('showpullrequest')}">
259 <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)}">
259 <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)}">
260 %if c.repository_pull_requests:
260 <div class="menulabel">
261 <span class="pr_notifications">${c.repository_pull_requests}</span>
261 %if c.repository_pull_requests == 1:
262 ${c.repository_pull_requests} ${_('Pull Request')}
263 %else:
264 ${c.repository_pull_requests} ${_('Pull Requests')}
262 %endif
265 %endif
263 <div class="menulabel">${_('Pull Requests')}</div>
266 </div>
264 </a>
267 </a>
265 </li>
268 </li>
266 %endif
269 %endif
267
270
268 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
271 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
269 <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>
272 <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>
270 %endif
273 %endif
271
274
272 <li class="${is_active('options')}">
275 <li class="${is_active('options')}">
273 <a class="menulink dropdown">
276 <a class="menulink dropdown">
274 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
277 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
275 </a>
278 </a>
276 <ul class="submenu">
279 <ul class="submenu">
277
280
278 %if c.rhodecode_db_repo.fork:
281 %if c.rhodecode_db_repo.fork:
279 <li>
282 <li>
280 <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
283 <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
281 href="${h.route_path('repo_compare',
284 href="${h.route_path('repo_compare',
282 repo_name=c.rhodecode_db_repo.fork.repo_name,
285 repo_name=c.rhodecode_db_repo.fork.repo_name,
283 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
286 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
284 source_ref=c.rhodecode_db_repo.landing_rev[1],
287 source_ref=c.rhodecode_db_repo.landing_rev[1],
285 target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],
288 target_repo=c.repo_name,target_ref_type='branch' if request.GET.get('branch') else c.rhodecode_db_repo.landing_rev[0],
286 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
289 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
287 _query=dict(merge=1))}"
290 _query=dict(merge=1))}"
288 >
291 >
289 ${_('Compare fork')}
292 ${_('Compare fork')}
290 </a>
293 </a>
291 </li>
294 </li>
292 %endif
295 %endif
293
296
294 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
297 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
295 %if c.rhodecode_db_repo.locked[0]:
298 %if c.rhodecode_db_repo.locked[0]:
296 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock')}</a></li>
299 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock')}</a></li>
297 %else:
300 %else:
298 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li>
301 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li>
299 %endif
302 %endif
300 %endif
303 %endif
301 %if c.rhodecode_user.username != h.DEFAULT_USER:
304 %if c.rhodecode_user.username != h.DEFAULT_USER:
302 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
305 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
303 <li><a href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">${_('Fork')}</a></li>
306 <li><a href="${h.route_path('repo_fork_new',repo_name=c.repo_name)}">${_('Fork')}</a></li>
304 <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li>
307 <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li>
305 %endif
308 %endif
306 %endif
309 %endif
307 </ul>
310 </ul>
308 </li>
311 </li>
309 </ul>
312 </ul>
310 </div>
313 </div>
311 <div class="clear"></div>
314 <div class="clear"></div>
312 </div>
315 </div>
313 % if c.rhodecode_db_repo.archived:
316 % if c.rhodecode_db_repo.archived:
314 <div class="alert alert-warning text-center">
317 <div class="alert alert-warning text-center">
315 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
318 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
316 </div>
319 </div>
317 % endif
320 % endif
318 <!--- REPO END CONTEXT BAR -->
321 <!--- REPO END CONTEXT BAR -->
319
322
320 </%def>
323 </%def>
321
324
322 <%def name="repo_group_page_title(repo_group_instance)">
325 <%def name="repo_group_page_title(repo_group_instance)">
323 <div class="title-content">
326 <div class="title-content">
324 <div class="title-main">
327 <div class="title-main">
325 ## Repository Group icon
328 ## Repository Group icon
326 <i class="icon-folder-close"></i>
329 <i class="icon-folder-close"></i>
327
330
328 ## repo name with group name
331 ## repo name with group name
329 ${h.breadcrumb_repo_group_link(repo_group_instance)}
332 ${h.breadcrumb_repo_group_link(repo_group_instance)}
330 </div>
333 </div>
331
334
332 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
335 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
333 <div class="repo-group-desc">
336 <div class="repo-group-desc">
334 ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)}
337 ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)}
335 </div>
338 </div>
336
339
337 </div>
340 </div>
338 </%def>
341 </%def>
339
342
340 <%def name="repo_group_menu(active=None)">
343 <%def name="repo_group_menu(active=None)">
341 <%
344 <%
342 def is_active(selected):
345 def is_active(selected):
343 if selected == active:
346 if selected == active:
344 return "active"
347 return "active"
345
348
346 is_admin = h.HasPermissionAny('hg.admin')('can create repos index page')
349 is_admin = h.HasPermissionAny('hg.admin')('can create repos index page')
347
350
348 gr_name = c.repo_group.group_name if c.repo_group else None
351 gr_name = c.repo_group.group_name if c.repo_group else None
349 # create repositories with write permission on group is set to true
352 # create repositories with write permission on group is set to true
350 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
353 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
351 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
354 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
352 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
355 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
353
356
354 %>
357 %>
355
358
356 <!--- REPO GROUP CONTEXT BAR -->
359 <!--- REPO GROUP CONTEXT BAR -->
357 <div id="context-bar">
360 <div id="context-bar">
358 <div class="wrapper">
361 <div class="wrapper">
359 <ul id="context-pages" class="navigation horizontal-list">
362 <ul id="context-pages" class="navigation horizontal-list">
360 <li class="${is_active('home')}"><a class="menulink" href="${h.route_path('repo_group_home', repo_group_name=c.repo_group.group_name)}"><div class="menulabel">${_('Group Home')}</div></a></li>
363 <li class="${is_active('home')}"><a class="menulink" href="${h.route_path('repo_group_home', repo_group_name=c.repo_group.group_name)}"><div class="menulabel">${_('Group Home')}</div></a></li>
361 % if is_admin or group_admin:
364 % if is_admin or group_admin:
362 <li class="${is_active('settings')}"><a class="menulink" href="${h.route_path('edit_repo_group',repo_group_name=c.repo_group.group_name)}" title="${_('You have admin right to this group, and can edit it')}"><div class="menulabel">${_('Group Settings')}</div></a></li>
365 <li class="${is_active('settings')}"><a class="menulink" href="${h.route_path('edit_repo_group',repo_group_name=c.repo_group.group_name)}" title="${_('You have admin right to this group, and can edit it')}"><div class="menulabel">${_('Group Settings')}</div></a></li>
363 % endif
366 % endif
364
367
365 <li class="${is_active('options')}">
368 <li class="${is_active('options')}">
366 <a class="menulink dropdown">
369 <a class="menulink dropdown">
367 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
370 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
368 </a>
371 </a>
369 <ul class="submenu">
372 <ul class="submenu">
370 %if is_admin or group_admin or (group_write and create_on_write):
373 %if is_admin or group_admin or (group_write and create_on_write):
371 <li><a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}">${_('Add Repository')}</a></li>
374 <li><a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}">${_('Add Repository')}</a></li>
372 %endif
375 %endif
373 %if is_admin or group_admin:
376 %if is_admin or group_admin:
374 <li><a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.repo_group.group_id))}">${_(u'Add Parent Group')}</a></li>
377 <li><a href="${h.route_path('repo_group_new',_query=dict(parent_group=c.repo_group.group_id))}">${_(u'Add Parent Group')}</a></li>
375 %endif
378 %endif
376 </ul>
379 </ul>
377 </li>
380 </li>
378 </ul>
381 </ul>
379 </div>
382 </div>
380 <div class="clear"></div>
383 <div class="clear"></div>
381 </div>
384 </div>
382
385
383 <!--- REPO GROUP CONTEXT BAR -->
386 <!--- REPO GROUP CONTEXT BAR -->
384
387
385 </%def>
388 </%def>
386
389
387
390
388 <%def name="usermenu(active=False)">
391 <%def name="usermenu(active=False)">
389 ## USER MENU
392 ## USER MENU
390 <li id="quick_login_li" class="${'active' if active else ''}">
393 <li id="quick_login_li" class="${'active' if active else ''}">
391 % if c.rhodecode_user.username == h.DEFAULT_USER:
394 % if c.rhodecode_user.username == h.DEFAULT_USER:
392 <a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">
395 <a id="quick_login_link" class="menulink childs" href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">
393 ${gravatar(c.rhodecode_user.email, 20)}
396 ${gravatar(c.rhodecode_user.email, 20)}
394 <span class="user">
397 <span class="user">
395 <span>${_('Sign in')}</span>
398 <span>${_('Sign in')}</span>
396 </span>
399 </span>
397 </a>
400 </a>
398 % else:
401 % else:
399 ## logged in user
402 ## logged in user
400 <a id="quick_login_link" class="menulink childs">
403 <a id="quick_login_link" class="menulink childs">
401 ${gravatar(c.rhodecode_user.email, 20)}
404 ${gravatar(c.rhodecode_user.email, 20)}
402 <span class="user">
405 <span class="user">
403 <span class="menu_link_user">${c.rhodecode_user.username}</span>
406 <span class="menu_link_user">${c.rhodecode_user.username}</span>
404 <div class="show_more"></div>
407 <div class="show_more"></div>
405 </span>
408 </span>
406 </a>
409 </a>
407 ## subnav with menu for logged in user
410 ## subnav with menu for logged in user
408 <div class="user-menu submenu">
411 <div class="user-menu submenu">
409 <div id="quick_login">
412 <div id="quick_login">
410 %if c.rhodecode_user.username != h.DEFAULT_USER:
413 %if c.rhodecode_user.username != h.DEFAULT_USER:
411 <div class="">
414 <div class="">
412 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
415 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
413 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
416 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
414 <div class="email">${c.rhodecode_user.email}</div>
417 <div class="email">${c.rhodecode_user.email}</div>
415 </div>
418 </div>
416 <div class="">
419 <div class="">
417 <ol class="links">
420 <ol class="links">
418 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
421 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
419 % if c.rhodecode_user.personal_repo_group:
422 % if c.rhodecode_user.personal_repo_group:
420 <li>${h.link_to(_(u'My personal group'), h.route_path('repo_group_home', repo_group_name=c.rhodecode_user.personal_repo_group.group_name))}</li>
423 <li>${h.link_to(_(u'My personal group'), h.route_path('repo_group_home', repo_group_name=c.rhodecode_user.personal_repo_group.group_name))}</li>
421 % endif
424 % endif
422 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
425 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
423 ## bookmark-items
426 ## bookmark-items
424 <li class="bookmark-items">
427 <li class="bookmark-items">
425 ${_('Bookmarks')}
428 ${_('Bookmarks')}
426 <div class="pull-right">
429 <div class="pull-right">
427 <a href="${h.route_path('my_account_bookmarks')}">${_('Manage')}</a>
430 <a href="${h.route_path('my_account_bookmarks')}">${_('Manage')}</a>
428 </div>
431 </div>
429 </li>
432 </li>
430 % if not c.bookmark_items:
433 % if not c.bookmark_items:
431 <li>
434 <li>
432 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
435 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
433 </li>
436 </li>
434 % endif
437 % endif
435 % for item in c.bookmark_items:
438 % for item in c.bookmark_items:
436 <li>
439 <li>
437 % if item.repository:
440 % if item.repository:
438 <div>
441 <div>
439 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
442 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
440 <code>${item.position}</code>
443 <code>${item.position}</code>
441 % if item.repository.repo_type == 'hg':
444 % if item.repository.repo_type == 'hg':
442 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
445 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
443 % elif item.repository.repo_type == 'git':
446 % elif item.repository.repo_type == 'git':
444 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
447 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
445 % elif item.repository.repo_type == 'svn':
448 % elif item.repository.repo_type == 'svn':
446 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
449 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
447 % endif
450 % endif
448 ${(item.title or h.shorter(item.repository.repo_name, 30))}
451 ${(item.title or h.shorter(item.repository.repo_name, 30))}
449 </a>
452 </a>
450 </div>
453 </div>
451 % elif item.repository_group:
454 % elif item.repository_group:
452 <div>
455 <div>
453 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
456 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
454 <code>${item.position}</code>
457 <code>${item.position}</code>
455 <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i>
458 <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i>
456 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
459 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
457 </a>
460 </a>
458 </div>
461 </div>
459 % else:
462 % else:
460 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
463 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
461 <code>${item.position}</code>
464 <code>${item.position}</code>
462 ${item.title}
465 ${item.title}
463 </a>
466 </a>
464 % endif
467 % endif
465 </li>
468 </li>
466 % endfor
469 % endfor
467
470
468 <li class="logout">
471 <li class="logout">
469 ${h.secure_form(h.route_path('logout'), request=request)}
472 ${h.secure_form(h.route_path('logout'), request=request)}
470 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
473 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
471 ${h.end_form()}
474 ${h.end_form()}
472 </li>
475 </li>
473 </ol>
476 </ol>
474 </div>
477 </div>
475 %endif
478 %endif
476 </div>
479 </div>
477 </div>
480 </div>
478 ## unread counter
481 ## unread counter
479 <div class="pill_container">
482 <div class="pill_container">
480 <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a>
483 <a class="menu_link_notifications ${'empty' if c.unread_notifications == 0 else ''}" href="${h.route_path('notifications_show_all')}">${c.unread_notifications}</a>
481 </div>
484 </div>
482 % endif
485 % endif
483 </li>
486 </li>
484 </%def>
487 </%def>
485
488
486 <%def name="menu_items(active=None)">
489 <%def name="menu_items(active=None)">
487 <%
490 <%
488 def is_active(selected):
491 def is_active(selected):
489 if selected == active:
492 if selected == active:
490 return "active"
493 return "active"
491 return ""
494 return ""
492 %>
495 %>
493
496
494 <ul id="quick" class="main_nav navigation horizontal-list">
497 <ul id="quick" class="main_nav navigation horizontal-list">
495 ## notice box for important system messages
498 ## notice box for important system messages
496 <li style="display: none">
499 <li style="display: none">
497 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
500 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
498 <div class="menulabel-notice" >
501 <div class="menulabel-notice" >
499 0
502 0
500 </div>
503 </div>
501 </a>
504 </a>
502 </li>
505 </li>
503
506
504 ## Main filter
507 ## Main filter
505 <li>
508 <li>
506 <div class="menulabel main_filter_box">
509 <div class="menulabel main_filter_box">
507 <div class="main_filter_input_box">
510 <div class="main_filter_input_box">
508 <ul class="searchItems">
511 <ul class="searchItems">
509
512
510 % if c.template_context['search_context']['repo_id']:
513 % if c.template_context['search_context']['repo_id']:
511 <li class="searchTag searchTagFilter searchTagHidable" >
514 <li class="searchTag searchTagFilter searchTagHidable" >
512 ##<a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">
515 ##<a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">
513 <span class="tag">
516 <span class="tag">
514 This repo
517 This repo
515 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-delete"></i></a>
518 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-delete"></i></a>
516 </span>
519 </span>
517 ##</a>
520 ##</a>
518 </li>
521 </li>
519 % elif c.template_context['search_context']['repo_group_id']:
522 % elif c.template_context['search_context']['repo_group_id']:
520 <li class="searchTag searchTagFilter searchTagHidable">
523 <li class="searchTag searchTagFilter searchTagHidable">
521 ##<a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">
524 ##<a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">
522 <span class="tag">
525 <span class="tag">
523 This group
526 This group
524 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-delete"></i></a>
527 <a href="#removeGoToFilter" onclick="removeGoToFilter(); return false"><i class="icon-delete"></i></a>
525 </span>
528 </span>
526 ##</a>
529 ##</a>
527 </li>
530 </li>
528 % endif
531 % endif
529
532
530 <li class="searchTagInput">
533 <li class="searchTagInput">
531 <input class="main_filter_input" id="main_filter" size="15" type="text" name="main_filter" placeholder="${_('search / go to...')}" value="" />
534 <input class="main_filter_input" id="main_filter" size="15" type="text" name="main_filter" placeholder="${_('search / go to...')}" value="" />
532 </li>
535 </li>
533 <li class="searchTag searchTagHelp">
536 <li class="searchTag searchTagHelp">
534 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
537 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
535 </li>
538 </li>
536 </ul>
539 </ul>
537 </div>
540 </div>
538 </div>
541 </div>
539
542
540 <div id="main_filter_help" style="display: none">
543 <div id="main_filter_help" style="display: none">
541 - Use '/' key to quickly access this field.
544 - Use '/' key to quickly access this field.
542
545
543 - Enter a name of repository, or repository group for quick search.
546 - Enter a name of repository, or repository group for quick search.
544
547
545 - Prefix query to allow special search:
548 - Prefix query to allow special search:
546
549
547 user:admin, to search for usernames, always global
550 user:admin, to search for usernames, always global
548
551
549 user_group:devops, to search for user groups, always global
552 user_group:devops, to search for user groups, always global
550
553
551 commit:efced4, to search for commits, scoped to repositories or groups
554 commit:efced4, to search for commits, scoped to repositories or groups
552
555
553 file:models.py, to search for file paths, scoped to repositories or groups
556 file:models.py, to search for file paths, scoped to repositories or groups
554
557
555 % if c.template_context['search_context']['repo_id']:
558 % if c.template_context['search_context']['repo_id']:
556 For advanced full text search visit: <a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">repository search</a>
559 For advanced full text search visit: <a href="${h.route_path('search_repo',repo_name=c.template_context['search_context']['repo_name'])}">repository search</a>
557 % elif c.template_context['search_context']['repo_group_id']:
560 % elif c.template_context['search_context']['repo_group_id']:
558 For advanced full text search visit: <a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">repository group search</a>
561 For advanced full text search visit: <a href="${h.route_path('search_repo_group',repo_group_name=c.template_context['search_context']['repo_group_name'])}">repository group search</a>
559 % else:
562 % else:
560 For advanced full text search visit: <a href="${h.route_path('search')}">global search</a>
563 For advanced full text search visit: <a href="${h.route_path('search')}">global search</a>
561 % endif
564 % endif
562 </div>
565 </div>
563 </li>
566 </li>
564
567
565 ## ROOT MENU
568 ## ROOT MENU
566 <li class="${is_active('home')}">
569 <li class="${is_active('home')}">
567 <a class="menulink" title="${_('Home')}" href="${h.route_path('home')}">
570 <a class="menulink" title="${_('Home')}" href="${h.route_path('home')}">
568 <div class="menulabel">${_('Home')}</div>
571 <div class="menulabel">${_('Home')}</div>
569 </a>
572 </a>
570 </li>
573 </li>
571
574
572 %if c.rhodecode_user.username != h.DEFAULT_USER:
575 %if c.rhodecode_user.username != h.DEFAULT_USER:
573 <li class="${is_active('journal')}">
576 <li class="${is_active('journal')}">
574 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
577 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
575 <div class="menulabel">${_('Journal')}</div>
578 <div class="menulabel">${_('Journal')}</div>
576 </a>
579 </a>
577 </li>
580 </li>
578 %else:
581 %else:
579 <li class="${is_active('journal')}">
582 <li class="${is_active('journal')}">
580 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
583 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
581 <div class="menulabel">${_('Public journal')}</div>
584 <div class="menulabel">${_('Public journal')}</div>
582 </a>
585 </a>
583 </li>
586 </li>
584 %endif
587 %endif
585
588
586 <li class="${is_active('gists')}">
589 <li class="${is_active('gists')}">
587 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
590 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
588 <div class="menulabel">${_('Gists')}</div>
591 <div class="menulabel">${_('Gists')}</div>
589 </a>
592 </a>
590 </li>
593 </li>
591
594
592 <li class="${is_active('admin')}">
595 <li class="${is_active('admin')}">
593 <a class="menulink childs" title="${_('Admin settings')}" href="${h.route_path('admin_home')}">
596 <a class="menulink childs" title="${_('Admin settings')}" href="${h.route_path('admin_home')}">
594 <div class="menulabel">${_('Admin')} </div>
597 <div class="menulabel">${_('Admin')} </div>
595 </a>
598 </a>
596 </li>
599 </li>
597
600
598 ## render extra user menu
601 ## render extra user menu
599 ${usermenu(active=(active=='my_account'))}
602 ${usermenu(active=(active=='my_account'))}
600
603
601 % if c.debug_style:
604 % if c.debug_style:
602 <li>
605 <li>
603 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
606 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
604 <div class="menulabel">${_('[Style]')}</div>
607 <div class="menulabel">${_('[Style]')}</div>
605 </a>
608 </a>
606 </li>
609 </li>
607 % endif
610 % endif
608 </ul>
611 </ul>
609
612
610 <script type="text/javascript">
613 <script type="text/javascript">
611 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
614 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
612
615
613 var formatRepoResult = function(result, container, query, escapeMarkup) {
616 var formatRepoResult = function(result, container, query, escapeMarkup) {
614 return function(data, escapeMarkup) {
617 return function(data, escapeMarkup) {
615 if (!data.repo_id){
618 if (!data.repo_id){
616 return data.text; // optgroup text Repositories
619 return data.text; // optgroup text Repositories
617 }
620 }
618
621
619 var tmpl = '';
622 var tmpl = '';
620 var repoType = data['repo_type'];
623 var repoType = data['repo_type'];
621 var repoName = data['text'];
624 var repoName = data['text'];
622
625
623 if(data && data.type == 'repo'){
626 if(data && data.type == 'repo'){
624 if(repoType === 'hg'){
627 if(repoType === 'hg'){
625 tmpl += '<i class="icon-hg"></i> ';
628 tmpl += '<i class="icon-hg"></i> ';
626 }
629 }
627 else if(repoType === 'git'){
630 else if(repoType === 'git'){
628 tmpl += '<i class="icon-git"></i> ';
631 tmpl += '<i class="icon-git"></i> ';
629 }
632 }
630 else if(repoType === 'svn'){
633 else if(repoType === 'svn'){
631 tmpl += '<i class="icon-svn"></i> ';
634 tmpl += '<i class="icon-svn"></i> ';
632 }
635 }
633 if(data['private']){
636 if(data['private']){
634 tmpl += '<i class="icon-lock" ></i> ';
637 tmpl += '<i class="icon-lock" ></i> ';
635 }
638 }
636 else if(visualShowPublicIcon){
639 else if(visualShowPublicIcon){
637 tmpl += '<i class="icon-unlock-alt"></i> ';
640 tmpl += '<i class="icon-unlock-alt"></i> ';
638 }
641 }
639 }
642 }
640 tmpl += escapeMarkup(repoName);
643 tmpl += escapeMarkup(repoName);
641 return tmpl;
644 return tmpl;
642
645
643 }(result, escapeMarkup);
646 }(result, escapeMarkup);
644 };
647 };
645
648
646 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
649 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
647 return function(data, escapeMarkup) {
650 return function(data, escapeMarkup) {
648 if (!data.repo_group_id){
651 if (!data.repo_group_id){
649 return data.text; // optgroup text Repositories
652 return data.text; // optgroup text Repositories
650 }
653 }
651
654
652 var tmpl = '';
655 var tmpl = '';
653 var repoGroupName = data['text'];
656 var repoGroupName = data['text'];
654
657
655 if(data){
658 if(data){
656
659
657 tmpl += '<i class="icon-folder-close"></i> ';
660 tmpl += '<i class="icon-folder-close"></i> ';
658
661
659 }
662 }
660 tmpl += escapeMarkup(repoGroupName);
663 tmpl += escapeMarkup(repoGroupName);
661 return tmpl;
664 return tmpl;
662
665
663 }(result, escapeMarkup);
666 }(result, escapeMarkup);
664 };
667 };
665
668
666 var escapeRegExChars = function (value) {
669 var escapeRegExChars = function (value) {
667 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
670 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
668 };
671 };
669
672
670 var getRepoIcon = function(repo_type) {
673 var getRepoIcon = function(repo_type) {
671 if (repo_type === 'hg') {
674 if (repo_type === 'hg') {
672 return '<i class="icon-hg"></i> ';
675 return '<i class="icon-hg"></i> ';
673 }
676 }
674 else if (repo_type === 'git') {
677 else if (repo_type === 'git') {
675 return '<i class="icon-git"></i> ';
678 return '<i class="icon-git"></i> ';
676 }
679 }
677 else if (repo_type === 'svn') {
680 else if (repo_type === 'svn') {
678 return '<i class="icon-svn"></i> ';
681 return '<i class="icon-svn"></i> ';
679 }
682 }
680 return ''
683 return ''
681 };
684 };
682
685
683 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
686 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
684
687
685 if (value.split(':').length === 2) {
688 if (value.split(':').length === 2) {
686 value = value.split(':')[1]
689 value = value.split(':')[1]
687 }
690 }
688
691
689 var searchType = data['type'];
692 var searchType = data['type'];
690 var valueDisplay = data['value_display'];
693 var valueDisplay = data['value_display'];
691
694
692 var pattern = '(' + escapeRegExChars(value) + ')';
695 var pattern = '(' + escapeRegExChars(value) + ')';
693
696
694 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
697 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
695
698
696 // highlight match
699 // highlight match
697 if (searchType != 'text') {
700 if (searchType != 'text') {
698 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
701 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
699 }
702 }
700
703
701 var icon = '';
704 var icon = '';
702
705
703 if (searchType === 'hint') {
706 if (searchType === 'hint') {
704 icon += '<i class="icon-folder-close"></i> ';
707 icon += '<i class="icon-folder-close"></i> ';
705 }
708 }
706 // full text search
709 // full text search
707 else if (searchType === 'search') {
710 else if (searchType === 'search') {
708 icon += '<i class="icon-more"></i> ';
711 icon += '<i class="icon-more"></i> ';
709 }
712 }
710 // repository
713 // repository
711 else if (searchType === 'repo') {
714 else if (searchType === 'repo') {
712
715
713 var repoIcon = getRepoIcon(data['repo_type']);
716 var repoIcon = getRepoIcon(data['repo_type']);
714 icon += repoIcon;
717 icon += repoIcon;
715
718
716 if (data['private']) {
719 if (data['private']) {
717 icon += '<i class="icon-lock" ></i> ';
720 icon += '<i class="icon-lock" ></i> ';
718 }
721 }
719 else if (visualShowPublicIcon) {
722 else if (visualShowPublicIcon) {
720 icon += '<i class="icon-unlock-alt"></i> ';
723 icon += '<i class="icon-unlock-alt"></i> ';
721 }
724 }
722 }
725 }
723 // repository groups
726 // repository groups
724 else if (searchType === 'repo_group') {
727 else if (searchType === 'repo_group') {
725 icon += '<i class="icon-folder-close"></i> ';
728 icon += '<i class="icon-folder-close"></i> ';
726 }
729 }
727 // user group
730 // user group
728 else if (searchType === 'user_group') {
731 else if (searchType === 'user_group') {
729 icon += '<i class="icon-group"></i> ';
732 icon += '<i class="icon-group"></i> ';
730 }
733 }
731 // user
734 // user
732 else if (searchType === 'user') {
735 else if (searchType === 'user') {
733 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
736 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
734 }
737 }
735 // commit
738 // commit
736 else if (searchType === 'commit') {
739 else if (searchType === 'commit') {
737 var repo_data = data['repo_data'];
740 var repo_data = data['repo_data'];
738 var repoIcon = getRepoIcon(repo_data['repository_type']);
741 var repoIcon = getRepoIcon(repo_data['repository_type']);
739 if (repoIcon) {
742 if (repoIcon) {
740 icon += repoIcon;
743 icon += repoIcon;
741 } else {
744 } else {
742 icon += '<i class="icon-tag"></i>';
745 icon += '<i class="icon-tag"></i>';
743 }
746 }
744 }
747 }
745 // file
748 // file
746 else if (searchType === 'file') {
749 else if (searchType === 'file') {
747 var repo_data = data['repo_data'];
750 var repo_data = data['repo_data'];
748 var repoIcon = getRepoIcon(repo_data['repository_type']);
751 var repoIcon = getRepoIcon(repo_data['repository_type']);
749 if (repoIcon) {
752 if (repoIcon) {
750 icon += repoIcon;
753 icon += repoIcon;
751 } else {
754 } else {
752 icon += '<i class="icon-tag"></i>';
755 icon += '<i class="icon-tag"></i>';
753 }
756 }
754 }
757 }
755 // generic text
758 // generic text
756 else if (searchType === 'text') {
759 else if (searchType === 'text') {
757 icon = '';
760 icon = '';
758 }
761 }
759
762
760 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
763 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
761 return tmpl.format(icon, valueDisplay);
764 return tmpl.format(icon, valueDisplay);
762 };
765 };
763
766
764 var handleSelect = function(element, suggestion) {
767 var handleSelect = function(element, suggestion) {
765 if (suggestion.type === "hint") {
768 if (suggestion.type === "hint") {
766 // we skip action
769 // we skip action
767 $('#main_filter').focus();
770 $('#main_filter').focus();
768 }
771 }
769 else if (suggestion.type === "text") {
772 else if (suggestion.type === "text") {
770 // we skip action
773 // we skip action
771 $('#main_filter').focus();
774 $('#main_filter').focus();
772
775
773 } else {
776 } else {
774 window.location = suggestion['url'];
777 window.location = suggestion['url'];
775 }
778 }
776 };
779 };
777
780
778 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
781 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
779 if (queryLowerCase.split(':').length === 2) {
782 if (queryLowerCase.split(':').length === 2) {
780 queryLowerCase = queryLowerCase.split(':')[1]
783 queryLowerCase = queryLowerCase.split(':')[1]
781 }
784 }
782 if (suggestion.type === "text") {
785 if (suggestion.type === "text") {
783 // special case we don't want to "skip" display for
786 // special case we don't want to "skip" display for
784 return true
787 return true
785 }
788 }
786 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
789 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
787 };
790 };
788
791
789 var cleanContext = {
792 var cleanContext = {
790 repo_view_type: null,
793 repo_view_type: null,
791
794
792 repo_id: null,
795 repo_id: null,
793 repo_name: "",
796 repo_name: "",
794
797
795 repo_group_id: null,
798 repo_group_id: null,
796 repo_group_name: null
799 repo_group_name: null
797 };
800 };
798 var removeGoToFilter = function () {
801 var removeGoToFilter = function () {
799 $('.searchTagHidable').hide();
802 $('.searchTagHidable').hide();
800 $('#main_filter').autocomplete(
803 $('#main_filter').autocomplete(
801 'setOptions', {params:{search_context: cleanContext}});
804 'setOptions', {params:{search_context: cleanContext}});
802 };
805 };
803
806
804 $('#main_filter').autocomplete({
807 $('#main_filter').autocomplete({
805 serviceUrl: pyroutes.url('goto_switcher_data'),
808 serviceUrl: pyroutes.url('goto_switcher_data'),
806 params: {
809 params: {
807 "search_context": templateContext.search_context
810 "search_context": templateContext.search_context
808 },
811 },
809 minChars:2,
812 minChars:2,
810 maxHeight:400,
813 maxHeight:400,
811 deferRequestBy: 300, //miliseconds
814 deferRequestBy: 300, //miliseconds
812 tabDisabled: true,
815 tabDisabled: true,
813 autoSelectFirst: false,
816 autoSelectFirst: false,
814 formatResult: autocompleteMainFilterFormatResult,
817 formatResult: autocompleteMainFilterFormatResult,
815 lookupFilter: autocompleteMainFilterResult,
818 lookupFilter: autocompleteMainFilterResult,
816 onSelect: function (element, suggestion) {
819 onSelect: function (element, suggestion) {
817 handleSelect(element, suggestion);
820 handleSelect(element, suggestion);
818 return false;
821 return false;
819 },
822 },
820 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
823 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
821 if (jqXHR !== 'abort') {
824 if (jqXHR !== 'abort') {
822 alert("Error during search.\nError code: {0}".format(textStatus));
825 alert("Error during search.\nError code: {0}".format(textStatus));
823 window.location = '';
826 window.location = '';
824 }
827 }
825 }
828 }
826 });
829 });
827
830
828 showMainFilterBox = function () {
831 showMainFilterBox = function () {
829 $('#main_filter_help').toggle();
832 $('#main_filter_help').toggle();
830 };
833 };
831
834
832 $('#main_filter').on('keydown.autocomplete', function (e) {
835 $('#main_filter').on('keydown.autocomplete', function (e) {
833
836
834 var BACKSPACE = 8;
837 var BACKSPACE = 8;
835 var el = $(e.currentTarget);
838 var el = $(e.currentTarget);
836 if(e.which === BACKSPACE){
839 if(e.which === BACKSPACE){
837 var inputVal = el.val();
840 var inputVal = el.val();
838 if (inputVal === ""){
841 if (inputVal === ""){
839 removeGoToFilter()
842 removeGoToFilter()
840 }
843 }
841 }
844 }
842 });
845 });
843
846
844 </script>
847 </script>
845 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
848 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
846 </%def>
849 </%def>
847
850
848 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
851 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
849 <div class="modal-dialog">
852 <div class="modal-dialog">
850 <div class="modal-content">
853 <div class="modal-content">
851 <div class="modal-header">
854 <div class="modal-header">
852 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
855 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
853 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
856 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
854 </div>
857 </div>
855 <div class="modal-body">
858 <div class="modal-body">
856 <div class="block-left">
859 <div class="block-left">
857 <table class="keyboard-mappings">
860 <table class="keyboard-mappings">
858 <tbody>
861 <tbody>
859 <tr>
862 <tr>
860 <th></th>
863 <th></th>
861 <th>${_('Site-wide shortcuts')}</th>
864 <th>${_('Site-wide shortcuts')}</th>
862 </tr>
865 </tr>
863 <%
866 <%
864 elems = [
867 elems = [
865 ('/', 'Use quick search box'),
868 ('/', 'Use quick search box'),
866 ('g h', 'Goto home page'),
869 ('g h', 'Goto home page'),
867 ('g g', 'Goto my private gists page'),
870 ('g g', 'Goto my private gists page'),
868 ('g G', 'Goto my public gists page'),
871 ('g G', 'Goto my public gists page'),
869 ('g 0-9', 'Goto bookmarked items from 0-9'),
872 ('g 0-9', 'Goto bookmarked items from 0-9'),
870 ('n r', 'New repository page'),
873 ('n r', 'New repository page'),
871 ('n g', 'New gist page'),
874 ('n g', 'New gist page'),
872 ]
875 ]
873 %>
876 %>
874 %for key, desc in elems:
877 %for key, desc in elems:
875 <tr>
878 <tr>
876 <td class="keys">
879 <td class="keys">
877 <span class="key tag">${key}</span>
880 <span class="key tag">${key}</span>
878 </td>
881 </td>
879 <td>${desc}</td>
882 <td>${desc}</td>
880 </tr>
883 </tr>
881 %endfor
884 %endfor
882 </tbody>
885 </tbody>
883 </table>
886 </table>
884 </div>
887 </div>
885 <div class="block-left">
888 <div class="block-left">
886 <table class="keyboard-mappings">
889 <table class="keyboard-mappings">
887 <tbody>
890 <tbody>
888 <tr>
891 <tr>
889 <th></th>
892 <th></th>
890 <th>${_('Repositories')}</th>
893 <th>${_('Repositories')}</th>
891 </tr>
894 </tr>
892 <%
895 <%
893 elems = [
896 elems = [
894 ('g s', 'Goto summary page'),
897 ('g s', 'Goto summary page'),
895 ('g c', 'Goto changelog page'),
898 ('g c', 'Goto changelog page'),
896 ('g f', 'Goto files page'),
899 ('g f', 'Goto files page'),
897 ('g F', 'Goto files page with file search activated'),
900 ('g F', 'Goto files page with file search activated'),
898 ('g p', 'Goto pull requests page'),
901 ('g p', 'Goto pull requests page'),
899 ('g o', 'Goto repository settings'),
902 ('g o', 'Goto repository settings'),
900 ('g O', 'Goto repository permissions settings'),
903 ('g O', 'Goto repository permissions settings'),
901 ]
904 ]
902 %>
905 %>
903 %for key, desc in elems:
906 %for key, desc in elems:
904 <tr>
907 <tr>
905 <td class="keys">
908 <td class="keys">
906 <span class="key tag">${key}</span>
909 <span class="key tag">${key}</span>
907 </td>
910 </td>
908 <td>${desc}</td>
911 <td>${desc}</td>
909 </tr>
912 </tr>
910 %endfor
913 %endfor
911 </tbody>
914 </tbody>
912 </table>
915 </table>
913 </div>
916 </div>
914 </div>
917 </div>
915 <div class="modal-footer">
918 <div class="modal-footer">
916 </div>
919 </div>
917 </div><!-- /.modal-content -->
920 </div><!-- /.modal-content -->
918 </div><!-- /.modal-dialog -->
921 </div><!-- /.modal-dialog -->
919 </div><!-- /.modal -->
922 </div><!-- /.modal -->
920
923
General Comments 0
You need to be logged in to leave comments. Login now