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
# Airbrake
gem 'airbrake'
gem 'airbrake', '~> 4'
# Paginate stuff
gem 'will_paginate', '3.0.7'
@ -66,7 +66,7 @@ gem 'paperclip'
# Use devise for users and admins
gem 'devise'
gem 'omniauth-oauth2'
gem 'omniauth-oauth2', '1.3.1'
# Use cancancan for authorization
gem 'cancancan'

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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