Merge branch 'master' of github.com:ZeusWPI/Tap

This commit is contained in:
benji 2016-02-02 18:37:09 +01:00
commit 7969b71564
9 changed files with 47 additions and 41 deletions

View file

@ -55,7 +55,7 @@ group :development, :test do
end end
# Airbrake # Airbrake
gem 'airbrake' gem 'airbrake', '~> 4'
# Paginate stuff # Paginate stuff
gem 'will_paginate', '3.0.7' gem 'will_paginate', '3.0.7'
@ -66,7 +66,7 @@ gem 'paperclip'
# Use devise for users and admins # Use devise for users and admins
gem 'devise' gem 'devise'
gem 'omniauth-oauth2' gem 'omniauth-oauth2', '1.3.1'
# Use cancancan for authorization # Use cancancan for authorization
gem 'cancancan' gem 'cancancan'

View file

@ -39,8 +39,8 @@ GEM
airbrake (4.3.4) airbrake (4.3.4)
builder builder
multi_json multi_json
annotate (2.6.10) annotate (2.7.0)
activerecord (>= 3.2, <= 4.3) activerecord (>= 3.2, < 6.0)
rake (~> 10.4) rake (~> 10.4)
arel (6.0.3) arel (6.0.3)
bcrypt (3.1.10) bcrypt (3.1.10)
@ -58,7 +58,7 @@ GEM
capistrano-bundler (1.1.4) capistrano-bundler (1.1.4)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.2) sshkit (~> 1.2)
capistrano-passenger (0.1.1) capistrano-passenger (0.2.0)
capistrano (~> 3.0) capistrano (~> 3.0)
capistrano-rails (1.1.5) capistrano-rails (1.1.5)
capistrano (~> 3.1) capistrano (~> 3.1)
@ -77,14 +77,13 @@ GEM
codeclimate-test-reporter (0.4.8) codeclimate-test-reporter (0.4.8)
simplecov (>= 0.7.1, < 1.0.0) simplecov (>= 0.7.1, < 1.0.0)
coderay (1.1.0) coderay (1.1.0)
coffee-rails (4.1.0) coffee-rails (4.1.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.10.0) coffee-script-source (1.10.0)
colorize (0.7.7)
coveralls (0.8.10) coveralls (0.8.10)
json (~> 1.8) json (~> 1.8)
rest-client (>= 1.6.8, < 2) rest-client (>= 1.6.8, < 2)
@ -98,7 +97,7 @@ GEM
delayed_job_active_record (4.1.0) delayed_job_active_record (4.1.0)
activerecord (>= 3.0, < 5) activerecord (>= 3.0, < 5)
delayed_job (>= 3.0, < 5) delayed_job (>= 3.0, < 5)
devise (3.5.2) devise (3.5.3)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 3.2.6, < 5)
@ -170,11 +169,11 @@ GEM
mysql2 (0.4.2-x64-mingw32) mysql2 (0.4.2-x64-mingw32)
net-scp (1.2.1) net-scp (1.2.1)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (3.0.1) net-ssh (3.0.2)
netrc (0.11.0) netrc (0.11.0)
nokogiri (1.6.7) nokogiri (1.6.7.1)
mini_portile2 (~> 2.0.0.rc2) mini_portile2 (~> 2.0.0.rc2)
nokogiri (1.6.7-x64-mingw32) nokogiri (1.6.7.1-x64-mingw32)
mini_portile2 (~> 2.0.0.rc2) mini_portile2 (~> 2.0.0.rc2)
oauth2 (1.0.0) oauth2 (1.0.0)
faraday (>= 0.8, < 0.10) faraday (>= 0.8, < 0.10)
@ -182,10 +181,10 @@ GEM
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (~> 1.2) rack (~> 1.2)
omniauth (1.2.2) omniauth (1.3.1)
hashie (>= 1.2, < 4) hashie (>= 1.2, < 4)
rack (~> 1.0) rack (>= 1.0, < 3)
omniauth-oauth2 (1.4.0) omniauth-oauth2 (1.3.1)
oauth2 (~> 1.0) oauth2 (~> 1.0)
omniauth (~> 1.2) omniauth (~> 1.2)
orm_adapter (0.5.0) orm_adapter (0.5.0)
@ -229,9 +228,10 @@ GEM
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (10.4.2) rake (10.4.2)
rdoc (4.2.0) rdoc (4.2.1)
responders (2.1.0) json (~> 1.4)
railties (>= 4.2.0, < 5) responders (2.1.1)
railties (>= 4.2.0, < 5.1)
rest-client (1.8.0) rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0) mime-types (>= 1.16, < 3.0)
@ -270,13 +270,13 @@ GEM
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0) rdoc (~> 4.0)
sexp_processor (4.6.0) sexp_processor (4.6.0)
simplecov (0.11.0) simplecov (0.11.1)
docile (~> 1.1.0) docile (~> 1.1.0)
json (~> 1.8) json (~> 1.8)
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
simplecov-html (0.10.0) simplecov-html (0.10.0)
slop (3.6.0) slop (3.6.0)
spring (1.5.0) spring (1.6.1)
sprockets (2.12.4) sprockets (2.12.4)
hike (~> 1.2) hike (~> 1.2)
multi_json (~> 1.0) multi_json (~> 1.0)
@ -288,8 +288,7 @@ GEM
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.11) sqlite3 (1.3.11)
sqlite3 (1.3.11-x64-mingw32) sqlite3 (1.3.11-x64-mingw32)
sshkit (1.7.1) sshkit (1.8.1)
colorize (>= 0.7.0)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
term-ansicolor (1.3.2) term-ansicolor (1.3.2)
@ -309,7 +308,7 @@ GEM
unf_ext unf_ext
unf_ext (0.0.7.1) unf_ext (0.0.7.1)
unf_ext (0.0.7.1-x64-mingw32) unf_ext (0.0.7.1-x64-mingw32)
warden (1.2.3) warden (1.2.4)
rack (>= 1.0) rack (>= 1.0)
will_paginate (3.0.7) will_paginate (3.0.7)
@ -318,7 +317,7 @@ PLATFORMS
x64-mingw32 x64-mingw32
DEPENDENCIES DEPENDENCIES
airbrake airbrake (~> 4)
annotate annotate
bootstrap-sass (= 3.2.0.0) bootstrap-sass (= 3.2.0.0)
bootstrap-will_paginate (= 0.0.10) bootstrap-will_paginate (= 0.0.10)
@ -342,7 +341,7 @@ DEPENDENCIES
identicon identicon
jquery-rails jquery-rails
mysql2 mysql2
omniauth-oauth2 omniauth-oauth2 (= 1.3.1)
paperclip paperclip
pry-rails pry-rails
rails (= 4.2.4) rails (= 4.2.4)

