##// 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 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 25 ${self.breadcrumbs()}
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 <div class="label">${_("Ordered Enabled Plugins")}</div>
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 <th>${_('Enabled')}</th>
67 68 %for plugin in available_plugins:
68 69 <tr>
69 70 <td>
70 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 73 </span>
73 74 </td>
74 75 <td>${plugin.get_display_name()}</td>
75 76 <td>
76 77 % if plugin.docs():
77 78 <a href="${plugin.docs()}">docs</a>
78 79 % endif
79 80 </td>
80 81 <td>${plugin.get_id()}</td>
82 <td>${plugin.is_active()}</td>
81 83 </tr>
82 84 %endfor
83 85 </table>
84 86
85 87 <div class="buttons">
86 88 ${h.submit('save',_('Save'),class_="btn")}
87 89 </div>
88 90 </div>
89 91 </div>
90 92 ${h.end_form()}
91 93 </div>
92 94 </div>
93 95 </div>
94 96
95 97 <script>
96 98 $('.toggle-plugin').click(function(e){
97 99 var auth_plugins_input = $('#auth_plugins');
98 100 var elems = [];
99 101
100 102 $.each(auth_plugins_input.val().split(',') , function (index, element) {
101 103 if (element !== "") {
102 104 elems.push(element.strip())
103 105 }
104 106 });
105 107
106 108 var cur_button = e.currentTarget;
107 109 var plugin_id = $(cur_button).attr('plugin_id');
108 110 if($(cur_button).hasClass('btn-success')){
109 111 elems.splice(elems.indexOf(plugin_id), 1);
110 112 auth_plugins_input.val(elems.join(',\n'));
111 113 $(cur_button).removeClass('btn-success');
112 cur_button.innerHTML = _gettext('disabled');
114 cur_button.innerHTML = _gettext('not active');
113 115 }
114 116 else{
115 117 if(elems.indexOf(plugin_id) == -1){
116 118 elems.push(plugin_id);
117 119 }
118 120 auth_plugins_input.val(elems.join(',\n'));
119 121 $(cur_button).addClass('btn-success');
120 cur_button.innerHTML = _gettext('enabled');
122 cur_button.innerHTML = _gettext('activated');
121 123 }
122 124 });
123 125 </script>
124 126 </%def>
General Comments 0
You need to be logged in to leave comments. Login now