moved GUI from old project
This commit is contained in:
103
nodejs/views/users.ejs
Executable file
103
nodejs/views/users.ejs
Executable file
@ -0,0 +1,103 @@
|
||||
<% include top %>
|
||||
<script id="rowTemplate" type="text/html">
|
||||
<tr action="users" evalAJAX="$form.trigger('reset')">
|
||||
<td><< user >></td>
|
||||
<input type="hidden" name="username" value="<< user >>" />
|
||||
<td>
|
||||
<label></label>
|
||||
<div class="col-xs-10 form-group">
|
||||
<input type="password" size="30" class="form-control" name="password" placeholder="New password" validate="password:5"/>
|
||||
</div>
|
||||
<button type="button" onclick="formAJAX(this)" class="btn btn-sm btn-default">Change</button>
|
||||
</td>
|
||||
<td><button type="button" onclick="formAJAX(this, true)" class="btn btn-sm btn-default">Delete</button><td>
|
||||
</tr>
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function tableAJAX(actionMessage){
|
||||
$('#tableAJAX').html('').hide();
|
||||
$('div.actionMessage').html('Refreshing user list...').show();
|
||||
$.get('users',function(data){
|
||||
$.each( data, function(key, value) {
|
||||
user_row = ich.rowTemplate({user : value});
|
||||
$('#tableAJAX').append(user_row);
|
||||
});
|
||||
|
||||
$('#tableAJAX').fadeIn('slow');
|
||||
|
||||
if(!actionMessage){
|
||||
$('div.actionMessage').slideUp('fast');
|
||||
}else{
|
||||
$('div.actionMessage').html(actionMessage).slideDown('fast');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
tableAJAX(); //populate the table
|
||||
});
|
||||
</script>
|
||||
<div class="row" style="display:none">
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">
|
||||
Add new user
|
||||
<div class="pull-right">
|
||||
<label class="glyphicon glyphicon-circle-arrow-down panel-toggle"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="users" evalAJAX="$form.trigger('reset')">
|
||||
<input type="hidden" class="form-control" name="delete" value="false" />
|
||||
<div class="form-group">
|
||||
<label class="control-label">User-name</label>
|
||||
<input type="text" class="form-control" name="username" placeholder="Letter, numbers, -, _, . and @ only" validate="user:3" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">Password</label>
|
||||
<input type="password" class="form-control" name="password" placeholder="Atleast 5 char. long" validate="password:5"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">Again</label>
|
||||
<input type="password" class="form-control" name="passwordMatch" placeholder="Retype password" validate="eq:password"/>
|
||||
</div>
|
||||
<button type="button" onclick="formAJAX(this)" class="btn btn-default">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">
|
||||
User List
|
||||
<div class="pull-right">
|
||||
<label class="glyphicon glyphicon-circle-arrow-down panel-toggle"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body" style="padding-bottom:0">
|
||||
<div class="alert alert-warning actionMessage" style="display:none">
|
||||
<!-- Message after AJAX action is preformed -->
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Password</th>
|
||||
<th>Delete</th>
|
||||
</thead>
|
||||
<tbody id="tableAJAX">
|
||||
<!-- ajax loaded table -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% include bottom %>
|
Reference in New Issue
Block a user