diff --git a/Gemfile b/Gemfile index 6e7d8fc..435d153 100644 --- a/Gemfile +++ b/Gemfile @@ -69,8 +69,8 @@ gem 'paperclip' # Use devise for Admins gem 'devise' -# Use cancan for authorization -gem 'cancan' +# Use cancancan for authorization +gem 'cancancan' #ik wil test data maken dus dit gem 'faker', '1.4.2' diff --git a/Gemfile.lock b/Gemfile.lock index 5b60a75..ae209a0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,7 +41,7 @@ GEM columnize (~> 0.8) debugger-linecache (~> 1.2) slop (~> 3.6) - cancan (1.6.10) + cancancan (1.9.2) capistrano (3.2.1) i18n rake (>= 10.0.0) @@ -175,7 +175,7 @@ DEPENDENCIES bootstrap-sass (= 3.2.0.0) bootstrap-will_paginate (= 0.0.10) byebug - cancan + cancancan capistrano (~> 3.1) capistrano-rails (~> 1.1) capistrano-rvm diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 5e44107..e94bbe8 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -92,17 +92,29 @@ footer ul li { margin-left: 15px; } -.overview{ - width: 49%; - height: 49%; - border-radius: 0px; - margin: -2px; - padding: 18px; - border-color: #000; - border: 0px; - font-weight: bold; - font-size: 24px; +.overview{ + //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%; + + } + + } diff --git a/app/models/ability.rb b/app/models/ability.rb new file mode 100644 index 0000000..047c60f --- /dev/null +++ b/app/models/ability.rb @@ -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 diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 805918d..6e55a32 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -7,45 +7,55 @@ - <%= link_to "Tab", root_path, class: "navbar-brand" %> + <%= link_to "TaĆ¾", root_path, class: "navbar-brand" %> diff --git a/app/views/orders/overview.html.erb b/app/views/orders/overview.html.erb index adbba94..364068c 100644 --- a/app/views/orders/overview.html.erb +++ b/app/views/orders/overview.html.erb @@ -1,15 +1,2 @@ -
-

sort by name

- - <% @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 %> -
-
-

sort by orders

- <% @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 %> -
+<%= render 'orders/user_list', users: @users_by_name %> +<%= render 'orders/user_list', users: @users_by_order %> diff --git a/db/migrate/20141209184030_add_admin_to_users.rb b/db/migrate/20141209184030_add_admin_to_users.rb new file mode 100644 index 0000000..2ddf290 --- /dev/null +++ b/db/migrate/20141209184030_add_admin_to_users.rb @@ -0,0 +1,5 @@ +class AddAdminToUsers < ActiveRecord::Migration + def change + add_column :users, :admin, :boolean + end +end diff --git a/db/schema.rb b/db/schema.rb index 002ed1e..abab8f7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -55,6 +55,7 @@ ActiveRecord::Schema.define(version: 20141209192545) do t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.integer "dagschotel_id" + t.boolean "admin" end end