Files
@ 3a3ec35466e7
Branch filter:
Location: kallithea/kallithea/templates/admin/auth/auth_settings.html
3a3ec35466e7
5.4 KiB
text/html
templates: move site branding in page title to base template
Instead of repeating the same three lines in each and every template, move
it to the base template.
Instead of repeating the same three lines in each and every template, move
it to the base template.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%block name="title">
${_('Authentication Settings')}
</%block>
<%def name="breadcrumbs_links()">
${h.link_to(_('Admin'),h.url('admin_home'))}
»
${_('Authentication')}
</%def>
<%block name="header_menu">
${self.menu('admin')}
</%block>
<%def name="main()">
<div class="box">
<!-- box / title -->
<div class="title">
${self.breadcrumbs()}
</div>
${h.form(url('auth_settings'))}
<div class="form">
## enabled auth plugins
<h1>${_('Authentication Plugins')}</h1>
<div class="fields">
<div class="field">
<div class="label"><label for="auth_plugins">${_("Enabled Plugins")}</label></div>
<div class="input">${h.text("auth_plugins", class_='large')}
<span class="help-block">${_('Comma separated list of plugins. Order of plugins is also order in which Kallithea will try to authenticate user')}</span>
<div style="padding:10px 0px 10px 0px;font-weight: bold">${_('Available built-in plugins')}</div>
<ul>
%for plugin_path in c.available_plugins:
<li>
<div style="padding:3px 0px 3px 0px">
<span style="margin: 0px 10px 0px 0px" plugin_id="${plugin_path}" class="toggle-plugin btn btn-mini ${'btn-success' if plugin_path in c.enabled_plugins else ''}">
${_('enabled') if plugin_path in c.enabled_plugins else _('disabled')}</span>${plugin_path}
</div>
</li>
%endfor
</ul>
</div>
</div>
</div>
%for cnt, module in enumerate(c.auth_plugins):
<% pluginName = c.auth_plugins_shortnames[module] %>
<h1>${_('Plugin')}: ${pluginName}</h1>
<div class="fields">
## autoform generation, based on plugin definition from it's settings
%for setting in c.plugin_settings[module]:
<% fullsetting = "auth_%s_%s" % (pluginName, setting["name"]) %>
<% displayname = (setting["formname"] if ("formname" in setting) else setting["name"]) %>
%if setting["type"] == "password":
<div class="field">
<div class="label"><label for="${fullsetting}">${_(displayname)}</label></div>
<div class="input">
${h.password(fullsetting,class_='small',autocomplete="off")}
<span class="help-block">${setting["description"]}</span>
</div>
</div>
%elif setting["type"] in ["string", "int"]:
<div class="field">
<div class="label"><label for="${fullsetting}">${_(displayname)}</label></div>
<div class="input">
${h.text(fullsetting,class_='small')}
<span class="help-block">${setting["description"]}</span>
</div>
</div>
%elif setting["type"] == "bool":
<div class="field">
<div class="label label-checkbox"><label for="${fullsetting}">${_(displayname)}</label></div>
<div class="checkboxes">
<div class="checkbox">${h.checkbox(fullsetting,True,class_='small')}</div>
<span class="help-block">${setting["description"]}</span>
</div>
</div>
%elif setting["type"] == "select":
<div class="field">
<div class="label"><label for="${fullsetting}">${_(displayname)}</label></div>
<div class="select">
${h.select(fullsetting,setting['values'][0],setting['values'],class_='small')}
<span class="help-block">${setting["description"]}</span>
</div>
</div>
%else:
<div class="field">
<div class="label"><label for="${fullsetting}">${_(displayname)}</label></div>
<div class="input">This field is of type ${setting['type']}, which cannot be displayed. Must be one of [string|int|bool|select].</div>
<span class="help-block">${setting["description"]}</span>
</div>
%endif
%endfor
</div>
%endfor
<div class="fields">
<div class="buttons">
${h.submit('save',_('Save'),class_="btn")}
</div>
</div>
</div>
${h.end_form()}
</div>
<script>
$('.toggle-plugin').click(function(e){
var $auth_plugins_input = $('#auth_plugins');
var notEmpty = function(element, index, array) {
return (element != "");
}
var elems = $auth_plugins_input.val().split(',').filter(notEmpty);
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);
$auth_plugins_input.val(elems.join(','));
$cur_button.removeClass('btn-success');
$cur_button.html(_TM['disabled']);
}
else{
console.log(elems);
if(elems.indexOf(plugin_id) == -1){
elems.push(plugin_id);
}
$auth_plugins_input.val(elems.join(','));
$cur_button.addClass('btn-success');
$cur_button.html(_TM['enabled']);
}
});
</script>
</%def>
|