added a table to manage users

This commit is contained in:
Ken Johnson
2013-05-17 14:08:18 -04:00
parent a279d06b4c
commit f7dbc482bb
5 changed files with 107 additions and 2 deletions
+3 -1
View File
@@ -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%;
+5
View File
@@ -1,2 +1,7 @@
class AdminController < ApplicationController
def dashboard
@users = User.all
end
end
+84
View File
@@ -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="&#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 ? "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>
+11 -1
View File
@@ -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="&#xe0a0;"></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="&#xe1c8;"></span>
</div>
Admin
<% end %>
</li>
<% end %>
<li>
<a href="#">
<div class="icon">
+4
View File
@@ -28,6 +28,10 @@ resources :tutorials do
end
end
resources :admin do
get "dashboard"
end
resources :dashboard do
collection do
get "home"