1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-25 18:54:29 +01:00

fixing two columns layout

This commit is contained in:
kakwa 2015-06-10 23:30:16 +02:00
parent d755a6fc8f
commit 22fb758c83
3 changed files with 24 additions and 11 deletions

View File

@ -6,7 +6,7 @@
<div class="col-md-12 column"> <div class="col-md-12 column">
<div class="well well-sm"> <div class="well well-sm">
<form method='POST' action='/adduser' role="form" class="form-signin" data-toggle="validator"> <form method='POST' action='/adduser' role="form" class="form-signin" data-toggle="validator">
<h2 class="h3">Fill user attributes:</h2> <h2 class="h3">Fill new user attributes:</h2>
${form} ${form}
<h2 class="h3">Enable/Disable roles:</h2> <h2 class="h3">Enable/Disable roles:</h2>
${roles} ${roles}

View File

@ -1,10 +1,20 @@
<% <%
len_second_column = len(attributes) / 2 len_attr = len(attributes)
counter = -1 switch = len_attr / 2
if not switch * 2 == len_attr:
switch = switch + 1
counter = 1
lc1 = []
lc2 = []
for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']):
if counter <= switch:
lc1.append(a)
else:
lc2.append(a)
counter = counter + 1
%> %>
<div class="row"> <%def name="form_col(l)">
<div class="col-md-6 column"> % for a in l:
% for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']):
<% attr = attributes[a] %> <% attr = attributes[a] %>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
@ -16,7 +26,6 @@ counter = -1
value = '' value = ''
value2 = '' value2 = ''
%> %>
<% counter = counter + 1 %>
<span class="input-group-addon" id="basic-addon1">${attr['display_name']}</span> <span class="input-group-addon" id="basic-addon1">${attr['display_name']}</span>
% if attr['type'] == 'string': % if attr['type'] == 'string':
<input type="text" name="${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" required ${value}> <input type="text" name="${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" required ${value}>
@ -41,10 +50,13 @@ counter = -1
% endif % endif
</div> </div>
</div> </div>
% if counter == len_second_column: % endfor
</%def>
<div class="row">
<div class="col-md-6 column">
${form_col(lc1)}
</div> </div>
<div class="col-md-6 column"> <div class="col-md-6 column">
% endif ${form_col(lc2)}
% endfor
</div> </div>
</div> </div>

View File

@ -3,9 +3,10 @@
<div class="row clearfix top-buffer bottom-buffer"> <div class="row clearfix top-buffer bottom-buffer">
<div class="col-md-2 column"> <div class="col-md-2 column">
</div> </div>
<div class="col-md-8 column"> <div class="col-md-12 column">
<div class="well well-sm"> <div class="well well-sm">
<form method='POST' action='/selfmodify' role="form" class="form-signin" data-toggle="validator"> <form method='POST' action='/selfmodify' role="form" class="form-signin" data-toggle="validator">
<h2 class="h3">Modify your attributes:</h2>
${form} ${form}
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">