##// END OF EJS Templates
auth: fixed missing upper context navigation in plugin view
marcink -
r3584:ed59d605 new-ui
parent child Browse files
Show More
@@ -1,127 +1,127 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="menu_bar_subnav()">
22 22 ${self.admin_menu(active='authentication')}
23 23 </%def>
24 24
25 25 <%def name="main()">
26 26
27 27 <div class="box">
28 28
29 29 <div class='sidebar-col-wrapper'>
30 30
31 31 <div class="sidebar">
32 32 <ul class="nav nav-pills nav-stacked">
33 33 % for item in resource.get_root().get_nav_list():
34 <li ${'class=active' if item == resource else ''}>
34 <li ${('class=active' if item == resource else '')}>
35 35 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
36 36 </li>
37 37 % endfor
38 38 </ul>
39 39 </div>
40 40
41 41 <div class="main-content-full-width">
42 42 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
43 43 <div class="panel panel-default">
44 44
45 45 <div class="panel-heading">
46 46 <h3 class="panel-title">${_("Enabled and Available Plugins")}</h3>
47 47 </div>
48 48
49 49 <div class="panel-body">
50 50
51 51
52 52 <div class="label">${_("Ordered Activated Plugins")}</div>
53 53 <div class="textarea text-area editor">
54 54 ${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")}
55 55 </div>
56 56 <div class="field">
57 57 <p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
58 58 '\nThe order of the plugins is also the order in which '
59 59 'RhodeCode Enterprise will try to authenticate a user.')}
60 60 </p>
61 61 </div>
62 62
63 63 <table class="rctable">
64 64 <th>${_('Activate')}</th>
65 65 <th>${_('Plugin Name')}</th>
66 66 <th>${_('Documentation')}</th>
67 67 <th>${_('Plugin ID')}</th>
68 68 <th>${_('Enabled')}</th>
69 69 %for plugin in available_plugins:
70 <tr class="${'inactive' if (not plugin.is_active() and plugin.get_id() in enabled_plugins) else ''}">
70 <tr class="${('inactive' if (not plugin.is_active() and plugin.get_id() in enabled_plugins) else '')}">
71 71 <td>
72 <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}">
73 ${_('activated') if plugin.get_id() in enabled_plugins else _('not active')}
72 <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${('btn-success' if plugin.get_id() in enabled_plugins else '')}">
73 ${(_('activated') if plugin.get_id() in enabled_plugins else _('not active'))}
74 74 </span>
75 75 </td>
76 76 <td>${plugin.get_display_name()}</td>
77 77 <td>
78 78 % if plugin.docs():
79 79 <a href="${plugin.docs()}">docs</a>
80 80 % endif
81 81 </td>
82 82 <td>${plugin.get_id()}</td>
83 83 <td>${h.bool2icon(plugin.is_active(),show_at_false=False)}</td>
84 84 </tr>
85 85 %endfor
86 86 </table>
87 87
88 88 <div class="buttons">
89 89 ${h.submit('save',_('Save'),class_="btn")}
90 90 </div>
91 91 </div>
92 92 </div>
93 93 ${h.end_form()}
94 94 </div>
95 95 </div>
96 96 </div>
97 97
98 98 <script>
99 99 $('.toggle-plugin').click(function(e){
100 100 var auth_plugins_input = $('#auth_plugins');
101 101 var elems = [];
102 102
103 103 $.each(auth_plugins_input.val().split(',') , function (index, element) {
104 104 if (element !== "") {
105 105 elems.push(element.strip())
106 106 }
107 107 });
108 108
109 109 var cur_button = e.currentTarget;
110 110 var plugin_id = $(cur_button).attr('plugin_id');
111 111 if($(cur_button).hasClass('btn-success')){
112 112 elems.splice(elems.indexOf(plugin_id), 1);
113 113 auth_plugins_input.val(elems.join(',\n'));
114 114 $(cur_button).removeClass('btn-success');
115 115 cur_button.innerHTML = _gettext('not active');
116 116 }
117 117 else{
118 118 if (elems.indexOf(plugin_id) === -1) {
119 119 elems.push(plugin_id);
120 120 }
121 121 auth_plugins_input.val(elems.join(',\n'));
122 122 $(cur_button).addClass('btn-success');
123 123 cur_button.innerHTML = _gettext('activated');
124 124 }
125 125 });
126 126 </script>
127 127 </%def>
@@ -1,134 +1,135 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 ${h.link_to(_('Authentication Plugins'),request.resource_path(resource.__parent__, route_name='auth_home'))}
15 15 &raquo;
16 16 ${resource.display_name}
17 17 </%def>
18 18
19 19 <%def name="menu_bar_nav()">
20 20 ${self.menu_items(active='admin')}
21 21 </%def>
22 22
23 <%def name="menu_bar_subnav()">
24 ${self.admin_menu(active='authentication')}
25 </%def>
26
23 27 <%def name="main()">
28
24 29 <div class="box">
25 <div class="title">
26 ${self.breadcrumbs()}
27 </div>
30
28 31 <div class='sidebar-col-wrapper'>
29 32
30 ## TODO: This is repeated in the auth root template and should be merged
31 ## into a single solution.
32 33 <div class="sidebar">
33 34 <ul class="nav nav-pills nav-stacked">
34 35 % for item in resource.get_root().get_nav_list():
35 <li ${'class=active' if item == resource else ''}>
36 <li ${('class=active' if item == resource else '')}>
36 37 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
37 38 </li>
38 39 % endfor
39 40 </ul>
40 41 </div>
41 42
42 43 <div class="main-content-full-width">
43 44 <div class="panel panel-default">
44 45 <div class="panel-heading">
45 46 <h3 class="panel-title">${_('Plugin')}: ${resource.display_name}</h3>
46 47 </div>
47 48 <div class="panel-body">
48 49 <div class="plugin_form">
49 50 <div class="fields">
50 51 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
51 52 <div class="form">
52 53
53 54 %for node in plugin.get_settings_schema():
54 55 <%
55 56 label_to_type = {'label-checkbox': 'bool', 'label-textarea': 'textarea'}
56 57 %>
57 58
58 59 <div class="field">
59 60 <div class="label ${label_to_type.get(node.widget)}"><label for="${node.name}">${node.title}</label></div>
60 61 <div class="input">
61 62 %if node.widget in ["string", "int", "unicode"]:
62 63 ${h.text(node.name, defaults.get(node.name), class_="large")}
63 64 %elif node.widget == "password":
64 65 ${h.password(node.name, defaults.get(node.name), class_="large")}
65 66 %elif node.widget == "bool":
66 67 <div class="checkbox">${h.checkbox(node.name, True, checked=defaults.get(node.name))}</div>
67 68 %elif node.widget == "select":
68 69 ${h.select(node.name, defaults.get(node.name), node.validator.choices, class_="select2AuthSetting")}
69 70 %elif node.widget == "select_with_labels":
70 71 ${h.select(node.name, defaults.get(node.name), node.choices, class_="select2AuthSetting")}
71 72 %elif node.widget == "textarea":
72 73 <div class="textarea" style="margin-left: 0px">${h.textarea(node.name, defaults.get(node.name), rows=10)}</div>
73 74 %elif node.widget == "readonly":
74 75 ${node.default}
75 76 %else:
76 77 This field is of type ${node.typ}, which cannot be displayed. Must be one of [string|int|bool|select].
77 78 %endif
78 79
79 80 %if node.name in errors:
80 81 <span class="error-message">${errors.get(node.name)}</span>
81 82 <br />
82 83 %endif
83 84 <p class="help-block pre-formatting">${node.description}</p>
84 85 </div>
85 86 </div>
86 87 %endfor
87 88
88 89 ## Allow derived templates to add something below the form
89 90 ## input fields
90 91 %if hasattr(next, 'below_form_fields'):
91 92 ${next.below_form_fields()}
92 93 %endif
93 94
94 95 <div class="buttons">
95 96 ${h.submit('save',_('Save'),class_="btn")}
96 97 </div>
97 98
98 99 </div>
99 100 ${h.end_form()}
100 101 </div>
101 102 </div>
102 103
103 104 % if request.GET.get('schema'):
104 105 ## this is for development and creation of example configurations for documentation
105 106 <pre>
106 107 % for node in plugin.get_settings_schema():
107 108 *option*: `${node.name}` => `${defaults.get(node.name)}`${'\n # '.join(['']+node.description.splitlines())}
108 109
109 110 % endfor
110 111 </pre>
111 112
112 113 % endif
113 114
114 115 </div>
115 116 </div>
116 117 </div>
117 118
118 119 </div>
119 120 </div>
120 121
121 122
122 123 <script>
123 124 $(document).ready(function() {
124 125 var select2Options = {
125 126 containerCssClass: 'drop-menu',
126 127 dropdownCssClass: 'drop-menu-dropdown',
127 128 dropdownAutoWidth: true,
128 129 minimumResultsForSearch: -1
129 130 };
130 131 $('.select2AuthSetting').select2(select2Options);
131 132
132 133 });
133 134 </script>
134 135 </%def>
General Comments 0
You need to be logged in to leave comments. Login now