Skip to content

Instantly share code, notes, and snippets.

@leonguyen
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save leonguyen/9319588 to your computer and use it in GitHub Desktop.

Select an option

Save leonguyen/9319588 to your computer and use it in GitHub Desktop.
ad_tpl list
<% include ../header %>
<% include ../admin/menu %>
<% include ../admin/msg %>
<div class="page-header">
<% if(typeof(sess.AuthList['N'])!='undefined'){%>
<button type="button" class="btn btn-default pull-right" id="btnAdd" name="btnAdd" onclick="location.href='/ad_user/create'"><span class="glyphicon glyphicon-plus"></span> Add new</button>
<%}//if%>
<h2><%=title%></h2>
</div>
<form id="frm" name="frm" class="form" role="form" method="post" action="/ad_user/search">
<table class="table">
<thead><tr>
<th width="100px;" style="border-bottom:none">
<label class="control-label" for="txtName">Username</label>
<input type="text" class="form-control" id="txtName" name="txtName" value="<%=typeof(sess.search)!='undefined'&&typeof(sess.search.uName)!='undefined'?sess.search.uName:''%>" placeholder="Username" autofocus autocomplete="off"></th>
<th width="100px;" style="border-bottom:none">
<label class="control-label" for="btnSearch">&nbsp;</label>
<button class="form-control" type="submit" class="btn btn-default" id="btnSearch" name="btnSearch"><span class="glyphicon glyphicon-search"></span> Search</button>
</th>
</tr></thead></table>
<p>
<table class="table table-bordered">
<thead>
<tr>
<th><input type="checkbox" id="chkA" name="chkA" onclick="chkAll(this.checked)"></th>
<th>Username <a href="/ad_user/search?uName=ASC">▲</a><a href="/ad_user/search?uName=DESC">▼</a></th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% mlist.forEach(function(ml){ %>
<tr <%=ml.uId!=sess.uId&&ml.uType<=sess.uType?'style=display:none':''%>>
<td>
<input type="checkbox" id="chkId[]" name="chkId[]" <%=ml.uId==sess.uId||ml.uType<sess.uType?'style=display:none':''%> value="<%=ml.uId==sess.uId||ml.uType<sess.uType?'':ml.uId%>">
</td>
<td><%=ml.uName?ml.uName:''%></td>
<td>
<div class="btn-group" <%=ml.uType<sess.uType?'style=display:none':''%>>
<% if(typeof(sess.AuthList['E'])!='undefined' || typeof(sess.AuthList['R'])!='undefined'){%>
<button type="button" id="btnEdit" class="btn btn-default" onclick="location.href='/ad_user/edit/<%=ml.uId?ml.uId:''%>'">
<span class="glyphicon glyphicon-pencil"></span>
</button>
<%}//if%>
<% if(typeof(sess.AuthList['D'])!='undefined'){%>
<button type="button" id="btnDel" class="btn btn-default" onclick="del(<%=ml.uId?ml.uId:''%>)" <%=ml.uId==sess.uId||ml.uType<sess.uType?'style=display:none':''%>>
<span class="glyphicon glyphicon-remove"></span>
</button>
<%}//if%>
</div>
</td>
</tr>
<% });//mlist %>
</tbody>
</table>
<div class="row"><div class="col-md-2">
<label class="control-label" for="selUpd">Update</label>
<select class="form-control" id="selUpd" name="selUpd">
<option value="" selected="selected">---</option>
<% if(typeof(sess.AuthList['D'])!='undefined'){%>
<option value="del">Delete selected</option>
<%}//if%>
<% if(typeof(sess.AuthList['V'])!='undefined'){%>
<option value="ena">Enable selected</option>
<option value="dis">Disable selected</option>
<%}//if%>
</select>
</div>
<div class="col-md-8">
<div id="pg" style="margin:5px 0px;<%=typeof(pg)!='undefined'&&pg.pageCount=='1'?'display:none':''%>"></div>
</div>
<div class="col-md-2" <%=typeof(pg)!='undefined'&&pg.pageCount=='1'?'style=display:none':''%>>
<label class="control-label" for="selLimit">Limit</label>
<select class="form-control" id="selLimit" name="selLimit">
<option value="10" <%=typeof(sess.search)!='undefined'&&sess.search.per_page=='10'?'selected="selected"':''%>>10 items</option>
<option value="20" <%=typeof(sess.search)!='undefined'&&sess.search.per_page=='20'?'selected="selected"':''%>>20 items</option>
<option value="50" <%=typeof(sess.search)!='undefined'&&sess.search.per_page=='50'?'selected="selected"':''%>>50 items</option>
<option value="100" <%=typeof(sess.search)!='undefined'&&sess.search.per_page=='100'?'selected="selected"':''%>>100 items</option>
</select>
</div></div>
</form>
<% include list_js %>
<% include js %>
<% include ../footer %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment