##// END OF EJS Templates
auth-plugin: show if plugin is activated and enabled in the list....
marcink -
r3269:4a18ba48 default
parent child Browse files
Show More
@@ -1,124 +1,126 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Authentication Settings')}
5 ${_('Authentication Settings')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}}
7 &middot; ${h.branding(c.rhodecode_name)}}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
13 &raquo;
13 &raquo;
14 ${_('Authentication Plugins')}
14 ${_('Authentication Plugins')}
15 </%def>
15 </%def>
16
16
17 <%def name="menu_bar_nav()">
17 <%def name="menu_bar_nav()">
18 ${self.menu_items(active='admin')}
18 ${self.menu_items(active='admin')}
19 </%def>
19 </%def>
20
20
21 <%def name="main()">
21 <%def name="main()">
22
22
23 <div class="box">
23 <div class="box">
24 <div class="title">
24 <div class="title">
25 ${self.breadcrumbs()}
25 ${self.breadcrumbs()}
26 </div>
26 </div>
27
27
28 <div class='sidebar-col-wrapper'>
28 <div class='sidebar-col-wrapper'>
29
29
30 <div class="sidebar">
30 <div class="sidebar">
31 <ul class="nav nav-pills nav-stacked">
31 <ul class="nav nav-pills nav-stacked">
32 % for item in resource.get_root().get_nav_list():
32 % for item in resource.get_root().get_nav_list():
33 <li ${'class=active' if item == resource else ''}>
33 <li ${'class=active' if item == resource else ''}>
34 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
34 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
35 </li>
35 </li>
36 % endfor
36 % endfor
37 </ul>
37 </ul>
38 </div>
38 </div>
39
39
40 <div class="main-content-full-width">
40 <div class="main-content-full-width">
41 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
41 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
42 <div class="panel panel-default">
42 <div class="panel panel-default">
43
43
44 <div class="panel-heading">
44 <div class="panel-heading">
45 <h3 class="panel-title">${_("Enabled and Available Plugins")}</h3>
45 <h3 class="panel-title">${_("Enabled and Available Plugins")}</h3>
46 </div>
46 </div>
47
47
48 <div class="panel-body">
48 <div class="panel-body">
49
49
50
50
51 <div class="label">${_("Ordered Enabled Plugins")}</div>
51 <div class="label">${_("Ordered Activated Plugins")}</div>
52 <div class="textarea text-area editor">
52 <div class="textarea text-area editor">
53 ${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")}
53 ${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")}
54 </div>
54 </div>
55 <div class="field">
55 <div class="field">
56 <p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
56 <p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
57 '\nThe order of the plugins is also the order in which '
57 '\nThe order of the plugins is also the order in which '
58 'RhodeCode Enterprise will try to authenticate a user.')}
58 'RhodeCode Enterprise will try to authenticate a user.')}
59 </p>
59 </p>
60 </div>
60 </div>
61
61
62 <table class="rctable">
62 <table class="rctable">
63 <th>${_('Activate')}</th>
63 <th>${_('Activate')}</th>
64 <th>${_('Plugin Name')}</th>
64 <th>${_('Plugin Name')}</th>
65 <th>${_('Documentation')}</th>
65 <th>${_('Documentation')}</th>
66 <th>${_('Plugin ID')}</th>
66 <th>${_('Plugin ID')}</th>
67 <th>${_('Enabled')}</th>
67 %for plugin in available_plugins:
68 %for plugin in available_plugins:
68 <tr>
69 <tr>
69 <td>
70 <td>
70 <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}">
71 <span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}">
71 ${_('enabled') if plugin.get_id() in enabled_plugins else _('disabled')}
72 ${_('activated') if plugin.get_id() in enabled_plugins else _('not active')}
72 </span>
73 </span>
73 </td>
74 </td>
74 <td>${plugin.get_display_name()}</td>
75 <td>${plugin.get_display_name()}</td>
75 <td>
76 <td>
76 % if plugin.docs():
77 % if plugin.docs():
77 <a href="${plugin.docs()}">docs</a>
78 <a href="${plugin.docs()}">docs</a>
78 % endif
79 % endif
79 </td>
80 </td>
80 <td>${plugin.get_id()}</td>
81 <td>${plugin.get_id()}</td>
82 <td>${plugin.is_active()}</td>
81 </tr>
83 </tr>
82 %endfor
84 %endfor
83 </table>
85 </table>
84
86
85 <div class="buttons">
87 <div class="buttons">
86 ${h.submit('save',_('Save'),class_="btn")}
88 ${h.submit('save',_('Save'),class_="btn")}
87 </div>
89 </div>
88 </div>
90 </div>
89 </div>
91 </div>
90 ${h.end_form()}
92 ${h.end_form()}
91 </div>
93 </div>
92 </div>
94 </div>
93 </div>
95 </div>
94
96
95 <script>
97 <script>
96 $('.toggle-plugin').click(function(e){
98 $('.toggle-plugin').click(function(e){
97 var auth_plugins_input = $('#auth_plugins');
99 var auth_plugins_input = $('#auth_plugins');
98 var elems = [];
100 var elems = [];
99
101
100 $.each(auth_plugins_input.val().split(',') , function (index, element) {
102 $.each(auth_plugins_input.val().split(',') , function (index, element) {
101 if (element !== "") {
103 if (element !== "") {
102 elems.push(element.strip())
104 elems.push(element.strip())
103 }
105 }
104 });
106 });
105
107
106 var cur_button = e.currentTarget;
108 var cur_button = e.currentTarget;
107 var plugin_id = $(cur_button).attr('plugin_id');
109 var plugin_id = $(cur_button).attr('plugin_id');
108 if($(cur_button).hasClass('btn-success')){
110 if($(cur_button).hasClass('btn-success')){
109 elems.splice(elems.indexOf(plugin_id), 1);
111 elems.splice(elems.indexOf(plugin_id), 1);
110 auth_plugins_input.val(elems.join(',\n'));
112 auth_plugins_input.val(elems.join(',\n'));
111 $(cur_button).removeClass('btn-success');
113 $(cur_button).removeClass('btn-success');
112 cur_button.innerHTML = _gettext('disabled');
114 cur_button.innerHTML = _gettext('not active');
113 }
115 }
114 else{
116 else{
115 if(elems.indexOf(plugin_id) == -1){
117 if(elems.indexOf(plugin_id) == -1){
116 elems.push(plugin_id);
118 elems.push(plugin_id);
117 }
119 }
118 auth_plugins_input.val(elems.join(',\n'));
120 auth_plugins_input.val(elems.join(',\n'));
119 $(cur_button).addClass('btn-success');
121 $(cur_button).addClass('btn-success');
120 cur_button.innerHTML = _gettext('enabled');
122 cur_button.innerHTML = _gettext('activated');
121 }
123 }
122 });
124 });
123 </script>
125 </script>
124 </%def>
126 </%def>
General Comments 0
You need to be logged in to leave comments. Login now