Merge branch 'master' of github.com:ZeusWPI/Tab
This commit is contained in:
commit
68d1e235fc
5 changed files with 49 additions and 10 deletions
|
@ -89,10 +89,20 @@ footer ul li {
|
|||
}
|
||||
|
||||
.overview{
|
||||
width: 33%;
|
||||
margin-bottom: 5px;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
width: 49%;
|
||||
height: 49%;
|
||||
border-radius: 0px;
|
||||
margin: -2px;
|
||||
padding: 18px;
|
||||
border-color: #000;
|
||||
border: 0px;
|
||||
|
||||
font-weight: bold;
|
||||
font-size: 24px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.center{
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class OrdersController < ApplicationController
|
||||
def overview
|
||||
@users = User.all
|
||||
@users_by_name = User.all.order(:name)
|
||||
@users_by_order = User.all
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
require 'digest/md5'
|
||||
module ApplicationHelper
|
||||
|
||||
def get_color(user)
|
||||
@color = Digest::MD5.hexdigest(user.name)[0..5]
|
||||
end
|
||||
|
||||
def get_inverted_color(user)
|
||||
@inverted_color = Digest::MD5.hexdigest(user.name)[0..5].reverse
|
||||
end
|
||||
|
||||
def get_color_style(user)
|
||||
@style = "background-color: #"+ get_color(user) +"; color: #"+
|
||||
get_inverted_color(user)+ ";"
|
||||
end
|
||||
|
||||
#tijdelijk voor layout
|
||||
def koelkast(status)
|
||||
@koelkast ||= status
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<div class="container">
|
||||
|
||||
<%= yield %>
|
||||
|
||||
<%= render "layouts/footer" %>
|
||||
|
||||
<%#= render "layouts/footer" %>
|
||||
</div>
|
||||
|
||||
<%= debug(params) if Rails.env.development? %>
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
<% @users.each do |user| %>
|
||||
<%= link_to user.name , new_user_order_path(user), class: "btn btn-info overview"%>
|
||||
<% end %>
|
||||
<div class="col-md-6 ">
|
||||
<h3 class="center" >sort by name</h3>
|
||||
|
||||
<% @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>
|
||||
|
|
Loading…
Reference in a new issue