From addf41999ae9b5008c03e9a59e54134a586aaacd Mon Sep 17 00:00:00 2001 From: ohsab Date: Wed, 10 Dec 2014 05:13:17 +0100 Subject: [PATCH] layout users monopoly stijl --- app/assets/stylesheets/application.css.scss | 9 ++++- app/assets/stylesheets/users.css.scss | 43 +++++++++++++++++++-- app/helpers/application_helper.rb | 4 +- app/views/orders/_user_list.html.erb | 29 ++++++-------- app/views/orders/index.html.erb | 11 +++++- app/views/users/_user.html.erb | 13 +++++-- db/seeds.rb | 3 +- 7 files changed, 81 insertions(+), 31 deletions(-) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index fbd81aa..f23eb96 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -74,18 +74,23 @@ footer ul li { width: 50%; float: left; border-radius: 0px; + margin-bottom: 0px; + border: 0px; .btn{ - margin-top: -10px; + margin-top: -55px; width: 100%; border-color: #444; } .dagschotel{ float:left; + position: absolute; } - .user_img{ + .avatar{ + height: 190px; + width: 190px; } } diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss index 650bff5..ddc2ba5 100644 --- a/app/assets/stylesheets/users.css.scss +++ b/app/assets/stylesheets/users.css.scss @@ -3,6 +3,45 @@ // You can use Sass (SCSS) here: http://sass-lang.com/ +.users .thumbnail { + padding: 0px; + min-height: 280px; + border: 3px solid #333; + .header{ + border-bottom: 3px solid #333; + text-align: center; + color: #fff; + padding-bottom: 10px; + padding-top: 15px; + margin: 0px; + + } + .caption{ + .avatar{ + float: right; + height: 70px; + width: 70px; + } + } + .footer{ + width:80%; + border-top: 1px dashed #333; + margin:10%; + margin-bottom: 5px; + .btn{ + width:100%; + margin-top:10px; + margin-bottom:0px; + } + } + background-color: #f5f5dc; +} + + + + + + /* sidebar */ aside { @@ -30,7 +69,3 @@ aside { } } } - -.users .thumbnail { - min-height: 330px; -} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b80b5f2..251c11f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,11 +2,11 @@ require 'digest/md5' module ApplicationHelper def get_color(user) - @color = Digest::MD5.hexdigest(user.nickname)[0..5] + Digest::MD5.hexdigest(user.nickname)[0..5] end def get_color_style(user) - @style = "background-color: #"+ get_color(user) +";" + "background-color: \#"+ get_color(user) +";" end def euro(f) diff --git a/app/views/orders/_user_list.html.erb b/app/views/orders/_user_list.html.erb index a3c2f2b..b56443d 100644 --- a/app/views/orders/_user_list.html.erb +++ b/app/views/orders/_user_list.html.erb @@ -1,18 +1,13 @@ -
-

sort by name

+<% users.each do |user| %> +
+ <%= link_to image_tag("http://placekitten.com/g/50/50", class: "img-circle dagschotel"), user %> + <% if user.avatar.exists? %> + <%= link_to image_tag(user.avatar , class: "img-circle avatar"), new_user_order_path(user) %> + <% else %> + <%= link_to image_tag("http://babeholder.pixoil.com/img/190/190", class: "img-circle user_img"), new_user_order_path(user) %> + <% end %> - <% users.each do |user| %> -
- <%= link_to image_tag("http://placekitten.com/g/50/50", class: "img-circle dagschotel"), user %> - <% if user.avatar.exists? %> - <%= link_to image_tag(user.avatar), new_user_order_path(user) %> - <% else %> - <%= link_to image_tag("http://babeholder.pixoil.com/img/100/100", class: "img-circle user_img"), new_user_order_path(user) %> - <% end %> - - <%= link_to user.name , new_user_order_path(user), class: "btn btn-info", - style: get_color_style(user) %> -
- <% end %> - -
+ <%= link_to user.name , new_user_order_path(user), class: "btn btn-info", + style: get_color_style(user) %> +
+<% end %> diff --git a/app/views/orders/index.html.erb b/app/views/orders/index.html.erb index c6b1da1..4ba80cf 100644 --- a/app/views/orders/index.html.erb +++ b/app/views/orders/index.html.erb @@ -1,4 +1,11 @@ <%= render partial: 'flash' %> -<%= render 'orders/user_list', users: @users_by_name %> -<%= render 'orders/user_list', users: @users_by_order %> +
+

sort by name

+ <%= render 'orders/user_list', users: @users_by_name %> +
+ +
+

sort by order

+ <%= render 'orders/user_list', users: @users_by_order %> +
diff --git a/app/views/users/_user.html.erb b/app/views/users/_user.html.erb index df67bcf..e9bbd8c 100644 --- a/app/views/users/_user.html.erb +++ b/app/views/users/_user.html.erb @@ -1,15 +1,22 @@
-
- <%= image_tag user.avatar if user.avatar.exists? %> +
+

<%= user.full_name %>

-

<%= user.full_name %>

+ <% if user.avatar.exists? %> + <%= link_to image_tag(user.avatar , class: "img-circle avatar"), new_user_order_path(user) %> + <% else %> + <%= link_to image_tag("http://babeholder.pixoil.com/img/70/70", class: "img-circle avatar"), new_user_order_path(user) %> + <% end %>

Name: <%= user.name %>

Last name: <%= user.last_name %>

Nickname: <%= user.nickname %>

Balance: <%= user.balance %>

+
+
diff --git a/db/seeds.rb b/db/seeds.rb index 14d3c39..da5deda 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -9,12 +9,13 @@ User.create! name: "Mats", nickname: "Basho", last_name: "Myncke", + admin: true, password: "banaan12", password_confirmation: "banaan12" 99.times do |n| name = Faker::Name.first_name - nickname = Faker::Name.title + nickname = Faker::Name.first_name last_name = Faker::Name.last_name password = "password"