##// END OF EJS Templates
auth-plugins: use large fields, and add support for textarea type.
marcink -
r3245:8fb7ec19 default
parent child Browse files
Show More
@@ -1,118 +1,124 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
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.route_path('admin_home'))}
12 ${h.link_to(_('Admin'),h.route_path('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'), request=request)}
50 ${h.secure_form(request.resource_path(resource, route_name='auth_home'), request=request)}
51 <div class="form">
51 <div class="form">
52
52
53 %for node in plugin.get_settings_schema():
53 %for node in plugin.get_settings_schema():
54 <% label_css_class = ("label-checkbox" if (node.widget == "bool") else "") %>
54 <%
55 label_to_type = {'label-checkbox': 'bool', 'label-textarea': 'textarea'}
56 %>
57
55 <div class="field">
58 <div class="field">
56 <div class="label ${label_css_class}"><label for="${node.name}">${node.title}</label></div>
59 <div class="label ${label_to_type.get(node.widget)}"><label for="${node.name}">${node.title}</label></div>
57 <div class="input">
60 <div class="input">
58 %if node.widget in ["string", "int", "unicode"]:
61 %if node.widget in ["string", "int", "unicode"]:
59 ${h.text(node.name, defaults.get(node.name), class_="medium")}
62 ${h.text(node.name, defaults.get(node.name), class_="large")}
60 %elif node.widget == "password":
63 %elif node.widget == "password":
61 ${h.password(node.name, defaults.get(node.name), class_="medium")}
64 ${h.password(node.name, defaults.get(node.name), class_="large")}
62 %elif node.widget == "bool":
65 %elif node.widget == "bool":
63 <div class="checkbox">${h.checkbox(node.name, True, checked=defaults.get(node.name))}</div>
66 <div class="checkbox">${h.checkbox(node.name, True, checked=defaults.get(node.name))}</div>
64 %elif node.widget == "select":
67 %elif node.widget == "select":
65 ${h.select(node.name, defaults.get(node.name), node.validator.choices)}
68 ${h.select(node.name, defaults.get(node.name), node.validator.choices)}
69 %elif node.widget == "textarea":
70 <div class="textarea" style="margin-left: 0px">${h.textarea(node.name, defaults.get(node.name), rows=10)}</div>
66 %elif node.widget == "readonly":
71 %elif node.widget == "readonly":
67 ${node.default}
72 ${node.default}
68 %else:
73 %else:
69 This field is of type ${node.typ}, which cannot be displayed. Must be one of [string|int|bool|select].
74 This field is of type ${node.typ}, which cannot be displayed. Must be one of [string|int|bool|select].
70 %endif
75 %endif
76
71 %if node.name in errors:
77 %if node.name in errors:
72 <span class="error-message">${errors.get(node.name)}</span>
78 <span class="error-message">${errors.get(node.name)}</span>
73 <br />
79 <br />
74 %endif
80 %endif
75 <p class="help-block pre-formatting">${node.description}</p>
81 <p class="help-block pre-formatting">${node.description}</p>
76 </div>
82 </div>
77 </div>
83 </div>
78 %endfor
84 %endfor
79
85
80 ## Allow derived templates to add something below the form
86 ## Allow derived templates to add something below the form
81 ## input fields
87 ## input fields
82 %if hasattr(next, 'below_form_fields'):
88 %if hasattr(next, 'below_form_fields'):
83 ${next.below_form_fields()}
89 ${next.below_form_fields()}
84 %endif
90 %endif
85
91
86 <div class="buttons">
92 <div class="buttons">
87 ${h.submit('save',_('Save'),class_="btn")}
93 ${h.submit('save',_('Save'),class_="btn")}
88 </div>
94 </div>
89
95
90 </div>
96 </div>
91 ${h.end_form()}
97 ${h.end_form()}
92 </div>
98 </div>
93 </div>
99 </div>
94 </div>
100 </div>
95 </div>
101 </div>
96 </div>
102 </div>
97
103
98 </div>
104 </div>
99 </div>
105 </div>
100
106
101 ## TODO: Ugly hack to get ldap select elements to work.
107 ## TODO: Ugly hack to get ldap select elements to work.
102 ## Find a solution to integrate this nicely.
108 ## Find a solution to integrate this nicely.
103 <script>
109 <script>
104 $(document).ready(function() {
110 $(document).ready(function() {
105 var select2Options = {
111 var select2Options = {
106 containerCssClass: 'drop-menu',
112 containerCssClass: 'drop-menu',
107 dropdownCssClass: 'drop-menu-dropdown',
113 dropdownCssClass: 'drop-menu-dropdown',
108 dropdownAutoWidth: true,
114 dropdownAutoWidth: true,
109 minimumResultsForSearch: -1
115 minimumResultsForSearch: -1
110 };
116 };
111 $("#tls_kind").select2(select2Options);
117 $("#tls_kind").select2(select2Options);
112 $("#tls_reqcert").select2(select2Options);
118 $("#tls_reqcert").select2(select2Options);
113 $("#search_scope").select2(select2Options);
119 $("#search_scope").select2(select2Options);
114 $("#group_extraction_type").select2(select2Options);
120 $("#group_extraction_type").select2(select2Options);
115 $("#admin_groups_sync").select2(select2Options);
121 $("#admin_groups_sync").select2(select2Options);
116 });
122 });
117 </script>
123 </script>
118 </%def>
124 </%def>
General Comments 0
You need to be logged in to leave comments. Login now