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