##// END OF EJS Templates
auth-plugins: use a nicer visual display of auth plugins that would highlight that order is...
marcink -
r2659:8b68aff1 default
parent child Browse files
Show More
@@ -145,7 +145,7 b' class AuthSettingsView(BaseAppView):'
145
145
146 # Create form default values and fill the form.
146 # Create form default values and fill the form.
147 form_defaults = {
147 form_defaults = {
148 'auth_plugins': ','.join(enabled_plugins)
148 'auth_plugins': ',\n'.join(enabled_plugins)
149 }
149 }
150 form_defaults.update(defaults)
150 form_defaults.update(defaults)
151 html = formencode.htmlfill.render(
151 html = formencode.htmlfill.render(
@@ -54,11 +54,9 b''
54 <div class="textarea text-area editor">
54 <div class="textarea text-area editor">
55 ${h.textarea('auth_plugins',cols=23,rows=5,class_="medium")}
55 ${h.textarea('auth_plugins',cols=23,rows=5,class_="medium")}
56 </div>
56 </div>
57 <p class="help-block">
57 <p class="help-block pre-formatting">${_('List of plugins, separated by commas.'
58 ${_('Add a list of plugins, separated by commas. '
58 '\nThe order of the plugins is also the order in which '
59 'The order of the plugins is also the order in which '
59 'RhodeCode Enterprise will try to authenticate a user.')}</p>
60 'RhodeCode Enterprise will try to authenticate a user.')}
61 </p>
62 </div>
60 </div>
63
61
64 <div class="field">
62 <div class="field">
@@ -91,15 +89,19 b''
91 <script>
89 <script>
92 $('.toggle-plugin').click(function(e){
90 $('.toggle-plugin').click(function(e){
93 var auth_plugins_input = $('#auth_plugins');
91 var auth_plugins_input = $('#auth_plugins');
94 var notEmpty = function(element, index, array) {
92 var elems = [];
95 return (element != "");
93
96 };
94 $.each(auth_plugins_input.val().split(',') , function (index, element) {
97 var elems = auth_plugins_input.val().split(',').filter(notEmpty);
95 if (element !== "") {
96 elems.push(element.strip())
97 }
98 });
99
98 var cur_button = e.currentTarget;
100 var cur_button = e.currentTarget;
99 var plugin_id = $(cur_button).attr('plugin_id');
101 var plugin_id = $(cur_button).attr('plugin_id');
100 if($(cur_button).hasClass('btn-success')){
102 if($(cur_button).hasClass('btn-success')){
101 elems.splice(elems.indexOf(plugin_id), 1);
103 elems.splice(elems.indexOf(plugin_id), 1);
102 auth_plugins_input.val(elems.join(','));
104 auth_plugins_input.val(elems.join(',\n'));
103 $(cur_button).removeClass('btn-success');
105 $(cur_button).removeClass('btn-success');
104 cur_button.innerHTML = _gettext('disabled');
106 cur_button.innerHTML = _gettext('disabled');
105 }
107 }
@@ -107,7 +109,7 b''
107 if(elems.indexOf(plugin_id) == -1){
109 if(elems.indexOf(plugin_id) == -1){
108 elems.push(plugin_id);
110 elems.push(plugin_id);
109 }
111 }
110 auth_plugins_input.val(elems.join(','));
112 auth_plugins_input.val(elems.join(',\n'));
111 $(cur_button).addClass('btn-success');
113 $(cur_button).addClass('btn-success');
112 cur_button.innerHTML = _gettext('enabled');
114 cur_button.innerHTML = _gettext('enabled');
113 }
115 }
General Comments 0
You need to be logged in to leave comments. Login now