Files
railsgoat/app/views/admin/dashboard.html.erb
T

120 lines
3.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<div class="dashboard-wrapper">
<div class="main-container">
<div class="row-fluid">
<div class="span12">
<div id="success" style="display: none;" class="alert alert-block alert-success fade in">
<button data-dismiss="alert" class="close" type="button">
×
</button>
<h4 class="alert-heading">
Success!
</h4>
<p>
User information successfully updated.
</p>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div id="failure" style="display: none;" class="alert alert-block alert-error fade in">
<button data-dismiss="alert" class="close" type="button">
×
</button>
<h4 class="alert-heading">
Error!
</h4>
<p>
Something went wrong.
</p>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="widget">
<div class="widget-header">
<div class="title">
<span class="fs1" aria-hidden="true" data-icon="&#xe071;"></span>
Manage Users
</div>
</div>
<div class="widget-body">
<div id="dt_example" class="example_alt_pagination">
<table class="table table-striped table-hover table-bordered pull-left" id="data-table">
<thead>
<tr>
<th>
Name
</th>
<th>
Email
</th>
<th>
Admin User
</th>
<th>
Action
</th>
</tr>
</thead>
<tbody>
<% @users.each do |u|%>
<tr>
<td style="word-wrap:break-word;">
<%= "#{u.first_name} #{u.last_name}"%>
</td>
<td>
<%= u.email%>
</td>
<td>
<%= u.admin ? %{<span class="fs1" aria-hidden="true" data-icon="&#xe0fe;"}.html_safe : nil %>
</td>
<td>
<%= link_to "Edit", "#", {:onClick => "javascript:openModal(#{u.id});" ,:role => "button", :class => "btn btn-inverse", "data-toggle" => "modal"}%>
<%= link_to "Delete", "#", {:class => "btn btn-danger"}%>
</td>
</tr>
<% end %>
</tbody>
</table>
<div id="editAcct" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
</div>
<div class="clearfix">
</div>
</div>
</div>
</div>
</div> <!-- End widget header-->
</div>
</div>
</div>
</div>
<%= javascript_include_tag "jquery.dataTables.js"%>
<script type="text/javascript">
function dataTablePagination(){
$('#data-table').dataTable({
"sPaginationType": "full_numbers"
});
};
function makeActive(){
$('li[id="admin"]').addClass('active');
};
function openModal(id){
var link = '/admin/'+ id +'/get_user';
$("#editAcct").load(link);
$("#editAcct").modal('show');
};
$(document).ready(
makeActive,
dataTablePagination()
);
</script>