Merge
This commit is contained in:
commit
0d94b3e383
8 changed files with 76 additions and 49 deletions
4
Gemfile
4
Gemfile
|
@ -69,8 +69,8 @@ gem 'paperclip'
|
||||||
# Use devise for Admins
|
# Use devise for Admins
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
|
|
||||||
# Use cancan for authorization
|
# Use cancancan for authorization
|
||||||
gem 'cancan'
|
gem 'cancancan'
|
||||||
|
|
||||||
#ik wil test data maken dus dit
|
#ik wil test data maken dus dit
|
||||||
gem 'faker', '1.4.2'
|
gem 'faker', '1.4.2'
|
||||||
|
|
|
@ -41,7 +41,7 @@ GEM
|
||||||
columnize (~> 0.8)
|
columnize (~> 0.8)
|
||||||
debugger-linecache (~> 1.2)
|
debugger-linecache (~> 1.2)
|
||||||
slop (~> 3.6)
|
slop (~> 3.6)
|
||||||
cancan (1.6.10)
|
cancancan (1.9.2)
|
||||||
capistrano (3.2.1)
|
capistrano (3.2.1)
|
||||||
i18n
|
i18n
|
||||||
rake (>= 10.0.0)
|
rake (>= 10.0.0)
|
||||||
|
@ -175,7 +175,7 @@ DEPENDENCIES
|
||||||
bootstrap-sass (= 3.2.0.0)
|
bootstrap-sass (= 3.2.0.0)
|
||||||
bootstrap-will_paginate (= 0.0.10)
|
bootstrap-will_paginate (= 0.0.10)
|
||||||
byebug
|
byebug
|
||||||
cancan
|
cancancan
|
||||||
capistrano (~> 3.1)
|
capistrano (~> 3.1)
|
||||||
capistrano-rails (~> 1.1)
|
capistrano-rails (~> 1.1)
|
||||||
capistrano-rvm
|
capistrano-rvm
|
||||||
|
|
|
@ -92,17 +92,29 @@ footer ul li {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.overview{
|
|
||||||
width: 49%;
|
|
||||||
height: 49%;
|
|
||||||
border-radius: 0px;
|
|
||||||
margin: -2px;
|
|
||||||
padding: 18px;
|
|
||||||
border-color: #000;
|
|
||||||
border: 0px;
|
|
||||||
|
|
||||||
font-weight: bold;
|
.overview{
|
||||||
font-size: 24px;
|
//margin-left: 2px;
|
||||||
|
width: 50%;
|
||||||
|
float: left;
|
||||||
|
border-radius: 0px;
|
||||||
|
|
||||||
|
.btn{
|
||||||
|
margin-top: -10px;
|
||||||
|
width: 100%;
|
||||||
|
border-color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dagschotel{
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user_img{
|
||||||
|
margin-left: 33%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
12
app/models/ability.rb
Normal file
12
app/models/ability.rb
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
class Ability
|
||||||
|
include CanCan::Ability
|
||||||
|
|
||||||
|
def initialize(user)
|
||||||
|
user ||= User.new # guest user (not logged in)
|
||||||
|
if user.admin?
|
||||||
|
can :manage, :all
|
||||||
|
else
|
||||||
|
can :read, :all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -7,45 +7,55 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<%= link_to "Tab", root_path, class: "navbar-brand" %>
|
<%= link_to "Taþ", root_path, class: "navbar-brand" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||||
<ul class="nav navbar-nav">
|
<div class="hidden-xs navbar-form navbar-right">
|
||||||
|
<div class="form-group">
|
||||||
|
<% if user_signed_in? %>
|
||||||
|
<%= button_to "Logout", destroy_user_session_path(current_user), class: "btn btn-default form-control", method: :delete %>
|
||||||
|
<% else %>
|
||||||
|
<%= button_to "Login", new_user_session_path, class: "btn btn-success form-control" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li><%= mail_to "tab@zeus.ugent.be", "Send feedback" %></li>
|
||||||
|
<% if can? :manage, :all %>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Products <span class="caret"></span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Products <span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li><%= link_to "All products", products_path %></li>
|
||||||
<li><%= link_to "New product" , new_product_path %></li>
|
<li><%= link_to "New product" , new_product_path %></li>
|
||||||
<li><%= link_to "Index", products_path %></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Users <span class="caret"></span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Users <span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">
|
||||||
<li><%= link_to "New User", new_user_registration_path %></li>
|
|
||||||
<li><%= link_to "index" , users_path %></li>
|
<li><%= link_to "index" , users_path %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
<% end %>
|
||||||
|
<% if user_signed_in? %>
|
||||||
<ul class="nav navbar-nav navbar-center">
|
<li>
|
||||||
<li class="navbar-text">
|
<a>Logged in as <%= current_user.display_name %></a>
|
||||||
ADMIN NAVBAR
|
|
||||||
</li>
|
</li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<div class="visible-xs navbar-form">
|
||||||
<li class="dropdown">
|
<div class="form-group">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account <span class="caret"></span></a>
|
<% if user_signed_in? %>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<%= button_to "Logout", destroy_user_session_path(current_user), class: "btn btn-default form-control", method: :delete %>
|
||||||
<li><a href="#">Profile</a></li>
|
<% else %>
|
||||||
<li><a href="#">Update</a></li>
|
<%= button_to "Login", new_user_session_path, class: "btn btn-success form-control" %>
|
||||||
<li><%= link_to "Sign out", destroy_user_session_path, method: :delete unless current_user.nil? %></li>
|
<% end %>
|
||||||
</ul>
|
</div>
|
||||||
</li>
|
</div>
|
||||||
</ul>
|
|
||||||
</div><!-- /.navbar-collapse -->
|
</div><!-- /.navbar-collapse -->
|
||||||
</div><!-- /.container-fluid -->
|
</div><!-- /.container-fluid -->
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -1,15 +1,2 @@
|
||||||
<div class="col-md-6 ">
|
<%= render 'orders/user_list', users: @users_by_name %>
|
||||||
<h3 class="center" >sort by name</h3>
|
<%= render 'orders/user_list', users: @users_by_order %>
|
||||||
|
|
||||||
<% @users_by_name.each do |user| %>
|
|
||||||
<%= link_to user.name , new_user_order_path(user), class: "btn btn-info overview",
|
|
||||||
style: get_color_style(user) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<h3 class="center">sort by orders</h3>
|
|
||||||
<% @users_by_order.each do |user| %>
|
|
||||||
<%= link_to user.name , new_user_order_path(user), class: "btn btn-info overview",
|
|
||||||
style: get_color_style(user) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
5
db/migrate/20141209184030_add_admin_to_users.rb
Normal file
5
db/migrate/20141209184030_add_admin_to_users.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddAdminToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :admin, :boolean
|
||||||
|
end
|
||||||
|
end
|
|
@ -55,6 +55,7 @@ ActiveRecord::Schema.define(version: 20141209192545) do
|
||||||
t.string "current_sign_in_ip"
|
t.string "current_sign_in_ip"
|
||||||
t.string "last_sign_in_ip"
|
t.string "last_sign_in_ip"
|
||||||
t.integer "dagschotel_id"
|
t.integer "dagschotel_id"
|
||||||
|
t.boolean "admin"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue