From 00dcd98a9337b6a47faef697a2cc23887c54afce Mon Sep 17 00:00:00 2001 From: ohsab Date: Tue, 9 Dec 2014 19:44:48 +0100 Subject: [PATCH 1/3] overview view mooi gemaakt --- app/assets/stylesheets/application.css.scss | 17 +++++++++++++++-- app/views/orders/overview.html.erb | 17 ++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 5e44107..2f32111 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -92,19 +92,32 @@ footer ul li { margin-left: 15px; } -.overview{ +.usercontainer{ + position: absolute; width: 49%; - height: 49%; border-radius: 0px; margin: -2px; padding: 18px; border-color: #000; border: 0px; + vertical-align: bottom; + font-weight: bold; font-size: 24px; +} +.overview{ + //margin-left: 2px; + width: 50%; + float: left; + border-radius: 0px; + + .btn{ + width: 100%; + border-color: #444; + } } .center{ diff --git a/app/views/orders/overview.html.erb b/app/views/orders/overview.html.erb index adbba94..7d21183 100644 --- a/app/views/orders/overview.html.erb +++ b/app/views/orders/overview.html.erb @@ -2,14 +2,25 @@

sort by name

<% @users_by_name.each do |user| %> +
+ <%= link_to image_tag("http://placehold.it/100x100", class: "img-circle"), + new_user_order_path(user) %> <%= link_to user.name , new_user_order_path(user), class: "btn btn-info overview", style: get_color_style(user) %> +
<% end %> + -
-

sort by orders

+ + +
+

sort by name

+ <% @users_by_order.each do |user| %> +
+ <%= link_to image_tag("http://babeholder.pixoil.com/img/100/100", class: "img-circle"), + new_user_order_path(user) %> <%= link_to user.name , new_user_order_path(user), class: "btn btn-info overview", style: get_color_style(user) %> +
<% end %> -
From bdf4b6771f2141d368edbad56f396663b5b75922 Mon Sep 17 00:00:00 2001 From: Tom Naessens Date: Tue, 9 Dec 2014 19:44:58 +0100 Subject: [PATCH 2/3] Add cancan, fix header, add admins --- Gemfile | 4 +- Gemfile.lock | 4 +- app/models/ability.rb | 12 +++++ app/views/layouts/_header.html.erb | 50 +++++++++++-------- .../20141209184030_add_admin_to_users.rb | 5 ++ db/schema.rb | 3 +- 6 files changed, 53 insertions(+), 25 deletions(-) create mode 100644 app/models/ability.rb create mode 100644 db/migrate/20141209184030_add_admin_to_users.rb 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/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/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 e52179a..d3d9759 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20141209172818) do +ActiveRecord::Schema.define(version: 20141209184030) do create_table "order_products", force: true do |t| t.integer "order_id" @@ -54,6 +54,7 @@ ActiveRecord::Schema.define(version: 20141209172818) do t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" + t.boolean "admin" end end From f247e6c5ff5e970a2c1bb0788ca9f914e871eb41 Mon Sep 17 00:00:00 2001 From: ohsab Date: Tue, 9 Dec 2014 20:26:18 +0100 Subject: [PATCH 3/3] dagschotel button added --- app/assets/stylesheets/application.css.scss | 29 ++++++++++----------- app/views/orders/overview.html.erb | 28 ++------------------ 2 files changed, 16 insertions(+), 41 deletions(-) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 2f32111..e94bbe8 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -92,21 +92,6 @@ footer ul li { margin-left: 15px; } -.usercontainer{ - position: absolute; - width: 49%; - border-radius: 0px; - margin: -2px; - padding: 18px; - border-color: #000; - border: 0px; - vertical-align: bottom; - - - font-weight: bold; - font-size: 24px; - -} .overview{ //margin-left: 2px; @@ -115,9 +100,23 @@ footer ul li { border-radius: 0px; .btn{ + margin-top: -10px; width: 100%; border-color: #444; } + + .dagschotel{ + float:left; + } + + .user_img{ + margin-left: 33%; + + } + + + + } .center{ diff --git a/app/views/orders/overview.html.erb b/app/views/orders/overview.html.erb index 7d21183..364068c 100644 --- a/app/views/orders/overview.html.erb +++ b/app/views/orders/overview.html.erb @@ -1,26 +1,2 @@ -
-

sort by name

- - <% @users_by_name.each do |user| %> -
- <%= link_to image_tag("http://placehold.it/100x100", class: "img-circle"), - new_user_order_path(user) %> - <%= link_to user.name , new_user_order_path(user), class: "btn btn-info overview", - style: get_color_style(user) %> -
- <% end %> - -
- - -
-

sort by name

- - <% @users_by_order.each do |user| %> -
- <%= link_to image_tag("http://babeholder.pixoil.com/img/100/100", class: "img-circle"), - new_user_order_path(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 %>