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