View file

@ -20,7 +20,6 @@
} }
} }
.warning { .guest {
border: 2px solid;
margin-bottom: 20px; margin-bottom: 20px;
} }

View file

@ -8,9 +8,9 @@ class WelcomeController < ApplicationController
if user_signed_in? || params[:token] != Rails.application.secrets.koelkast_token if user_signed_in? || params[:token] != Rails.application.secrets.koelkast_token
redirect_to root_path redirect_to root_path
return return
else
koelkast = User.find_by(name: "koelkast")
sign_in_and_redirect koelkast
end end
koelkast = User.koelkast
sign_in_and_redirect koelkast
end end
end end

View file

@ -4,7 +4,7 @@ class Ability
def initialize(user) def initialize(user)
return unless user return unless user
initialize_admin if user.admin? initialize_admin if user.admin?
initialize_koelkast if user.koelkast? initialize_koelkast if user.koelkast?
initialize_user(user) initialize_user(user)

View file

@ -16,5 +16,5 @@ class Barcode < ActiveRecord::Base
belongs_to :product belongs_to :product
validates :product, presence: true validates :product, presence: true
validates :code, presence: true, uniqueness: true validates :code, presence: true, uniqueness: true
end end

View file

@ -21,7 +21,7 @@ class Product < ActiveRecord::Base
include Avatarable include Avatarable
has_many :order_items has_many :order_items
has_many :barcodes has_many :barcodes, dependent: :destroy
accepts_nested_attributes_for :barcodes accepts_nested_attributes_for :barcodes
enum category: %w(food beverages other) enum category: %w(food beverages other)

View file

@ -56,6 +56,8 @@ class User < ActiveRecord::Base
end end
end end
# Static Users
def self.guest def self.guest
@guest || find_or_create_by(name: "Guest") do |user| @guest || find_or_create_by(name: "Guest") do |user|
user.avatar = File.new(File.join("app", "assets", "images", "guest.png")) user.avatar = File.new(File.join("app", "assets", "images", "guest.png"))
@ -65,4 +67,11 @@ class User < ActiveRecord::Base
def guest? def guest?
self == User.guest self == User.guest
end end
def self.koelkast
@koelkast || find_or_create_by(name: "Koelkast") do |user|
user.avatar = File.new(File.join("app", "assets", "images", "logo.png"))
user.koelkast = true
end
end
end end

View file

@ -1,13 +1,12 @@
.warning.center
%h1 TESTFASE | GELIEVE STREEPJES TE BLIJVEN ZETTEN | TESTFASE
.row .row
.col-md-1 .col-md-1
%h5 Recent - unless @last.empty?
#last %h5 Recent
- @last.each do |user| #last
= image_tag user.avatar(:small), class: "img-responsive img-circle img-thumbnail" - @last.each do |user|
= image_tag user.avatar(:small), class: "img-responsive img-circle img-thumbnail"
.col-md-11 .col-md-11
.row.text-center .row.text-center.guest
=link_to "Not a Zeus Account? Order as a guest.", new_guest_order_path, class: "btn btn-primary btn-lg" =link_to "Not a Zeus Account? Order as a guest.", new_guest_order_path, class: "btn btn-default btn-lg"
.row .row
= render @users = render @users