Merge branch 'master' of github.com:ZeusWPI/Tab
Conflicts: app/assets/stylesheets/application.css.scss
This commit is contained in:
commit
86fc009c3f
9 changed files with 49 additions and 44 deletions
|
@ -71,21 +71,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;
|
||||
width: 50%;
|
||||
|
@ -93,9 +78,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{
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'digest/md5'
|
|||
module ApplicationHelper
|
||||
|
||||
def get_color(user)
|
||||
@color = Digest::MD5.hexdigest(user.name)[0..5]
|
||||
@color = Digest::MD5.hexdigest(user.nickname)[0..5]
|
||||
end
|
||||
|
||||
def get_color_style(user)
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
# last_sign_in_at :datetime
|
||||
# current_sign_in_ip :string(255)
|
||||
# last_sign_in_ip :string(255)
|
||||
# dagschotel :reference
|
||||
# dagschotel_id :integer
|
||||
#
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
|
@ -23,11 +25,12 @@ class User < ActiveRecord::Base
|
|||
:rememberable, :trackable
|
||||
|
||||
has_many :orders, -> { includes :products }
|
||||
belongs_to :dagschotel, class_name: 'Product'
|
||||
|
||||
validates :nickname, presence: true, uniqueness: true
|
||||
validates :name, presence: true
|
||||
validates :last_name, presence: true
|
||||
validates :password, length: { in: 8..128 }, confirmation: true
|
||||
validates :password, length: { in: 8..128 }, confirmation: true, on: :create
|
||||
|
||||
def full_name
|
||||
"#{name} #{last_name}"
|
||||
|
|
17
app/views/orders/_user_list.html.erb
Normal file
17
app/views/orders/_user_list.html.erb
Normal file
|
@ -0,0 +1,17 @@
|
|||
<div class="col-md-6 ">
|
||||
<h3 class="center" >sort by name</h3>
|
||||
|
||||
<% users.each do |user| %>
|
||||
<div class="thumbnail overview">
|
||||
<%= link_to image_tag("http://placekitten.com/g/50/50", class: "img-circle dagschotel"),
|
||||
user %>
|
||||
<%= link_to image_tag("http://babeholder.pixoil.com/img/100/100", class: "img-circle user_img"),
|
||||
new_user_order_path(user) %>
|
||||
|
||||
|
||||
<%= link_to user.nickname , new_user_order_path(user), class: "btn btn-info",
|
||||
style: get_color_style(user) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
|
@ -1,26 +1,2 @@
|
|||
<div class="col-md-6 ">
|
||||
<h3 class="center" >sort by name</h3>
|
||||
|
||||
<% @users_by_name.each do |user| %>
|
||||
<div class="thumbnail overview">
|
||||
<%= 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) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-6 ">
|
||||
<h3 class="center" >sort by name</h3>
|
||||
|
||||
<% @users_by_order.each do |user| %>
|
||||
<div class="thumbnail overview">
|
||||
<%= 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) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= render 'orders/user_list', users: @users_by_name %>
|
||||
<%= render 'orders/user_list', users: @users_by_order %>
|
||||
|
|
5
db/migrate/20141209192545_add_dagschotel_to_users.rb
Normal file
5
db/migrate/20141209192545_add_dagschotel_to_users.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddDagschotelToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_reference :users, :dagschotel
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20141209184030) do
|
||||
ActiveRecord::Schema.define(version: 20141209192545) do
|
||||
|
||||
create_table "order_products", force: true do |t|
|
||||
t.integer "order_id"
|
||||
|
@ -54,6 +54,7 @@ ActiveRecord::Schema.define(version: 20141209184030) do
|
|||
t.datetime "last_sign_in_at"
|
||||
t.string "current_sign_in_ip"
|
||||
t.string "last_sign_in_ip"
|
||||
t.integer "dagschotel_id"
|
||||
t.boolean "admin"
|
||||
end
|
||||
|
||||
|
|
2
test/fixtures/users.yml
vendored
2
test/fixtures/users.yml
vendored
|
@ -16,6 +16,8 @@
|
|||
# last_sign_in_at :datetime
|
||||
# current_sign_in_ip :string(255)
|
||||
# last_sign_in_ip :string(255)
|
||||
# dagschotel :reference
|
||||
# dagschotel_id :integer
|
||||
#
|
||||
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
# last_sign_in_at :datetime
|
||||
# current_sign_in_ip :string(255)
|
||||
# last_sign_in_ip :string(255)
|
||||
# dagschotel :reference
|
||||
# dagschotel_id :integer
|
||||
#
|
||||
|
||||
require 'test_helper'
|
||||
|
|
Loading…
Reference in a new issue