auth_settings.mako
126 lines
| 4.0 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | ## -*- coding: utf-8 -*- | |||
<%inherit file="/base/base.mako"/> | ||||
<%def name="title()"> | ||||
${_('Authentication Settings')} | ||||
%if c.rhodecode_name: | ||||
· ${h.branding(c.rhodecode_name)}} | ||||
%endif | ||||
</%def> | ||||
<%def name="breadcrumbs_links()"> | ||||
r1758 | ${h.link_to(_('Admin'),h.route_path('admin_home'))} | |||
r1282 | » | |||
${_('Authentication Plugins')} | ||||
</%def> | ||||
<%def name="menu_bar_nav()"> | ||||
${self.menu_items(active='admin')} | ||||
</%def> | ||||
<%def name="main()"> | ||||
<div class="box"> | ||||
<div class="title"> | ||||
${self.breadcrumbs()} | ||||
</div> | ||||
<div class='sidebar-col-wrapper'> | ||||
<div class="sidebar"> | ||||
<ul class="nav nav-pills nav-stacked"> | ||||
r3257 | % for item in resource.get_root().get_nav_list(): | |||
r1282 | <li ${'class=active' if item == resource else ''}> | |||
<a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a> | ||||
</li> | ||||
% endfor | ||||
</ul> | ||||
</div> | ||||
<div class="main-content-full-width"> | ||||
r1918 | ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)} | |||
r1282 | <div class="panel panel-default"> | |||
<div class="panel-heading"> | ||||
<h3 class="panel-title">${_("Enabled and Available Plugins")}</h3> | ||||
</div> | ||||
r3233 | <div class="panel-body"> | |||
r1282 | ||||
r3233 | ||||
r3269 | <div class="label">${_("Ordered Activated Plugins")}</div> | |||
r1282 | <div class="textarea text-area editor"> | |||
r3233 | ${h.textarea('auth_plugins',cols=120,rows=20,class_="medium")} | |||
r1282 | </div> | |||
r3233 | <div class="field"> | |||
<p class="help-block pre-formatting">${_('List of plugins, separated by commas.' | ||||
r2659 | '\nThe order of the plugins is also the order in which ' | |||
r3233 | 'RhodeCode Enterprise will try to authenticate a user.')} | |||
</p> | ||||
</div> | ||||
r1282 | ||||
r3233 | <table class="rctable"> | |||
<th>${_('Activate')}</th> | ||||
<th>${_('Plugin Name')}</th> | ||||
<th>${_('Documentation')}</th> | ||||
<th>${_('Plugin ID')}</th> | ||||
r3269 | <th>${_('Enabled')}</th> | |||
r3233 | %for plugin in available_plugins: | |||
<tr> | ||||
<td> | ||||
<span plugin_id="${plugin.get_id()}" class="toggle-plugin btn ${'btn-success' if plugin.get_id() in enabled_plugins else ''}"> | ||||
r3269 | ${_('activated') if plugin.get_id() in enabled_plugins else _('not active')} | |||
r3233 | </span> | |||
</td> | ||||
<td>${plugin.get_display_name()}</td> | ||||
<td> | ||||
% if plugin.docs(): | ||||
<a href="${plugin.docs()}">docs</a> | ||||
% endif | ||||
</td> | ||||
<td>${plugin.get_id()}</td> | ||||
r3269 | <td>${plugin.is_active()}</td> | |||
r3233 | </tr> | |||
%endfor | ||||
</table> | ||||
r1282 | ||||
<div class="buttons"> | ||||
${h.submit('save',_('Save'),class_="btn")} | ||||
</div> | ||||
</div> | ||||
</div> | ||||
${h.end_form()} | ||||
</div> | ||||
</div> | ||||
</div> | ||||
<script> | ||||
$('.toggle-plugin').click(function(e){ | ||||
var auth_plugins_input = $('#auth_plugins'); | ||||
r2659 | var elems = []; | |||
$.each(auth_plugins_input.val().split(',') , function (index, element) { | ||||
if (element !== "") { | ||||
elems.push(element.strip()) | ||||
} | ||||
}); | ||||
r1282 | var cur_button = e.currentTarget; | |||
var plugin_id = $(cur_button).attr('plugin_id'); | ||||
if($(cur_button).hasClass('btn-success')){ | ||||
elems.splice(elems.indexOf(plugin_id), 1); | ||||
r2659 | auth_plugins_input.val(elems.join(',\n')); | |||
r1282 | $(cur_button).removeClass('btn-success'); | |||
r3269 | cur_button.innerHTML = _gettext('not active'); | |||
r1282 | } | |||
else{ | ||||
if(elems.indexOf(plugin_id) == -1){ | ||||
elems.push(plugin_id); | ||||
} | ||||
r2659 | auth_plugins_input.val(elems.join(',\n')); | |||
r1282 | $(cur_button).addClass('btn-success'); | |||
r3269 | cur_button.innerHTML = _gettext('activated'); | |||
r1282 | } | |||
}); | ||||
</script> | ||||
</%def> | ||||