changes unfinished
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
module MailHelper
|
||||||
|
|
||||||
|
end
|
||||||
@@ -15,10 +15,22 @@ class Table
|
|||||||
#validates :list_id, presence: true
|
#validates :list_id, presence: true
|
||||||
validates :number, numericality: {greater_than: 0}
|
validates :number, numericality: {greater_than: 0}
|
||||||
view :by_supplier_id_and_id, key: [:supplier_id, :_id]
|
view :by_supplier_id_and_id, key: [:supplier_id, :_id]
|
||||||
|
view :by_supplier_id_and_number, key: [:supplier_id, :number]
|
||||||
|
|
||||||
#validates_uniqueness_of :number
|
#validates_uniqueness_of :number
|
||||||
view :by_number, key: :number
|
view :by_number, key: :number
|
||||||
|
|
||||||
|
def self.for_supplier(supplier, options = {})
|
||||||
|
startkey = options[:from_number].present? ? [supplier.id, options.delete(:from_number).to_i] : [supplier.id]
|
||||||
|
endkey = options[:to_number].present? ? [supplier.id, options.delete(:to_number).to_i]: [supplier.id, {}]
|
||||||
|
|
||||||
|
total_entries = database.view(by_supplier_id_and_number({startkey: startkey, endkey: endkey, include_docs: false, reduce: true}))
|
||||||
|
options[:total_entries] = total_entries
|
||||||
|
with_pagination_options(options) do |options|
|
||||||
|
database.view(by_supplier_id_and_number({startkey: startkey, endkey: endkey, include_docs: true, reduce: false}.merge(options)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def occupied?
|
def occupied?
|
||||||
return @is_occupied if instance_variable_defined?(:'@is_occupied')
|
return @is_occupied if instance_variable_defined?(:'@is_occupied')
|
||||||
@is_occupied = !self.class.database.view(List.active_by_table_id_view(key: id, reduce: true)).zero?
|
@is_occupied = !self.class.database.view(List.active_by_table_id_view(key: id, reduce: true)).zero?
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<p>Welcome <%= @resource.email %>!</p>
|
|
||||||
|
|
||||||
<p>You can confirm your account email through the link below:</p>
|
|
||||||
|
|
||||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
h3 "Welkom bij Qwaiter #{@resource.email}!"
|
||||||
|
p
|
||||||
|
|
|
||||||
|
Je hebt een account aangevraag bij Qwaiter. Als dit niet de bedoeling is kan je deze email negeren.
|
||||||
|
Om je account te activeren moet je op de bevestigingslink hieronder klikken:
|
||||||
|
|
||||||
|
p= link_to 'Bevestig mijn Qwaiter account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
|
||||||
@@ -5,10 +5,10 @@ div.page-header= title :index, model_class
|
|||||||
table.table
|
table.table
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th.link= model_class.human_attribute_name(:number)
|
th.link data-t="attributes.table.number"= model_class.human_attribute_name(:number)
|
||||||
th.link= Section.model_name.human
|
th.link data-t="models.section"= Section.model_name.human
|
||||||
th.timestamp= model_class.human_attribute_name(:created_at)
|
th.timestamp data-t="attributes.table.created_at"= model_class.human_attribute_name(:created_at)
|
||||||
th.actions=t 'helpers.actions'
|
th.actions data-t="helpers.actions"=t 'helpers.actions'
|
||||||
tbody
|
tbody
|
||||||
- @tables.each do |table|
|
- @tables.each do |table|
|
||||||
tr
|
tr
|
||||||
|
|||||||
@@ -75,6 +75,13 @@ module Qwaiter
|
|||||||
config.assets.precompile += ['supplier/application.css', 'user/application.css', 'qr_sheet/application.css']
|
config.assets.precompile += ['supplier/application.css', 'user/application.css', 'qr_sheet/application.css']
|
||||||
config.default_url_options = {format: 'html'}
|
config.default_url_options = {format: 'html'}
|
||||||
|
|
||||||
|
config.to_prepare do
|
||||||
|
Devise::Mailer.layout "mail"
|
||||||
|
Devise::Mailer.class_eval do
|
||||||
|
helper :mail
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#config.middleware.use Rack::Cors do
|
#config.middleware.use Rack::Cors do
|
||||||
# allow do
|
# allow do
|
||||||
# origins '*'
|
# origins '*'
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ Qwaiter::Application.configure do
|
|||||||
|
|
||||||
# Disable delivery errors, bad email addresses will be ignored
|
# Disable delivery errors, bad email addresses will be ignored
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
config.action_mailer.default_url_options = {
|
||||||
|
host: 'www.qwaiter.com'
|
||||||
|
}
|
||||||
config.action_mailer.smtp_settings = {
|
config.action_mailer.smtp_settings = {
|
||||||
address: "smtp.gmail.com",
|
address: "smtp.gmail.com",
|
||||||
port: 587,
|
port: 587,
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ Qwaiter::Application.configure do
|
|||||||
# Tell Action Mailer not to deliver emails to the real world.
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
# The :test delivery method accumulates sent emails in the
|
# The :test delivery method accumulates sent emails in the
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
|
config.action_mailer.default_url_options = {
|
||||||
|
host: 'www.qwaiter.com'
|
||||||
|
}
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
# Raise exception on mass assignment protection for Active Record models
|
# Raise exception on mass assignment protection for Active Record models
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Devise.setup do |config|
|
|||||||
# ==> Mailer Configuration
|
# ==> Mailer Configuration
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
||||||
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
|
config.mailer_sender = 'Qwaiter <service@qwaiter.com>'
|
||||||
|
|
||||||
# Configure the class responsible to send e-mails.
|
# Configure the class responsible to send e-mails.
|
||||||
# config.mailer = "Devise::Mailer"
|
# config.mailer = "Devise::Mailer"
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ nl:
|
|||||||
forgot_password: Wachtwoord vergeten?
|
forgot_password: Wachtwoord vergeten?
|
||||||
send_instructions_button: Stuur mij reset instructies
|
send_instructions_button: Stuur mij reset instructies
|
||||||
confirmations:
|
confirmations:
|
||||||
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
send_instructions: 'Er wordt een een e-mail naar je toe gestuurd waarin je je account kan bevestigen.'
|
||||||
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
confirmed: 'De activatie van je account is successvol. Je bent nu aangemeld!'
|
||||||
did_not_receive_instructions_link: "Heeft u geen bevestigingsinstructies ontvangen?"
|
did_not_receive_instructions_link: "Heeft u geen bevestigingsinstructies ontvangen?"
|
||||||
did_not_receive: Heeft u geen bevestigingsinstructies ontvangen?
|
did_not_receive: 'Heeft u geen bevestigingsinstructies ontvangen?'
|
||||||
registrations:
|
registrations:
|
||||||
title: Aanmelden
|
title: Aanmelden
|
||||||
button: Aanmelden
|
button: Aanmelden
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
nl:
|
||||||
|
mailer:
|
||||||
|
supplier:
|
||||||
|
creation:
|
||||||
|
subject: 'Weklom bij Qwaiter'
|
||||||
|
title: 'De aanmelding van %{name} bij Qwaiter is gelukt!'
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
require "spec_helper"
|
||||||
|
|
||||||
|
describe SupplierMailer do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Table do
|
||||||
|
describe 'for_supplier' do
|
||||||
|
let(:supplier){ create(:supplier) }
|
||||||
|
let(:options){ Hash.new }
|
||||||
|
subject{ Table.for_supplier(supplier, options) }
|
||||||
|
it "should return an empty array by default" do
|
||||||
|
subject.should be_empty
|
||||||
|
end
|
||||||
|
describe 'with multiple tables' do
|
||||||
|
before do
|
||||||
|
@table1 = create :table, supplier: supplier, number: 2
|
||||||
|
@table2 = create :table, supplier: supplier, number: 4
|
||||||
|
@table3 = create :table, supplier: supplier, number: 6
|
||||||
|
@table4 = create :table, number: 4
|
||||||
|
|
||||||
|
end
|
||||||
|
it "returns all by default" do
|
||||||
|
subject.should == [@table1, @table2, @table3]
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should paginate the result" do
|
||||||
|
options[:per_page] = 2
|
||||||
|
subject.size.should == 2
|
||||||
|
subject.total_count.should == 3
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user