Skip to content

Commit

Permalink
fixing two columns layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kakwa committed Jun 10, 2015
1 parent d755a6f commit 22fb758
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion resources/templates/adduser.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="col-md-12 column">
<div class="well well-sm">
<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}
<h2 class="h3">Enable/Disable roles:</h2>
${roles}
Expand Down
30 changes: 21 additions & 9 deletions resources/templates/form.tmpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
<%
len_second_column = len(attributes) / 2
counter = -1
len_attr = len(attributes)
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">
<div class="col-md-6 column">
% for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']):
<%def name="form_col(l)">
% for a in l:
<% attr = attributes[a] %>
<div class="form-group">
<div class="input-group">
Expand All @@ -16,7 +26,6 @@ counter = -1
value = ''
value2 = ''
%>
<% counter = counter + 1 %>
<span class="input-group-addon" id="basic-addon1">${attr['display_name']}</span>
% if attr['type'] == 'string':
<input type="text" name="${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" required ${value}>
Expand All @@ -41,10 +50,13 @@ counter = -1
% endif
</div>
</div>
% if counter == len_second_column:
% endfor
</%def>
<div class="row">
<div class="col-md-6 column">
${form_col(lc1)}
</div>
<div class="col-md-6 column">
% endif
% endfor
${form_col(lc2)}
</div>
</div>
3 changes: 2 additions & 1 deletion resources/templates/selfmodify.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
<div class="row clearfix top-buffer bottom-buffer">
<div class="col-md-2 column">
</div>
<div class="col-md-8 column">
<div class="col-md-12 column">
<div class="well well-sm">
<form method='POST' action='/selfmodify' role="form" class="form-signin" data-toggle="validator">
<h2 class="h3">Modify your attributes:</h2>
${form}
<div class="form-group">
<div class="input-group">
Expand Down

0 comments on commit 22fb758

Please sign in to comment.