1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-25 02:34:31 +01:00

various fixes in html + unit tests on html

This commit is contained in:
kakwa 2015-07-05 17:50:42 +02:00
parent 5d7f6ee12c
commit 405367fd75
8 changed files with 32 additions and 30 deletions

View File

@ -16,6 +16,10 @@
height: 34px; height: 34px;
} }
.btn.pad {
padding: inherit;
}
.btn.blue { .btn.blue {
background-color: hsl(201, 100%, 30%) !important; background-color: hsl(201, 100%, 30%) !important;
background-repeat: repeat-x; background-repeat: repeat-x;

View File

@ -18,7 +18,7 @@
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<button class="btn btn-default green" type="submit"> <button class="btn btn-default green" type="submit">
<span class="glyphicon glyphicon-plus-sign"> Add User</button> <span class="glyphicon glyphicon-plus-sign"></span> Add User</button>
</div> </div>
</div> </div>
</form> </form>

View File

@ -36,19 +36,19 @@ for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']):
value2 = '' value2 = ''
%> %>
<span class="input-group-addon" id="basic-addon1">${attr['display_name']}</span> <span class="input-group-addon" id="basic-addon-${a}">${attr['display_name']}</span>
% if modify and a == keyattr: % if modify and a == keyattr:
<input type="hidden" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" ${required} ${value}> <input type="hidden" name="attr.${a}" class="form-control" aria-describedby="basic-addon-${a}" ${required} ${value}>
<span class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1">${tmp}</span> <span class="form-control" aria-describedby="basic-addon-${a}">${tmp}</span>
% elif attr['type'] == 'string': % elif attr['type'] == 'string':
<input type="text" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" ${required} ${value}> <input type="text" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon-${a}" ${required} ${value}>
% elif attr['type'] == 'email': % elif attr['type'] == 'email':
<input type="email" name="attr.${a}" class="form-control" delay="2000" placeholder="${attr['description']}" aria-describedby="basic-addon1" ${required} ${value} data-error="email address is invalid"> <input type="email" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon-${a}" ${required} ${value} data-error="email address is invalid">
% elif attr['type'] == 'int': % elif attr['type'] == 'int':
<input type="number" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" ${required} ${value}> <input type="number" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon-${a}" ${required} ${value}>
% elif attr['type'] == 'fix': % elif attr['type'] == 'fix':
<input type="hidden" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" ${required} value="${attr['value']}"> <input type="hidden" name="attr.${a}" class="form-control" aria-describedby="basic-addon-${a}" ${required} value="${attr['value']}">
<span class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1">${attr['value']}</span> <span class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon-${a}">${attr['value']}</span>
% elif attr['type'] == 'stringlist': % elif attr['type'] == 'stringlist':
<select class="form-control" name="attr.${a}"> <select class="form-control" name="attr.${a}">
${value2} ${value2}
@ -58,7 +58,7 @@ for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']):
</select> </select>
% elif attr['type'] == 'password': % elif attr['type'] == 'password':
<input type="password" class="form-control" data-error="Don't meet password policy" data-remote="/checkppolicy" name="attr.${a}1" id="${a}1" placeholder="${attr['description']}" ${required}> <input type="password" class="form-control" data-error="Don't meet password policy" data-remote="/checkppolicy" name="attr.${a}1" id="${a}1" placeholder="${attr['description']}" ${required}>
<span class="input-group-addon" id="basic-addon1">Retype ${attr['display_name']}</span> <span class="input-group-addon" id="basic-addon-${a}2">Retype ${attr['display_name']}</span>
<input type="password" class="form-control" data-match="#${a}1" data-match-error="Passwords don't match" name="attr.${a}2" id="#${a}2" placeholder="Confirm" ${required}> <input type="password" class="form-control" data-match="#${a}1" data-match-error="Passwords don't match" name="attr.${a}2" id="#${a}2" placeholder="Confirm" ${required}>
% endif % endif
</div> </div>

View File

@ -58,7 +58,7 @@
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<button class="btn btn-default blue" type="submit"> <button class="btn btn-default blue" type="submit">
<span class="glyphicon glyphicon-cog"> Modify User</button> <span class="glyphicon glyphicon-cog"></span> Modify User</button>
</div> </div>
</div> </div>
</form> </form>

View File

@ -14,7 +14,7 @@
</div> </div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<a class="navbar-brand navbar-right" href='/logout'><span class="glyphicon glyphicon-off"> Logout</a> <a class="navbar-brand navbar-right" href='/logout'><span class="glyphicon glyphicon-off"></span> Logout</a>
<form method='GET' action='/searchuser' class="navbar-form navbar-right" role="search"> <form method='GET' action='/searchuser' class="navbar-form navbar-right" role="search">
<div class="form-group"> <div class="form-group">
<input type="text" class="form-control" name="searchstring" placeholder="Search User"> <input type="text" class="form-control" name="searchstring" placeholder="Search User">

View File

@ -6,11 +6,11 @@
<form method='get' action='/searchadmin' role="form" class="form-inline"> <form method='get' action='/searchadmin' role="form" class="form-inline">
<div class="form-group"> <div class="form-group">
<label for="searchstring">Search user to modify/delete</label> <label for="searchstring">Search user to modify/delete</label>
<input type="text" class="form-control" name="searchstring" placeholder="Search User"> <input type="text" class="form-control" id="searchstring" name="searchstring" placeholder="Search User">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="submit">Submit</label> <label for="submit">Submit</label>
<button type="submit" class="form-control btn btn-default green"> <button type="submit" id="submit" class="form-control btn btn-default green">
<span class="glyphicon glyphicon-search"></span> Search</button> <span class="glyphicon glyphicon-search"></span> Search</button>
</div> </div>
</form> </form>
@ -52,18 +52,10 @@
</td> </td>
% endfor % endfor
<td> <td>
<a href="/modify?user=${user}"> <a href="/modify?user=${user}" class="btn btn-xs blue pad" ><span class="glyphicon glyphicon-cog"></span> Modify</a>
<button type="submit" class="btn btn-xs blue">
<span class="glyphicon glyphicon-cog"></span> Modify</button>
</a>
</td> </td>
<td> <td>
<a href="/delete?user=${user}" data-toggle='confirmation-delete' class="btn btn-xs red pad"><span class="glyphicon glyphicon-remove-sign"></span> Delete</a>
<a href="/delete?user=${user}" data-toggle='confirmation-delete'>
<button type="submit" class="btn btn-xs red">
<span class="glyphicon glyphicon-remove-sign"></span> Delete</button>
</a>
</td> </td>
</tr> </tr>
% endfor % endfor

View File

@ -6,11 +6,11 @@
<form method='get' action='/searchuser' role="form" class="form-inline"> <form method='get' action='/searchuser' role="form" class="form-inline">
<div class="form-group"> <div class="form-group">
<label for="searchstring">Search user</label> <label for="searchstring">Search user</label>
<input type="text" class="form-control" name="searchstring" placeholder="Search User"> <input type="text" id="searchstring" class="form-control" name="searchstring" placeholder="Search User">
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="submit">Submit</label> <label for="submit">Submit</label>
<button type="submit" class="form-control btn btn-default green"> <button type="submit" id="submit" class="form-control btn btn-default green">
<span class="glyphicon glyphicon-search"></span> Search</button> <span class="glyphicon glyphicon-search"></span> Search</button>
</div> </div>
</form> </form>

View File

@ -186,11 +186,17 @@ class TestError(object):
def testHtml(self): def testHtml(self):
app = LdapCherry() app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app) loadconf('./tests/cfg/ldapcherry_test.ini', app)
pages = [ pages = {
app.signin(), 'signin': app.signin(),
] 'index': app.index(),
'searchuser': app.searchuser('smit'),
'searchadmin':app.searchadmin('smit'),
'adduser': app.adduser(),
'modify':app.modify('jsmith'),
}
for page in pages: for page in pages:
htmlvalidator(page) print(page)
htmlvalidator(pages[page])
def testLogger(self): def testLogger(self):
app = LdapCherry() app = LdapCherry()