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