Remove some gems
This commit is contained in:
parent
442c694122
commit
76f8332e97
13
Gemfile
13
Gemfile
|
@ -1,6 +1,5 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
|
||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '4.2'
|
gem 'rails', '4.2'
|
||||||
|
|
||||||
|
@ -8,19 +7,15 @@ gem 'rails', '4.2'
|
||||||
gem 'sass-rails', '~> 4.0.3'
|
gem 'sass-rails', '~> 4.0.3'
|
||||||
gem 'bootstrap-sass', '3.2.0.0'
|
gem 'bootstrap-sass', '3.2.0.0'
|
||||||
gem 'uglifier', '>= 1.3.0'
|
gem 'uglifier', '>= 1.3.0'
|
||||||
gem 'coffee-rails', '~> 4.0.0'
|
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
# Haml for templating!
|
# Haml for templating!
|
||||||
gem "haml-rails", "~> 0.9"
|
gem "haml-rails", "~> 0.9"
|
||||||
|
|
||||||
# Responders
|
|
||||||
gem 'responders', '~> 2.0'
|
|
||||||
|
|
||||||
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
||||||
gem 'turbolinks'
|
gem 'turbolinks'
|
||||||
|
|
||||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
# Friendly ids!
|
||||||
gem 'jbuilder', '~> 2.0'
|
gem 'friendly_id', '~> 5.1.0'
|
||||||
|
|
||||||
group :doc do
|
group :doc do
|
||||||
gem 'sdoc', '~> 0.4.0'
|
gem 'sdoc', '~> 0.4.0'
|
||||||
|
@ -57,7 +52,6 @@ group :development, :test do
|
||||||
gem 'factory_girl_rails'
|
gem 'factory_girl_rails'
|
||||||
gem 'faker', '1.4.2'
|
gem 'faker', '1.4.2'
|
||||||
gem 'pry-rails'
|
gem 'pry-rails'
|
||||||
gem 'pry-byebug'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Airbrake
|
# Airbrake
|
||||||
|
@ -77,9 +71,6 @@ gem 'omniauth-oauth2'
|
||||||
# Use cancancan for authorization
|
# Use cancancan for authorization
|
||||||
gem 'cancancan'
|
gem 'cancancan'
|
||||||
|
|
||||||
# Safety first
|
|
||||||
gem 'paper_trail', '~> 4.0.0.beta'
|
|
||||||
|
|
||||||
# Default avatar for users
|
# Default avatar for users
|
||||||
gem 'identicon'
|
gem 'identicon'
|
||||||
|
|
||||||
|
|
23
Gemfile.lock
23
Gemfile.lock
|
@ -50,10 +50,6 @@ GEM
|
||||||
bootstrap-will_paginate (0.0.10)
|
bootstrap-will_paginate (0.0.10)
|
||||||
will_paginate
|
will_paginate
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
byebug (3.5.1)
|
|
||||||
columnize (~> 0.8)
|
|
||||||
debugger-linecache (~> 1.2)
|
|
||||||
slop (~> 3.6)
|
|
||||||
cancancan (1.10.1)
|
cancancan (1.10.1)
|
||||||
capistrano (3.3.5)
|
capistrano (3.3.5)
|
||||||
capistrano-stats (~> 1.1.0)
|
capistrano-stats (~> 1.1.0)
|
||||||
|
@ -91,7 +87,6 @@ GEM
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.9.0)
|
coffee-script-source (1.9.0)
|
||||||
colorize (0.7.5)
|
colorize (0.7.5)
|
||||||
columnize (0.9.0)
|
|
||||||
coveralls (0.7.11)
|
coveralls (0.7.11)
|
||||||
multi_json (~> 1.10)
|
multi_json (~> 1.10)
|
||||||
rest-client (>= 1.6.8, < 2)
|
rest-client (>= 1.6.8, < 2)
|
||||||
|
@ -99,7 +94,6 @@ GEM
|
||||||
term-ansicolor (~> 1.3)
|
term-ansicolor (~> 1.3)
|
||||||
thor (~> 0.19.1)
|
thor (~> 0.19.1)
|
||||||
daemons (1.2.3)
|
daemons (1.2.3)
|
||||||
debugger-linecache (1.2.0)
|
|
||||||
delayed_job (4.0.6)
|
delayed_job (4.0.6)
|
||||||
activesupport (>= 3.0, < 5.0)
|
activesupport (>= 3.0, < 5.0)
|
||||||
delayed_job_active_record (4.0.3)
|
delayed_job_active_record (4.0.3)
|
||||||
|
@ -126,6 +120,8 @@ GEM
|
||||||
faraday (0.9.1)
|
faraday (0.9.1)
|
||||||
multipart-post (>= 1.2, < 3)
|
multipart-post (>= 1.2, < 3)
|
||||||
ffi (1.9.6-x64-mingw32)
|
ffi (1.9.6-x64-mingw32)
|
||||||
|
friendly_id (5.1.0)
|
||||||
|
activerecord (>= 4.0.0)
|
||||||
globalid (0.3.2)
|
globalid (0.3.2)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
haml (4.0.7)
|
haml (4.0.7)
|
||||||
|
@ -149,9 +145,6 @@ GEM
|
||||||
i18n (0.7.0)
|
i18n (0.7.0)
|
||||||
identicon (0.0.3)
|
identicon (0.0.3)
|
||||||
chunky_png
|
chunky_png
|
||||||
jbuilder (2.2.6)
|
|
||||||
activesupport (>= 3.0.0, < 5)
|
|
||||||
multi_json (~> 1.2)
|
|
||||||
jquery-rails (4.0.3)
|
jquery-rails (4.0.3)
|
||||||
rails-dom-testing (~> 1.0)
|
rails-dom-testing (~> 1.0)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
|
@ -193,9 +186,6 @@ GEM
|
||||||
oauth2 (~> 1.0)
|
oauth2 (~> 1.0)
|
||||||
omniauth (~> 1.2)
|
omniauth (~> 1.2)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
paper_trail (4.0.0.beta2)
|
|
||||||
activerecord (>= 3.0, < 6.0)
|
|
||||||
activesupport (>= 3.0, < 6.0)
|
|
||||||
paperclip (4.2.1)
|
paperclip (4.2.1)
|
||||||
activemodel (>= 3.0.0)
|
activemodel (>= 3.0.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
|
@ -210,9 +200,6 @@ GEM
|
||||||
method_source (~> 0.8.1)
|
method_source (~> 0.8.1)
|
||||||
slop (~> 3.4)
|
slop (~> 3.4)
|
||||||
win32console (~> 1.3)
|
win32console (~> 1.3)
|
||||||
pry-byebug (3.0.1)
|
|
||||||
byebug (~> 3.4)
|
|
||||||
pry (~> 0.10)
|
|
||||||
pry-rails (0.3.4)
|
pry-rails (0.3.4)
|
||||||
pry (>= 0.9.10)
|
pry (>= 0.9.10)
|
||||||
rack (1.6.0)
|
rack (1.6.0)
|
||||||
|
@ -339,7 +326,6 @@ DEPENDENCIES
|
||||||
capistrano-rbenv
|
capistrano-rbenv
|
||||||
capistrano-rvm
|
capistrano-rvm
|
||||||
codeclimate-test-reporter
|
codeclimate-test-reporter
|
||||||
coffee-rails (~> 4.0.0)
|
|
||||||
coveralls
|
coveralls
|
||||||
daemons
|
daemons
|
||||||
delayed_job (~> 4.0)
|
delayed_job (~> 4.0)
|
||||||
|
@ -347,19 +333,16 @@ DEPENDENCIES
|
||||||
devise
|
devise
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
faker (= 1.4.2)
|
faker (= 1.4.2)
|
||||||
|
friendly_id (~> 5.1.0)
|
||||||
haml-rails (~> 0.9)
|
haml-rails (~> 0.9)
|
||||||
httparty
|
httparty
|
||||||
identicon
|
identicon
|
||||||
jbuilder (~> 2.0)
|
|
||||||
jquery-rails
|
jquery-rails
|
||||||
mysql2
|
mysql2
|
||||||
omniauth-oauth2
|
omniauth-oauth2
|
||||||
paper_trail (~> 4.0.0.beta)
|
|
||||||
paperclip
|
paperclip
|
||||||
pry-byebug
|
|
||||||
pry-rails
|
pry-rails
|
||||||
rails (= 4.2)
|
rails (= 4.2)
|
||||||
responders (~> 2.0)
|
|
||||||
rspec-rails
|
rspec-rails
|
||||||
sass-rails (~> 4.0.3)
|
sass-rails (~> 4.0.3)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
66
app/assets/javascripts/orders.js
Normal file
66
app/assets/javascripts/orders.js
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
// Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
// All this logic will automatically be available in application.js.
|
||||||
|
// You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
|
ready = function() {
|
||||||
|
$('.btn-inc').on('click', function() {
|
||||||
|
increment($(this), 1);
|
||||||
|
});
|
||||||
|
$('.btn-dec').on('click', function() {
|
||||||
|
increment($(this), -1);
|
||||||
|
});
|
||||||
|
$('.form_row').each(function(index, row) {
|
||||||
|
updateInput(row, false);
|
||||||
|
$(row).on('input', function() {
|
||||||
|
updateInput(row);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
recalculate();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Validate input, and then update
|
||||||
|
updateInput = function(row, useRecalculate) {
|
||||||
|
if (useRecalculate == null) {
|
||||||
|
useRecalculate = true;
|
||||||
|
}
|
||||||
|
cell = row.querySelector("input");
|
||||||
|
if (!cell.validity.valid) {
|
||||||
|
if (parseInt(cell.value) > parseInt(cell.max)) {
|
||||||
|
cell.value = parseInt(cell.max);
|
||||||
|
} else {
|
||||||
|
cell.value = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
disIfNec(row)
|
||||||
|
if (useRecalculate) {
|
||||||
|
recalculate()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
disIfNec = function(row) {
|
||||||
|
counter = parseInt($(row).find('.row_counter').val())
|
||||||
|
$(row).find('.btn-dec').prop('disabled', counter === 0)
|
||||||
|
$(row).find('.btn-inc').prop('disabled', counter === parseInt($(row).find('.row_counter').attr('max')))
|
||||||
|
};
|
||||||
|
|
||||||
|
recalculate = function() {
|
||||||
|
sum = 0
|
||||||
|
$('.row_counter').each(function(i, value) { sum += parseInt($(value).val()) * parseInt($(value).data('price')) })
|
||||||
|
return $('#order_price').html((sum / 100.0).toFixed(2))
|
||||||
|
};
|
||||||
|
|
||||||
|
increment = function(button, n) {
|
||||||
|
row = $(button).closest('.form_row')
|
||||||
|
|
||||||
|
// Fix the counter
|
||||||
|
counter = $(row).find('.row_counter')
|
||||||
|
value = parseInt(counter.val())
|
||||||
|
if (isNaN(value)) {
|
||||||
|
value = 0
|
||||||
|
}
|
||||||
|
counter.val(value + n)
|
||||||
|
|
||||||
|
updateInput(row[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(ready);
|
||||||
|
$(document).on('page:load', ready);
|
|
@ -1,60 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
||||||
ready = ->
|
|
||||||
$('.btn-inc').on 'click', ->
|
|
||||||
increment($(this), 1)
|
|
||||||
|
|
||||||
$('.btn-dec').on 'click', ->
|
|
||||||
increment($(this), -1)
|
|
||||||
|
|
||||||
$('.form_row').each((index, row) ->
|
|
||||||
updateInput(row, false)
|
|
||||||
$(row).on('input', ->
|
|
||||||
updateInput(row)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
recalculate()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Validate input, and then update
|
|
||||||
updateInput = (row, useRecalculate = true) ->
|
|
||||||
cell = row.querySelector("input")
|
|
||||||
if ! cell.validity.valid
|
|
||||||
if(parseInt(cell.value) > parseInt(cell.max))
|
|
||||||
cell.value = parseInt(cell.max)
|
|
||||||
else
|
|
||||||
cell.value = 0
|
|
||||||
|
|
||||||
# Disable buttons if necessary
|
|
||||||
disIfNec(row)
|
|
||||||
|
|
||||||
if useRecalculate
|
|
||||||
recalculate();
|
|
||||||
|
|
||||||
|
|
||||||
disIfNec = (row) ->
|
|
||||||
counter = parseInt($(row).find('.row_counter').val())
|
|
||||||
$(row).find('.btn-dec').prop('disabled', counter == 0);
|
|
||||||
$(row).find('.btn-inc').prop('disabled', counter == parseInt($(row).find('.row_counter').attr('max')))
|
|
||||||
|
|
||||||
recalculate = () ->
|
|
||||||
value = ($(row).val() * $(row).data('price') for row in $('.row_counter')).reduce(((a, b) -> a+b), 0)
|
|
||||||
$('#order_price').html((value / 100.0).toFixed(2))
|
|
||||||
|
|
||||||
increment = (button, n) ->
|
|
||||||
row = $(button).closest('.form_row')
|
|
||||||
|
|
||||||
# Fix the counter
|
|
||||||
counter = $(row).find('.row_counter')
|
|
||||||
value = parseInt(counter.val())
|
|
||||||
if isNaN(value)
|
|
||||||
value = 0
|
|
||||||
counter.val(value + n)
|
|
||||||
|
|
||||||
updateInput(row[0])
|
|
||||||
|
|
||||||
$(document).ready(ready)
|
|
||||||
$(document).on('page:load', ready)
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Place all the behaviors and hooks related to the matching controller here.
|
|
||||||
# All this logic will automatically be available in application.js.
|
|
||||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
|
@ -4,7 +4,7 @@ TabApiJob = Struct.new(:order_id) do
|
||||||
if order && !order.transaction_id
|
if order && !order.transaction_id
|
||||||
body = {
|
body = {
|
||||||
transaction: {
|
transaction: {
|
||||||
debtor: order.user.uid,
|
debtor: order.user.name,
|
||||||
cents: order.price_cents,
|
cents: order.price_cents,
|
||||||
message: order.to_sentence,
|
message: order.to_sentence,
|
||||||
id_at_client: order.id
|
id_at_client: order.id
|
||||||
|
@ -14,7 +14,7 @@ TabApiJob = Struct.new(:order_id) do
|
||||||
"Authorization" => "Token token=#{Rails.application.secrets.tab_api_key}"
|
"Authorization" => "Token token=#{Rails.application.secrets.tab_api_key}"
|
||||||
}
|
}
|
||||||
|
|
||||||
result = HTTParty.post("https://zeus.ugent.be/tab/transactions", body: body, headers: headers )
|
result = HTTParty.post(File.join(Rails.application.config.api_url, "transactions"), body: body, headers: headers )
|
||||||
order.update_attribute(:transaction_id, JSON.parse(result.body)["id"].to_i)
|
order.update_attribute(:transaction_id, JSON.parse(result.body)["id"].to_i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
18
app/models/concerns/avatarable.rb
Normal file
18
app/models/concerns/avatarable.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
module Avatarable
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
avatar_styles = {
|
||||||
|
large: "150x150>",
|
||||||
|
medium: "100x100>",
|
||||||
|
dagschotel: "80x80>",
|
||||||
|
small: "40x40>"
|
||||||
|
}
|
||||||
|
|
||||||
|
has_attached_file :avatar, styles: avatar_styles, default_style: :medium
|
||||||
|
|
||||||
|
validates_attachment :avatar,
|
||||||
|
presence: true,
|
||||||
|
content_type: { content_type: ["image/jpeg", "image/gif", "image/png"] }
|
||||||
|
end
|
||||||
|
end
|
|
@ -22,7 +22,6 @@ class Order < ActiveRecord::Base
|
||||||
after_create :create_api_job
|
after_create :create_api_job
|
||||||
|
|
||||||
validates :user, presence: true
|
validates :user, presence: true
|
||||||
validates :price_cents, presence: true
|
|
||||||
validates_associated :order_items
|
validates_associated :order_items
|
||||||
validate :product_presence
|
validate :product_presence
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ class OrderItem < ActiveRecord::Base
|
||||||
belongs_to :product
|
belongs_to :product
|
||||||
|
|
||||||
validates :product, presence: true
|
validates :product, presence: true
|
||||||
validates :count, presence: true, numericality: { only_integer: true,
|
validates :count, presence: true, numericality: { only_integer: true,
|
||||||
less_than_or_equal_to: ->(oi) { oi.product.try(:stock) || 100 },
|
less_than_or_equal_to: ->(oi) { oi.product.try(:stock) || 100 },
|
||||||
greater_than_or_equal_to: 0 }
|
greater_than_or_equal_to: 0 }
|
||||||
|
|
||||||
before_destroy :put_back_in_stock!
|
before_destroy :put_back_in_stock!
|
||||||
after_create :remove_from_stock!
|
after_create :remove_from_stock!
|
||||||
|
|
|
@ -18,18 +18,16 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class Product < ActiveRecord::Base
|
class Product < ActiveRecord::Base
|
||||||
|
include Avatarable
|
||||||
|
|
||||||
has_many :order_items
|
has_many :order_items
|
||||||
has_attached_file :avatar, styles: { dagschotel: "80x80>", medium: "100x100>", small: "40x40>" }, default_style: :medium
|
|
||||||
|
|
||||||
enum category: %w(food beverages other)
|
enum category: %w(food beverages other)
|
||||||
|
|
||||||
validates :name, presence: true
|
validates :name, presence: true
|
||||||
validates :price_cents, numericality: { only_integer: true, greater_than: 0 }
|
validates :price_cents, presence: true, numericality: { only_integer: true, greater_than: 0 }
|
||||||
validates :stock, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
validates :stock, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
||||||
validates :calories, numericality: { only_integer: true, allow_nil: true, greater_than_or_equal_to: 0 }
|
validates :calories, numericality: { only_integer: true, allow_nil: true, greater_than_or_equal_to: 0 }
|
||||||
validates_attachment :avatar,
|
|
||||||
presence: true,
|
|
||||||
content_type: { content_type: ["image/jpeg", "image/gif", "image/png"] }
|
|
||||||
|
|
||||||
scope :for_sale, -> { where deleted: false }
|
scope :for_sale, -> { where deleted: false }
|
||||||
|
|
||||||
|
|
|
@ -19,34 +19,26 @@
|
||||||
# avatar_updated_at :datetime
|
# avatar_updated_at :datetime
|
||||||
# orders_count :integer default("0")
|
# orders_count :integer default("0")
|
||||||
# koelkast :boolean default("f")
|
# koelkast :boolean default("f")
|
||||||
# provider :string
|
|
||||||
# name :string
|
# name :string
|
||||||
# encrypted_password :string default(""), not null
|
# encrypted_password :string default(""), not null
|
||||||
# private :boolean default("f")
|
# private :boolean default("f")
|
||||||
#
|
#
|
||||||
|
|
||||||
require 'identicon'
|
|
||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
include Statistics
|
include Statistics, Avatarable, FriendlyId
|
||||||
|
friendly_id :name, use: :finders
|
||||||
|
|
||||||
devise :database_authenticatable, :trackable, :omniauthable, :omniauth_providers => [:zeuswpi]
|
devise :database_authenticatable, :omniauthable, :omniauth_providers => [:zeuswpi]
|
||||||
|
|
||||||
has_paper_trail
|
|
||||||
has_attached_file :avatar, styles: { large: "150x150>", medium: "100x100>", small: "40x40>" }, default_style: :medium
|
|
||||||
has_many :orders, -> { includes :products }
|
has_many :orders, -> { includes :products }
|
||||||
has_many :products, through: :orders
|
has_many :products, through: :orders
|
||||||
belongs_to :dagschotel, class_name: 'Product'
|
belongs_to :dagschotel, class_name: 'Product'
|
||||||
|
|
||||||
validates_attachment :avatar,
|
|
||||||
presence: true,
|
|
||||||
content_type: { content_type: ["image/jpeg", "image/gif", "image/png"] }
|
|
||||||
|
|
||||||
scope :members, -> { where koelkast: false }
|
scope :members, -> { where koelkast: false }
|
||||||
scope :publik, -> { where private: false }
|
scope :publik, -> { where private: false }
|
||||||
|
|
||||||
def self.from_omniauth(auth)
|
def self.from_omniauth(auth)
|
||||||
where(provider: auth.provider, name: auth.uid).first_or_create do |user|
|
where(name: auth.uid).first_or_create do |user|
|
||||||
user.provider = auth.provider
|
|
||||||
user.name = auth.uid
|
user.name = auth.uid
|
||||||
user.avatar = Identicon.data_url_for auth.uid
|
user.avatar = Identicon.data_url_for auth.uid
|
||||||
end
|
end
|
||||||
|
@ -55,10 +47,4 @@ class User < ActiveRecord::Base
|
||||||
def debt
|
def debt
|
||||||
42.15
|
42.15
|
||||||
end
|
end
|
||||||
|
|
||||||
# Change URL params for User
|
|
||||||
|
|
||||||
def to_param
|
|
||||||
"#{id} #{name}".parameterize
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,6 @@ module Tab002
|
||||||
# config.i18n.default_locale = :de
|
# config.i18n.default_locale = :de
|
||||||
config.active_record.raise_in_transactional_callbacks = true
|
config.active_record.raise_in_transactional_callbacks = true
|
||||||
config.active_job.queue_adapter = :delayed_job
|
config.active_job.queue_adapter = :delayed_job
|
||||||
config.call_api_after = 5.minutes
|
config.call_api_after = (-5).minutes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,4 +38,6 @@ Rails.application.configure do
|
||||||
Paperclip.options[:command_path] = "/usr/local/bin/"
|
Paperclip.options[:command_path] = "/usr/local/bin/"
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
||||||
|
|
||||||
|
config.api_url = "http://localhost:3001"
|
||||||
end
|
end
|
||||||
|
|
|
@ -86,4 +86,7 @@ Rails.application.configure do
|
||||||
host: config.x.host,
|
host: config.x.host,
|
||||||
script_name: config.relative_url_root,
|
script_name: config.relative_url_root,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.api_url = "http://zeus.ugent.be/tab"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ development:
|
||||||
omniauth_client_id: tomtest
|
omniauth_client_id: tomtest
|
||||||
omniauth_client_secret: blargh
|
omniauth_client_secret: blargh
|
||||||
access_token: "token"
|
access_token: "token"
|
||||||
tab_api_key: "6GNUM/BhsU3If20qXluPIA=="
|
tab_api_key: "HriaktSIhRaB5CJzD71uLQ=="
|
||||||
|
|
||||||
test:
|
test:
|
||||||
secret_key_base: 961437e28e7d6055ffaad9cf1f8d614354f57f10cb2d7601c9d6ede72a03b9c9535ad9e63507e3eb31252c4895970a63117493408f2e9a46c7a0c4a5a7836b81
|
secret_key_base: 961437e28e7d6055ffaad9cf1f8d614354f57f10cb2d7601c9d6ede72a03b9c9535ad9e63507e3eb31252c4895970a63117493408f2e9a46c7a0c4a5a7836b81
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
class CreateVersions < ActiveRecord::Migration
|
|
||||||
def change
|
|
||||||
create_table :versions do |t|
|
|
||||||
t.string :item_type, :null => false
|
|
||||||
t.integer :item_id, :null => false
|
|
||||||
t.string :event, :null => false
|
|
||||||
t.string :whodunnit
|
|
||||||
t.text :object
|
|
||||||
t.datetime :created_at
|
|
||||||
end
|
|
||||||
add_index :versions, [:item_type, :item_id]
|
|
||||||
end
|
|
||||||
end
|
|
5
db/migrate/20150917165758_remove_provider_from_users.rb
Normal file
5
db/migrate/20150917165758_remove_provider_from_users.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class RemoveProviderFromUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
remove_column :users, :provider, :string
|
||||||
|
end
|
||||||
|
end
|
14
db/schema.rb
14
db/schema.rb
|
@ -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: 20150914153143) do
|
ActiveRecord::Schema.define(version: 20150917165758) do
|
||||||
|
|
||||||
create_table "delayed_jobs", force: :cascade do |t|
|
create_table "delayed_jobs", force: :cascade do |t|
|
||||||
t.integer "priority", default: 0, null: false
|
t.integer "priority", default: 0, null: false
|
||||||
|
@ -79,7 +79,6 @@ ActiveRecord::Schema.define(version: 20150914153143) do
|
||||||
t.datetime "avatar_updated_at"
|
t.datetime "avatar_updated_at"
|
||||||
t.integer "orders_count", default: 0
|
t.integer "orders_count", default: 0
|
||||||
t.boolean "koelkast", default: false
|
t.boolean "koelkast", default: false
|
||||||
t.string "provider"
|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "encrypted_password", default: "", null: false
|
t.string "encrypted_password", default: "", null: false
|
||||||
t.boolean "private", default: false
|
t.boolean "private", default: false
|
||||||
|
@ -88,15 +87,4 @@ ActiveRecord::Schema.define(version: 20150914153143) do
|
||||||
add_index "users", ["koelkast"], name: "index_users_on_koelkast"
|
add_index "users", ["koelkast"], name: "index_users_on_koelkast"
|
||||||
add_index "users", ["orders_count"], name: "index_users_on_orders_count"
|
add_index "users", ["orders_count"], name: "index_users_on_orders_count"
|
||||||
|
|
||||||
create_table "versions", force: :cascade do |t|
|
|
||||||
t.string "item_type", null: false
|
|
||||||
t.integer "item_id", null: false
|
|
||||||
t.string "event", null: false
|
|
||||||
t.string "whodunnit"
|
|
||||||
t.text "object"
|
|
||||||
t.datetime "created_at"
|
|
||||||
end
|
|
||||||
|
|
||||||
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
# avatar_updated_at :datetime
|
# avatar_updated_at :datetime
|
||||||
# orders_count :integer default("0")
|
# orders_count :integer default("0")
|
||||||
# koelkast :boolean default("f")
|
# koelkast :boolean default("f")
|
||||||
# provider :string
|
|
||||||
# name :string
|
# name :string
|
||||||
# encrypted_password :string default(""), not null
|
# encrypted_password :string default(""), not null
|
||||||
# private :boolean default("f")
|
# private :boolean default("f")
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
# avatar_updated_at :datetime
|
# avatar_updated_at :datetime
|
||||||
# orders_count :integer default("0")
|
# orders_count :integer default("0")
|
||||||
# koelkast :boolean default("f")
|
# koelkast :boolean default("f")
|
||||||
# provider :string
|
|
||||||
# name :string
|
# name :string
|
||||||
# encrypted_password :string default(""), not null
|
# encrypted_password :string default(""), not null
|
||||||
# private :boolean default("f")
|
# private :boolean default("f")
|
||||||
|
|
Loading…
Reference in a new issue