Merge branch 'master' of github.com:ZeusWPI/Tab
Conflicts: app/assets/stylesheets/application.css.scss
This commit is contained in:
commit
86fc009c3f
|
@ -71,21 +71,6 @@ footer ul li {
|
||||||
margin-left: 15px;
|
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{
|
.overview{
|
||||||
//margin-left: 2px;
|
//margin-left: 2px;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
@ -93,9 +78,23 @@ footer ul li {
|
||||||
border-radius: 0px;
|
border-radius: 0px;
|
||||||
|
|
||||||
.btn{
|
.btn{
|
||||||
|
margin-top: -10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-color: #444;
|
border-color: #444;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dagschotel{
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user_img{
|
||||||
|
margin-left: 33%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.center{
|
.center{
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'digest/md5'
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
|
|
||||||
def get_color(user)
|
def get_color(user)
|
||||||
@color = Digest::MD5.hexdigest(user.name)[0..5]
|
@color = Digest::MD5.hexdigest(user.nickname)[0..5]
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_color_style(user)
|
def get_color_style(user)
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
# last_sign_in_at :datetime
|
# last_sign_in_at :datetime
|
||||||
# current_sign_in_ip :string(255)
|
# current_sign_in_ip :string(255)
|
||||||
# last_sign_in_ip :string(255)
|
# last_sign_in_ip :string(255)
|
||||||
|
# dagschotel :reference
|
||||||
|
# dagschotel_id :integer
|
||||||
#
|
#
|
||||||
|
|
||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
|
@ -23,11 +25,12 @@ class User < ActiveRecord::Base
|
||||||
:rememberable, :trackable
|
:rememberable, :trackable
|
||||||
|
|
||||||
has_many :orders, -> { includes :products }
|
has_many :orders, -> { includes :products }
|
||||||
|
belongs_to :dagschotel, class_name: 'Product'
|
||||||
|
|
||||||
validates :nickname, presence: true, uniqueness: true
|
validates :nickname, presence: true, uniqueness: true
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
validates :last_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
|
def full_name
|
||||||
"#{name} #{last_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 ">
|
<%= render 'orders/user_list', users: @users_by_name %>
|
||||||
<h3 class="center" >sort by name</h3>
|
<%= render 'orders/user_list', users: @users_by_order %>
|
||||||
|
|
||||||
<% @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 %>
|
|
||||||
|
|
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.
|
# 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|
|
create_table "order_products", force: true do |t|
|
||||||
t.integer "order_id"
|
t.integer "order_id"
|
||||||
|
@ -54,6 +54,7 @@ ActiveRecord::Schema.define(version: 20141209184030) do
|
||||||
t.datetime "last_sign_in_at"
|
t.datetime "last_sign_in_at"
|
||||||
t.string "current_sign_in_ip"
|
t.string "current_sign_in_ip"
|
||||||
t.string "last_sign_in_ip"
|
t.string "last_sign_in_ip"
|
||||||
|
t.integer "dagschotel_id"
|
||||||
t.boolean "admin"
|
t.boolean "admin"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
2
test/fixtures/users.yml
vendored
2
test/fixtures/users.yml
vendored
|
@ -16,6 +16,8 @@
|
||||||
# last_sign_in_at :datetime
|
# last_sign_in_at :datetime
|
||||||
# current_sign_in_ip :string(255)
|
# current_sign_in_ip :string(255)
|
||||||
# last_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
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
# last_sign_in_at :datetime
|
# last_sign_in_at :datetime
|
||||||
# current_sign_in_ip :string(255)
|
# current_sign_in_ip :string(255)
|
||||||
# last_sign_in_ip :string(255)
|
# last_sign_in_ip :string(255)
|
||||||
|
# dagschotel :reference
|
||||||
|
# dagschotel_id :integer
|
||||||
#
|
#
|
||||||
|
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
Loading…
Reference in a new issue