##// END OF EJS Templates
ui: start of new UI branch
Liviu -
r3559:6722aa27 new-ui
parent child Browse files
Show More
@@ -1,815 +1,820 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
230 <div class="title">
231 ${self.repo_page_title(c.rhodecode_db_repo)}
232 </div>
233
229 <ul id="context-pages" class="navigation horizontal-list">
234 <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>
235 <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>
236 <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>
237 <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>
238 <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>
239 <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
240
236 ## TODO: anderson: ideally it would have a function on the scm_instance "enable_pullrequest() and enable_fork()"
241 ## 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']:
242 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
238 <li class="${is_active('showpullrequest')}">
243 <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)}">
244 <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:
245 %if c.repository_pull_requests:
241 <span class="pr_notifications">${c.repository_pull_requests}</span>
246 <span class="pr_notifications">${c.repository_pull_requests}</span>
242 %endif
247 %endif
243 <div class="menulabel">${_('Pull Requests')}</div>
248 <div class="menulabel">${_('Pull Requests')}</div>
244 </a>
249 </a>
245 </li>
250 </li>
246 %endif
251 %endif
247
252
248 <li class="${is_active('options')}">
253 <li class="${is_active('options')}">
249 <a class="menulink dropdown">
254 <a class="menulink dropdown">
250 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
255 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
251 </a>
256 </a>
252 <ul class="submenu">
257 <ul class="submenu">
253 %if h.HasRepoPermissionAll('repository.admin')(c.repo_name):
258 %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>
259 <li><a href="${h.route_path('edit_repo',repo_name=c.repo_name)}">${_('Repository Settings')}</a></li>
255 %endif
260 %endif
256 %if c.rhodecode_db_repo.fork:
261 %if c.rhodecode_db_repo.fork:
257 <li>
262 <li>
258 <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
263 <a title="${h.tooltip(_('Compare fork with %s' % c.rhodecode_db_repo.fork.repo_name))}"
259 href="${h.route_path('repo_compare',
264 href="${h.route_path('repo_compare',
260 repo_name=c.rhodecode_db_repo.fork.repo_name,
265 repo_name=c.rhodecode_db_repo.fork.repo_name,
261 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
266 source_ref_type=c.rhodecode_db_repo.landing_rev[0],
262 source_ref=c.rhodecode_db_repo.landing_rev[1],
267 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],
268 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],
269 target_ref=request.GET.get('branch') or c.rhodecode_db_repo.landing_rev[1],
265 _query=dict(merge=1))}"
270 _query=dict(merge=1))}"
266 >
271 >
267 ${_('Compare fork')}
272 ${_('Compare fork')}
268 </a>
273 </a>
269 </li>
274 </li>
270 %endif
275 %endif
271
276
272 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name) and c.rhodecode_db_repo.enable_locking:
277 %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]:
278 %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>
279 <li><a class="locking_del" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Unlock')}</a></li>
275 %else:
280 %else:
276 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li>
281 <li><a class="locking_add" href="${h.route_path('repo_edit_toggle_locking',repo_name=c.repo_name)}">${_('Lock')}</a></li>
277 %endif
282 %endif
278 %endif
283 %endif
279 %if c.rhodecode_user.username != h.DEFAULT_USER:
284 %if c.rhodecode_user.username != h.DEFAULT_USER:
280 %if c.rhodecode_db_repo.repo_type in ['git','hg']:
285 %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>
286 <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>
287 <li><a href="${h.route_path('pullrequest_new',repo_name=c.repo_name)}">${_('Create Pull Request')}</a></li>
283 %endif
288 %endif
284 %endif
289 %endif
285 </ul>
290 </ul>
286 </li>
291 </li>
287 </ul>
292 </ul>
288 </div>
293 </div>
289 <div class="clear"></div>
294 <div class="clear"></div>
290 </div>
295 </div>
291 % if c.rhodecode_db_repo.archived:
296 % if c.rhodecode_db_repo.archived:
292 <div class="alert alert-warning text-center">
297 <div class="alert alert-warning text-center">
293 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
298 <strong>${_('This repository has been archived. It is now read-only.')}</strong>
294 </div>
299 </div>
295 % endif
300 % endif
296 <!--- END CONTEXT BAR -->
301 <!--- END CONTEXT BAR -->
297
302
298 </%def>
303 </%def>
299
304
300 <%def name="repo_group_page_title(repo_group_instance)">
305 <%def name="repo_group_page_title(repo_group_instance)">
301 <div class="title-content">
306 <div class="title-content">
302 <div class="title-main">
307 <div class="title-main">
303 ## Repository Group icon
308 ## Repository Group icon
304 <i class="icon-folder-close"></i>
309 <i class="icon-folder-close"></i>
305
310
306 ## repo name with group name
311 ## repo name with group name
307 ${h.breadcrumb_repo_group_link(repo_group_instance)}
312 ${h.breadcrumb_repo_group_link(repo_group_instance)}
308 </div>
313 </div>
309
314
310 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
315 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
311 <div class="repo-group-desc">
316 <div class="repo-group-desc">
312 ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)}
317 ${dt.repo_group_desc(repo_group_instance.description_safe, repo_group_instance.personal, c.visual.stylify_metatags)}
313 </div>
318 </div>
314
319
315 </div>
320 </div>
316 </%def>
321 </%def>
317
322
318 <%def name="repo_group_menu(active=None)">
323 <%def name="repo_group_menu(active=None)">
319 <%
324 <%
320 def is_active(selected):
325 def is_active(selected):
321 if selected == active:
326 if selected == active:
322 return "active"
327 return "active"
323
328
324 is_admin = h.HasPermissionAny('hg.admin')('can create repos index page')
329 is_admin = h.HasPermissionAny('hg.admin')('can create repos index page')
325
330
326 gr_name = c.repo_group.group_name if c.repo_group else None
331 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
332 # create repositories with write permission on group is set to true
328 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
333 create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')()
329 group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page')
334 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')
335 group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page')
331
336
332 %>
337 %>
333
338
334 <!--- CONTEXT BAR -->
339 <!--- CONTEXT BAR -->
335 <div id="context-bar">
340 <div id="context-bar">
336 <div class="wrapper">
341 <div class="wrapper">
337 <ul id="context-pages" class="navigation horizontal-list">
342 <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>
343 <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>
344 <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
345
341 <li class="${is_active('options')}">
346 <li class="${is_active('options')}">
342 <a class="menulink dropdown">
347 <a class="menulink dropdown">
343 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
348 <div class="menulabel">${_('Options')} <div class="show_more"></div></div>
344 </a>
349 </a>
345 <ul class="submenu">
350 <ul class="submenu">
346 %if is_admin or group_admin:
351 %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>
352 <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
353 %endif
349 %if is_admin or group_admin or (group_write and create_on_write):
354 %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>
355 <li><a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}">${_('Add Repository')}</a></li>
351 %endif
356 %endif
352 %if is_admin or group_admin:
357 %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>
358 <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
359 %endif
355 </ul>
360 </ul>
356 </li>
361 </li>
357 </ul>
362 </ul>
358 </div>
363 </div>
359 <div class="clear"></div>
364 <div class="clear"></div>
360 </div>
365 </div>
361
366
362 <!--- END CONTEXT BAR -->
367 <!--- END CONTEXT BAR -->
363
368
364 </%def>
369 </%def>
365
370
366
371
367 <%def name="usermenu(active=False)">
372 <%def name="usermenu(active=False)">
368 ## USER MENU
373 ## USER MENU
369 <li id="quick_login_li" class="${'active' if active else ''}">
374 <li id="quick_login_li" class="${'active' if active else ''}">
370 % if c.rhodecode_user.username == h.DEFAULT_USER:
375 % 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)})}">
376 <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)}
377 ${gravatar(c.rhodecode_user.email, 20)}
373 <span class="user">
378 <span class="user">
374 <span>${_('Sign in')}</span>
379 <span>${_('Sign in')}</span>
375 </span>
380 </span>
376 </a>
381 </a>
377 % else:
382 % else:
378 ## logged in user
383 ## logged in user
379 <a id="quick_login_link" class="menulink childs">
384 <a id="quick_login_link" class="menulink childs">
380 ${gravatar(c.rhodecode_user.email, 20)}
385 ${gravatar(c.rhodecode_user.email, 20)}
381 <span class="user">
386 <span class="user">
382 <span class="menu_link_user">${c.rhodecode_user.username}</span>
387 <span class="menu_link_user">${c.rhodecode_user.username}</span>
383 <div class="show_more"></div>
388 <div class="show_more"></div>
384 </span>
389 </span>
385 </a>
390 </a>
386 ## subnav with menu for logged in user
391 ## subnav with menu for logged in user
387 <div class="user-menu submenu">
392 <div class="user-menu submenu">
388 <div id="quick_login">
393 <div id="quick_login">
389 %if c.rhodecode_user.username != h.DEFAULT_USER:
394 %if c.rhodecode_user.username != h.DEFAULT_USER:
390 <div class="">
395 <div class="">
391 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
396 <div class="big_gravatar">${gravatar(c.rhodecode_user.email, 48)}</div>
392 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
397 <div class="full_name">${c.rhodecode_user.full_name_or_username}</div>
393 <div class="email">${c.rhodecode_user.email}</div>
398 <div class="email">${c.rhodecode_user.email}</div>
394 </div>
399 </div>
395 <div class="">
400 <div class="">
396 <ol class="links">
401 <ol class="links">
397 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
402 <li>${h.link_to(_(u'My account'),h.route_path('my_account_profile'))}</li>
398 % if c.rhodecode_user.personal_repo_group:
403 % 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>
404 <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
405 % endif
401 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
406 <li>${h.link_to(_(u'Pull Requests'), h.route_path('my_account_pullrequests'))}</li>
402 ## bookmark-items
407 ## bookmark-items
403 <li class="bookmark-items">
408 <li class="bookmark-items">
404 ${_('Bookmarks')}
409 ${_('Bookmarks')}
405 <div class="pull-right">
410 <div class="pull-right">
406 <a href="${h.route_path('my_account_bookmarks')}">${_('Manage')}</a>
411 <a href="${h.route_path('my_account_bookmarks')}">${_('Manage')}</a>
407 </div>
412 </div>
408 </li>
413 </li>
409 % if not c.bookmark_items:
414 % if not c.bookmark_items:
410 <li>
415 <li>
411 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
416 <a href="${h.route_path('my_account_bookmarks')}">${_('No Bookmarks yet.')}</a>
412 </li>
417 </li>
413 % endif
418 % endif
414 % for item in c.bookmark_items:
419 % for item in c.bookmark_items:
415 <li>
420 <li>
416 % if item.repository:
421 % if item.repository:
417 <div>
422 <div>
418 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
423 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
419 <code>${item.position}</code>
424 <code>${item.position}</code>
420 % if item.repository.repo_type == 'hg':
425 % if item.repository.repo_type == 'hg':
421 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
426 <i class="icon-hg" title="${_('Repository')}" style="font-size: 16px"></i>
422 % elif item.repository.repo_type == 'git':
427 % elif item.repository.repo_type == 'git':
423 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
428 <i class="icon-git" title="${_('Repository')}" style="font-size: 16px"></i>
424 % elif item.repository.repo_type == 'svn':
429 % elif item.repository.repo_type == 'svn':
425 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
430 <i class="icon-svn" title="${_('Repository')}" style="font-size: 16px"></i>
426 % endif
431 % endif
427 ${(item.title or h.shorter(item.repository.repo_name, 30))}
432 ${(item.title or h.shorter(item.repository.repo_name, 30))}
428 </a>
433 </a>
429 </div>
434 </div>
430 % elif item.repository_group:
435 % elif item.repository_group:
431 <div>
436 <div>
432 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
437 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
433 <code>${item.position}</code>
438 <code>${item.position}</code>
434 <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i>
439 <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))}
440 ${(item.title or h.shorter(item.repository_group.group_name, 30))}
436 </a>
441 </a>
437 </div>
442 </div>
438 % else:
443 % else:
439 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
444 <a class="bookmark-item" href="${h.route_path('my_account_goto_bookmark', bookmark_id=item.position)}">
440 <code>${item.position}</code>
445 <code>${item.position}</code>
441 ${item.title}
446 ${item.title}
442 </a>
447 </a>
443 % endif
448 % endif
444 </li>
449 </li>
445 % endfor
450 % endfor
446
451
447 <li class="logout">
452 <li class="logout">
448 ${h.secure_form(h.route_path('logout'), request=request)}
453 ${h.secure_form(h.route_path('logout'), request=request)}
449 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
454 ${h.submit('log_out', _(u'Sign Out'),class_="btn btn-primary")}
450 ${h.end_form()}
455 ${h.end_form()}
451 </li>
456 </li>
452 </ol>
457 </ol>
453 </div>
458 </div>
454 %endif
459 %endif
455 </div>
460 </div>
456 </div>
461 </div>
457 ## unread counter
462 ## unread counter
458 <div class="pill_container">
463 <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>
464 <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>
465 </div>
461 % endif
466 % endif
462 </li>
467 </li>
463 </%def>
468 </%def>
464
469
465 <%def name="menu_items(active=None)">
470 <%def name="menu_items(active=None)">
466 <%
471 <%
467 def is_active(selected):
472 def is_active(selected):
468 if selected == active:
473 if selected == active:
469 return "active"
474 return "active"
470 return ""
475 return ""
471 %>
476 %>
472
477
473 <ul id="quick" class="main_nav navigation horizontal-list">
478 <ul id="quick" class="main_nav navigation horizontal-list">
474 ## notice box for important system messages
479 ## notice box for important system messages
475 <li style="display: none">
480 <li style="display: none">
476 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
481 <a class="notice-box" href="#openNotice" onclick="showNoticeBox(); return false">
477 <div class="menulabel-notice" >
482 <div class="menulabel-notice" >
478 0
483 0
479 </div>
484 </div>
480 </a>
485 </a>
481 </li>
486 </li>
482
487
483 ## Main filter
488 ## Main filter
484 <li>
489 <li>
485 <div class="menulabel main_filter_box">
490 <div class="menulabel main_filter_box">
486 <div class="main_filter_input_box">
491 <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=""/>
492 <input class="main_filter_input" id="main_filter" size="15" type="text" name="main_filter" placeholder="${_('search / go to...')}" value=""/>
488 </div>
493 </div>
489 <div class="main_filter_help_box">
494 <div class="main_filter_help_box">
490 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
495 <a href="#showFilterHelp" onclick="showMainFilterBox(); return false">?</a>
491 </div>
496 </div>
492 </div>
497 </div>
493
498
494 <div id="main_filter_help" style="display: none">
499 <div id="main_filter_help" style="display: none">
495 - Use '/' key to quickly access this field.
500 - Use '/' key to quickly access this field.
496
501
497 - Enter a name of repository, or repository group for quick search.
502 - Enter a name of repository, or repository group for quick search.
498
503
499 - Prefix query to allow special search:
504 - Prefix query to allow special search:
500
505
501 user:admin, to search for usernames
506 user:admin, to search for usernames
502
507
503 user_group:devops, to search for user groups
508 user_group:devops, to search for user groups
504
509
505 commit:efced4, to search for commits
510 commit:efced4, to search for commits
506 </div>
511 </div>
507 </li>
512 </li>
508
513
509 ## ROOT MENU
514 ## ROOT MENU
510 %if c.rhodecode_user.username != h.DEFAULT_USER:
515 %if c.rhodecode_user.username != h.DEFAULT_USER:
511 <li class="${is_active('journal')}">
516 <li class="${is_active('journal')}">
512 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
517 <a class="menulink" title="${_('Show activity journal')}" href="${h.route_path('journal')}">
513 <div class="menulabel">${_('Journal')}</div>
518 <div class="menulabel">${_('Journal')}</div>
514 </a>
519 </a>
515 </li>
520 </li>
516 %else:
521 %else:
517 <li class="${is_active('journal')}">
522 <li class="${is_active('journal')}">
518 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
523 <a class="menulink" title="${_('Show Public activity journal')}" href="${h.route_path('journal_public')}">
519 <div class="menulabel">${_('Public journal')}</div>
524 <div class="menulabel">${_('Public journal')}</div>
520 </a>
525 </a>
521 </li>
526 </li>
522 %endif
527 %endif
523 <li class="${is_active('gists')}">
528 <li class="${is_active('gists')}">
524 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
529 <a class="menulink childs" title="${_('Show Gists')}" href="${h.route_path('gists_show')}">
525 <div class="menulabel">${_('Gists')}</div>
530 <div class="menulabel">${_('Gists')}</div>
526 </a>
531 </a>
527 </li>
532 </li>
528 <li class="${is_active('search')}">
533 <li class="${is_active('search')}">
529 <a class="menulink" title="${_('Search in repositories you have access to')}" href="${h.route_path('search')}">
534 <a class="menulink" title="${_('Search in repositories you have access to')}" href="${h.route_path('search')}">
530 <div class="menulabel">${_('Search')}</div>
535 <div class="menulabel">${_('Search')}</div>
531 </a>
536 </a>
532 </li>
537 </li>
533 % if h.HasPermissionAll('hg.admin')('access admin main page'):
538 % if h.HasPermissionAll('hg.admin')('access admin main page'):
534 <li class="${is_active('admin')}">
539 <li class="${is_active('admin')}">
535 <a class="menulink childs" title="${_('Admin settings')}" href="#" onclick="return false;">
540 <a class="menulink childs" title="${_('Admin settings')}" href="#" onclick="return false;">
536 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
541 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
537 </a>
542 </a>
538 ${admin_menu()}
543 ${admin_menu()}
539 </li>
544 </li>
540 % elif c.rhodecode_user.repositories_admin or c.rhodecode_user.repository_groups_admin or c.rhodecode_user.user_groups_admin:
545 % 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')}">
546 <li class="${is_active('admin')}">
542 <a class="menulink childs" title="${_('Delegated Admin settings')}">
547 <a class="menulink childs" title="${_('Delegated Admin settings')}">
543 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
548 <div class="menulabel">${_('Admin')} <div class="show_more"></div></div>
544 </a>
549 </a>
545 ${admin_menu_simple(c.rhodecode_user.repositories_admin,
550 ${admin_menu_simple(c.rhodecode_user.repositories_admin,
546 c.rhodecode_user.repository_groups_admin,
551 c.rhodecode_user.repository_groups_admin,
547 c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
552 c.rhodecode_user.user_groups_admin or h.HasPermissionAny('hg.usergroup.create.true')())}
548 </li>
553 </li>
549 % endif
554 % endif
550 ## render extra user menu
555 ## render extra user menu
551 ${usermenu(active=(active=='my_account'))}
556 ${usermenu(active=(active=='my_account'))}
552
557
553 % if c.debug_style:
558 % if c.debug_style:
554 <li>
559 <li>
555 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
560 <a class="menulink" title="${_('Style')}" href="${h.route_path('debug_style_home')}">
556 <div class="menulabel">${_('[Style]')}</div>
561 <div class="menulabel">${_('[Style]')}</div>
557 </a>
562 </a>
558 </li>
563 </li>
559 % endif
564 % endif
560 </ul>
565 </ul>
561
566
562 <script type="text/javascript">
567 <script type="text/javascript">
563 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
568 var visualShowPublicIcon = "${c.visual.show_public_icon}" == "True";
564
569
565 var formatRepoResult = function(result, container, query, escapeMarkup) {
570 var formatRepoResult = function(result, container, query, escapeMarkup) {
566 return function(data, escapeMarkup) {
571 return function(data, escapeMarkup) {
567 if (!data.repo_id){
572 if (!data.repo_id){
568 return data.text; // optgroup text Repositories
573 return data.text; // optgroup text Repositories
569 }
574 }
570
575
571 var tmpl = '';
576 var tmpl = '';
572 var repoType = data['repo_type'];
577 var repoType = data['repo_type'];
573 var repoName = data['text'];
578 var repoName = data['text'];
574
579
575 if(data && data.type == 'repo'){
580 if(data && data.type == 'repo'){
576 if(repoType === 'hg'){
581 if(repoType === 'hg'){
577 tmpl += '<i class="icon-hg"></i> ';
582 tmpl += '<i class="icon-hg"></i> ';
578 }
583 }
579 else if(repoType === 'git'){
584 else if(repoType === 'git'){
580 tmpl += '<i class="icon-git"></i> ';
585 tmpl += '<i class="icon-git"></i> ';
581 }
586 }
582 else if(repoType === 'svn'){
587 else if(repoType === 'svn'){
583 tmpl += '<i class="icon-svn"></i> ';
588 tmpl += '<i class="icon-svn"></i> ';
584 }
589 }
585 if(data['private']){
590 if(data['private']){
586 tmpl += '<i class="icon-lock" ></i> ';
591 tmpl += '<i class="icon-lock" ></i> ';
587 }
592 }
588 else if(visualShowPublicIcon){
593 else if(visualShowPublicIcon){
589 tmpl += '<i class="icon-unlock-alt"></i> ';
594 tmpl += '<i class="icon-unlock-alt"></i> ';
590 }
595 }
591 }
596 }
592 tmpl += escapeMarkup(repoName);
597 tmpl += escapeMarkup(repoName);
593 return tmpl;
598 return tmpl;
594
599
595 }(result, escapeMarkup);
600 }(result, escapeMarkup);
596 };
601 };
597
602
598 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
603 var formatRepoGroupResult = function(result, container, query, escapeMarkup) {
599 return function(data, escapeMarkup) {
604 return function(data, escapeMarkup) {
600 if (!data.repo_group_id){
605 if (!data.repo_group_id){
601 return data.text; // optgroup text Repositories
606 return data.text; // optgroup text Repositories
602 }
607 }
603
608
604 var tmpl = '';
609 var tmpl = '';
605 var repoGroupName = data['text'];
610 var repoGroupName = data['text'];
606
611
607 if(data){
612 if(data){
608
613
609 tmpl += '<i class="icon-folder-close"></i> ';
614 tmpl += '<i class="icon-folder-close"></i> ';
610
615
611 }
616 }
612 tmpl += escapeMarkup(repoGroupName);
617 tmpl += escapeMarkup(repoGroupName);
613 return tmpl;
618 return tmpl;
614
619
615 }(result, escapeMarkup);
620 }(result, escapeMarkup);
616 };
621 };
617
622
618
623
619 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
624 var autocompleteMainFilterFormatResult = function (data, value, org_formatter) {
620
625
621 if (value.split(':').length === 2) {
626 if (value.split(':').length === 2) {
622 value = value.split(':')[1]
627 value = value.split(':')[1]
623 }
628 }
624
629
625 var searchType = data['type'];
630 var searchType = data['type'];
626 var valueDisplay = data['value_display'];
631 var valueDisplay = data['value_display'];
627
632
628 var escapeRegExChars = function (value) {
633 var escapeRegExChars = function (value) {
629 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
634 return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
630 };
635 };
631 var pattern = '(' + escapeRegExChars(value) + ')';
636 var pattern = '(' + escapeRegExChars(value) + ')';
632
637
633 var getRepoIcon = function(repo_type) {
638 var getRepoIcon = function(repo_type) {
634 if (repo_type === 'hg') {
639 if (repo_type === 'hg') {
635 return '<i class="icon-hg"></i> ';
640 return '<i class="icon-hg"></i> ';
636 }
641 }
637 else if (repo_type === 'git') {
642 else if (repo_type === 'git') {
638 return '<i class="icon-git"></i> ';
643 return '<i class="icon-git"></i> ';
639 }
644 }
640 else if (repo_type === 'svn') {
645 else if (repo_type === 'svn') {
641 return '<i class="icon-svn"></i> ';
646 return '<i class="icon-svn"></i> ';
642 }
647 }
643 return ''
648 return ''
644 };
649 };
645
650
646 // highlight match
651 // highlight match
647 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
652 valueDisplay = Select2.util.escapeMarkup(valueDisplay);
648 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
653 valueDisplay = valueDisplay.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
649
654
650 var icon = '';
655 var icon = '';
651
656
652 if (searchType === 'hint') {
657 if (searchType === 'hint') {
653 icon += '<i class="icon-folder-close"></i> ';
658 icon += '<i class="icon-folder-close"></i> ';
654 }
659 }
655 // full text search
660 // full text search
656 else if (searchType === 'search') {
661 else if (searchType === 'search') {
657 icon += '<i class="icon-more"></i> ';
662 icon += '<i class="icon-more"></i> ';
658 }
663 }
659 // repository
664 // repository
660 else if (searchType === 'repo') {
665 else if (searchType === 'repo') {
661
666
662 var repoIcon = getRepoIcon(data['repo_type']);
667 var repoIcon = getRepoIcon(data['repo_type']);
663 icon += repoIcon;
668 icon += repoIcon;
664
669
665 if (data['private']) {
670 if (data['private']) {
666 icon += '<i class="icon-lock" ></i> ';
671 icon += '<i class="icon-lock" ></i> ';
667 }
672 }
668 else if (visualShowPublicIcon) {
673 else if (visualShowPublicIcon) {
669 icon += '<i class="icon-unlock-alt"></i> ';
674 icon += '<i class="icon-unlock-alt"></i> ';
670 }
675 }
671 }
676 }
672 // repository groups
677 // repository groups
673 else if (searchType === 'repo_group') {
678 else if (searchType === 'repo_group') {
674 icon += '<i class="icon-folder-close"></i> ';
679 icon += '<i class="icon-folder-close"></i> ';
675 }
680 }
676 // user group
681 // user group
677 else if (searchType === 'user_group') {
682 else if (searchType === 'user_group') {
678 icon += '<i class="icon-group"></i> ';
683 icon += '<i class="icon-group"></i> ';
679 }
684 }
680 else if (searchType === 'user') {
685 else if (searchType === 'user') {
681 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
686 icon += '<img class="gravatar" src="{0}"/>'.format(data['icon_link']);
682 }
687 }
683 // commit
688 // commit
684 else if (searchType === 'commit') {
689 else if (searchType === 'commit') {
685 var repo_data = data['repo_data'];
690 var repo_data = data['repo_data'];
686 var repoIcon = getRepoIcon(repo_data['repository_type']);
691 var repoIcon = getRepoIcon(repo_data['repository_type']);
687 if (repoIcon) {
692 if (repoIcon) {
688 icon += repoIcon;
693 icon += repoIcon;
689 } else {
694 } else {
690 icon += '<i class="icon-tag"></i>';
695 icon += '<i class="icon-tag"></i>';
691 }
696 }
692 }
697 }
693
698
694 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
699 var tmpl = '<div class="ac-container-wrap">{0}{1}</div>';
695 return tmpl.format(icon, valueDisplay);
700 return tmpl.format(icon, valueDisplay);
696 };
701 };
697
702
698 var handleSelect = function(element, suggestion) {
703 var handleSelect = function(element, suggestion) {
699 if (suggestion.type === "hint") {
704 if (suggestion.type === "hint") {
700 // we skip action
705 // we skip action
701 $('#main_filter').focus();
706 $('#main_filter').focus();
702 } else {
707 } else {
703 window.location = suggestion['url'];
708 window.location = suggestion['url'];
704 }
709 }
705 };
710 };
706 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
711 var autocompleteMainFilterResult = function (suggestion, originalQuery, queryLowerCase) {
707 if (queryLowerCase.split(':').length === 2) {
712 if (queryLowerCase.split(':').length === 2) {
708 queryLowerCase = queryLowerCase.split(':')[1]
713 queryLowerCase = queryLowerCase.split(':')[1]
709 }
714 }
710 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
715 return suggestion.value_display.toLowerCase().indexOf(queryLowerCase) !== -1;
711 };
716 };
712
717
713 $('#main_filter').autocomplete({
718 $('#main_filter').autocomplete({
714 serviceUrl: pyroutes.url('goto_switcher_data'),
719 serviceUrl: pyroutes.url('goto_switcher_data'),
715 params: {"search_context": templateContext.search_context},
720 params: {"search_context": templateContext.search_context},
716 minChars:2,
721 minChars:2,
717 maxHeight:400,
722 maxHeight:400,
718 deferRequestBy: 300, //miliseconds
723 deferRequestBy: 300, //miliseconds
719 tabDisabled: true,
724 tabDisabled: true,
720 autoSelectFirst: true,
725 autoSelectFirst: true,
721 formatResult: autocompleteMainFilterFormatResult,
726 formatResult: autocompleteMainFilterFormatResult,
722 lookupFilter: autocompleteMainFilterResult,
727 lookupFilter: autocompleteMainFilterResult,
723 onSelect: function (element, suggestion) {
728 onSelect: function (element, suggestion) {
724 handleSelect(element, suggestion);
729 handleSelect(element, suggestion);
725 return false;
730 return false;
726 },
731 },
727 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
732 onSearchError: function (element, query, jqXHR, textStatus, errorThrown) {
728 if (jqXHR !== 'abort') {
733 if (jqXHR !== 'abort') {
729 alert("Error during search.\nError code: {0}".format(textStatus));
734 alert("Error during search.\nError code: {0}".format(textStatus));
730 window.location = '';
735 window.location = '';
731 }
736 }
732 }
737 }
733 });
738 });
734
739
735 showMainFilterBox = function () {
740 showMainFilterBox = function () {
736 $('#main_filter_help').toggle();
741 $('#main_filter_help').toggle();
737 };
742 };
738
743
739 </script>
744 </script>
740 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
745 <script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
741 </%def>
746 </%def>
742
747
743 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
748 <div class="modal" id="help_kb" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
744 <div class="modal-dialog">
749 <div class="modal-dialog">
745 <div class="modal-content">
750 <div class="modal-content">
746 <div class="modal-header">
751 <div class="modal-header">
747 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
752 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
748 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
753 <h4 class="modal-title" id="myModalLabel">${_('Keyboard shortcuts')}</h4>
749 </div>
754 </div>
750 <div class="modal-body">
755 <div class="modal-body">
751 <div class="block-left">
756 <div class="block-left">
752 <table class="keyboard-mappings">
757 <table class="keyboard-mappings">
753 <tbody>
758 <tbody>
754 <tr>
759 <tr>
755 <th></th>
760 <th></th>
756 <th>${_('Site-wide shortcuts')}</th>
761 <th>${_('Site-wide shortcuts')}</th>
757 </tr>
762 </tr>
758 <%
763 <%
759 elems = [
764 elems = [
760 ('/', 'Use quick search box'),
765 ('/', 'Use quick search box'),
761 ('g h', 'Goto home page'),
766 ('g h', 'Goto home page'),
762 ('g g', 'Goto my private gists page'),
767 ('g g', 'Goto my private gists page'),
763 ('g G', 'Goto my public gists page'),
768 ('g G', 'Goto my public gists page'),
764 ('g 0-9', 'Goto bookmarked items from 0-9'),
769 ('g 0-9', 'Goto bookmarked items from 0-9'),
765 ('n r', 'New repository page'),
770 ('n r', 'New repository page'),
766 ('n g', 'New gist page'),
771 ('n g', 'New gist page'),
767 ]
772 ]
768 %>
773 %>
769 %for key, desc in elems:
774 %for key, desc in elems:
770 <tr>
775 <tr>
771 <td class="keys">
776 <td class="keys">
772 <span class="key tag">${key}</span>
777 <span class="key tag">${key}</span>
773 </td>
778 </td>
774 <td>${desc}</td>
779 <td>${desc}</td>
775 </tr>
780 </tr>
776 %endfor
781 %endfor
777 </tbody>
782 </tbody>
778 </table>
783 </table>
779 </div>
784 </div>
780 <div class="block-left">
785 <div class="block-left">
781 <table class="keyboard-mappings">
786 <table class="keyboard-mappings">
782 <tbody>
787 <tbody>
783 <tr>
788 <tr>
784 <th></th>
789 <th></th>
785 <th>${_('Repositories')}</th>
790 <th>${_('Repositories')}</th>
786 </tr>
791 </tr>
787 <%
792 <%
788 elems = [
793 elems = [
789 ('g s', 'Goto summary page'),
794 ('g s', 'Goto summary page'),
790 ('g c', 'Goto changelog page'),
795 ('g c', 'Goto changelog page'),
791 ('g f', 'Goto files page'),
796 ('g f', 'Goto files page'),
792 ('g F', 'Goto files page with file search activated'),
797 ('g F', 'Goto files page with file search activated'),
793 ('g p', 'Goto pull requests page'),
798 ('g p', 'Goto pull requests page'),
794 ('g o', 'Goto repository settings'),
799 ('g o', 'Goto repository settings'),
795 ('g O', 'Goto repository permissions settings'),
800 ('g O', 'Goto repository permissions settings'),
796 ]
801 ]
797 %>
802 %>
798 %for key, desc in elems:
803 %for key, desc in elems:
799 <tr>
804 <tr>
800 <td class="keys">
805 <td class="keys">
801 <span class="key tag">${key}</span>
806 <span class="key tag">${key}</span>
802 </td>
807 </td>
803 <td>${desc}</td>
808 <td>${desc}</td>
804 </tr>
809 </tr>
805 %endfor
810 %endfor
806 </tbody>
811 </tbody>
807 </table>
812 </table>
808 </div>
813 </div>
809 </div>
814 </div>
810 <div class="modal-footer">
815 <div class="modal-footer">
811 </div>
816 </div>
812 </div><!-- /.modal-content -->
817 </div><!-- /.modal-content -->
813 </div><!-- /.modal-dialog -->
818 </div><!-- /.modal-dialog -->
814 </div><!-- /.modal -->
819 </div><!-- /.modal -->
815
820
General Comments 0
You need to be logged in to leave comments. Login now