added a table to manage users
This commit is contained in:
@@ -811,7 +811,9 @@ table {
|
||||
max-width: 100%;
|
||||
background-color: transparent;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0; }
|
||||
border-spacing: 0;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
class AdminController < ApplicationController
|
||||
|
||||
def dashboard
|
||||
@users = User.all
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<div class="dashboard-wrapper">
|
||||
<div class="main-container">
|
||||
<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=""></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 ? "Yes" : nil %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to "Edit", "#", {:class => "btn btn-inverse"}%>
|
||||
<%= link_to "Delete", "#", {:class => "btn btn-danger"}%>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clearfix">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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_dashboard"]').addClass('active');
|
||||
};
|
||||
|
||||
$(document).ready(
|
||||
makeActive,
|
||||
dataTablePagination()
|
||||
);
|
||||
</script>
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="mainnav" class="hidden-phone hidden-tablet">
|
||||
<ul style="display: block;">
|
||||
<li class="active">
|
||||
<li id="home">
|
||||
<a href="#">
|
||||
<div class="icon">
|
||||
<span class="fs1" aria-hidden="true" data-icon=""></span>
|
||||
@@ -8,6 +8,16 @@
|
||||
Dashboard
|
||||
</a>
|
||||
</li>
|
||||
<% if is_admin? %>
|
||||
<li id="admin_dashboard">
|
||||
<%= link_to admin_dashboard_path(:admin_id => current_user.id) do %>
|
||||
<div class="icon">
|
||||
<span class="fs1" aria-hidden="true" data-icon=""></span>
|
||||
</div>
|
||||
Admin
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<a href="#">
|
||||
<div class="icon">
|
||||
|
||||
@@ -28,6 +28,10 @@ resources :tutorials do
|
||||
end
|
||||
end
|
||||
|
||||
resources :admin do
|
||||
get "dashboard"
|
||||
end
|
||||
|
||||
resources :dashboard do
|
||||
collection do
|
||||
get "home"
|
||||
|
||||
Reference in New Issue
Block a user