##// END OF EJS Templates
authn: Adapt and refactor plugin settings template....
johbo -
r86:083e961d default
parent child Browse files
Show More
@@ -1,118 +1,107 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
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.url('admin_home'))}
12 ${h.link_to(_('Admin'),h.url('admin_home'))}
13 &raquo;
13 &raquo;
14 ${h.link_to(_('Authentication Plugins'),request.resource_path(resource.__parent__, route_name='auth_home'))}
14 ${h.link_to(_('Authentication Plugins'),request.resource_path(resource.__parent__, route_name='auth_home'))}
15 &raquo;
15 &raquo;
16 ${resource.display_name}
16 ${resource.display_name}
17 </%def>
17 </%def>
18
18
19 <%def name="menu_bar_nav()">
19 <%def name="menu_bar_nav()">
20 ${self.menu_items(active='admin')}
20 ${self.menu_items(active='admin')}
21 </%def>
21 </%def>
22
22
23 <%def name="main()">
23 <%def name="main()">
24 <div class="box">
24 <div class="box">
25 <div class="title">
25 <div class="title">
26 ${self.breadcrumbs()}
26 ${self.breadcrumbs()}
27 </div>
27 </div>
28 <div class='sidebar-col-wrapper'>
28 <div class='sidebar-col-wrapper'>
29
29
30 ## TODO: This is repeated in the auth root template and should be merged
30 ## TODO: This is repeated in the auth root template and should be merged
31 ## into a single solution.
31 ## into a single solution.
32 <div class="sidebar">
32 <div class="sidebar">
33 <ul class="nav nav-pills nav-stacked">
33 <ul class="nav nav-pills nav-stacked">
34 % for item in resource.get_root().get_nav_list():
34 % for item in resource.get_root().get_nav_list():
35 <li ${'class=active' if item == resource else ''}>
35 <li ${'class=active' if item == resource else ''}>
36 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
36 <a href="${request.resource_path(item, route_name='auth_home')}">${item.display_name}</a>
37 </li>
37 </li>
38 % endfor
38 % endfor
39 </ul>
39 </ul>
40 </div>
40 </div>
41
41
42 <div class="main-content-full-width">
42 <div class="main-content-full-width">
43 <div class="panel panel-default">
43 <div class="panel panel-default">
44 <div class="panel-heading">
44 <div class="panel-heading">
45 <h3 class="panel-title">${_('Plugin')}: ${resource.display_name}</h3>
45 <h3 class="panel-title">${_('Plugin')}: ${resource.display_name}</h3>
46 </div>
46 </div>
47 <div class="panel-body">
47 <div class="panel-body">
48 <div class="plugin_form">
48 <div class="plugin_form">
49 <div class="fields">
49 <div class="fields">
50 ${h.secure_form(request.resource_path(resource, route_name='auth_home'))}
50 ${h.secure_form(request.resource_path(resource, route_name='auth_home'))}
51 <div class="form">
51 <div class="form">
52 %for node in plugin.get_settings_schema():
52 %for node in plugin.get_settings_schema():
53 <% label_cls = ("label-checkbox" if (node.widget == "bool") else "") %>
53 <% label_css_class = ("label-checkbox" if (node.widget == "bool") else "") %>
54 <div class="field">
54 <div class="field">
55 <div class="label ${label_cls}"><label for="${node.name}">${node.title}</label></div>
55 <div class="label ${label_css_class}"><label for="${node.name}">${node.title}</label></div>
56 %if node.widget in ["string", "int", "unicode"]:
57 <div class="input">
56 <div class="input">
58 ${h.text(node.name, class_="medium")}
57 %if node.widget in ["string", "int", "unicode"]:
59 <p class="help-block">${node.description}</p>
58 ${h.text(node.name, node.default, class_="medium")}
60 </div>
61 %elif node.widget == "password":
59 %elif node.widget == "password":
62 <div class="input">
60 ${h.password(node.name, node.default, class_="medium")}
63 ${h.password(node.name, class_="medium")}
61 %elif node.widget == "bool":
62 <div class="checkbox">${h.checkbox(node.name, node.default)}</div>
63 %elif node.widget == "select":
64 ${h.select(node.name, node.default, node.validator.choices)}
65 %elif node.widget == "readonly":
66 ${node.default}
67 %else:
68 This field is of type ${node.typ}, which cannot be displayed. Must be one of [string|int|bool|select].
69 %endif
70 %if node.name in errors:
71 <span class="error-message">${errors.get(node.name)}</span>
72 <br />
73 %endif
64 <p class="help-block">${node.description}</p>
74 <p class="help-block">${node.description}</p>
65 </div>
75 </div>
66 %elif node.widget == "bool":
67 <div class="input">
68 <div class="checkbox">${h.checkbox(node.name, True)}</div>
69 <span class="help-block">${node.description}</span>
70 </div>
71 %elif node.widget == "select":
72 <div class="select">
73 ${h.select(node.name, node.default, node.validator.choices)}
74 <p class="help-block">${node.description}</p>
75 </div>
76 %elif node.widget == "readonly":
77 <div class="input">
78 ${node.default}
79 <p class="help-block">${node.description}</p>
80 </div>
81 %else:
82 <div class="input">
83 This field is of type ${node.typ}, which cannot be displayed. Must be one of [string|int|bool|select].
84 <p class="help-block">${node.description}</p>
85 </div>
86 %endif
87 </div>
76 </div>
88 %endfor
77 %endfor
89 <div class="buttons">
78 <div class="buttons">
90 ${h.submit('save',_('Save'),class_="btn")}
79 ${h.submit('save',_('Save'),class_="btn")}
91 </div>
80 </div>
92 </div>
81 </div>
93 ${h.end_form()}
82 ${h.end_form()}
94 </div>
83 </div>
95 </div>
84 </div>
96 </div>
85 </div>
97 </div>
86 </div>
98 </div>
87 </div>
99
88
100 </div>
89 </div>
101 </div>
90 </div>
102 </%def>
91 </%def>
103
92
104 ## TODO: Ugly hack to get ldap select elements to work.
93 ## TODO: Ugly hack to get ldap select elements to work.
105 ## Find a solution to integrate this nicely.
94 ## Find a solution to integrate this nicely.
106 <script>
95 <script>
107 $(document).ready(function() {
96 $(document).ready(function() {
108 var select2Options = {
97 var select2Options = {
109 containerCssClass: 'drop-menu',
98 containerCssClass: 'drop-menu',
110 dropdownCssClass: 'drop-menu-dropdown',
99 dropdownCssClass: 'drop-menu-dropdown',
111 dropdownAutoWidth: true,
100 dropdownAutoWidth: true,
112 minimumResultsForSearch: -1
101 minimumResultsForSearch: -1
113 };
102 };
114 $("#tls_kind").select2(select2Options);
103 $("#tls_kind").select2(select2Options);
115 $("#tls_reqcert").select2(select2Options);
104 $("#tls_reqcert").select2(select2Options);
116 $("#search_scope").select2(select2Options);
105 $("#search_scope").select2(select2Options);
117 });
106 });
118 </script>
107 </script>
General Comments 0
You need to be logged in to leave comments. Login now