Mailer and other upgrades

This commit is contained in:
2013-01-17 09:15:42 +01:00
parent 26810defcd
commit 730768cb59
36 changed files with 242 additions and 8 deletions
@@ -56,7 +56,6 @@ function setTranslations(selector){
var list = $('#top-navigation-list');
list.find('.locale').show();
list.find('.locale-'+$locale).hide();
debugger;
if(selector){
$(selector).find('[data-t]').each(function(){$(this).text(t($(this).data('t'), $(this).data('tAttributes')))})
}else{
@@ -0,0 +1,7 @@
@import bootstrap
body
.nav
> li
> a
&:hover
background-color: transparent
+10
View File
@@ -0,0 +1,10 @@
class SupplierMailer < ActionMailer::Base
default from: "Qwaiter <service@qwaiter.com>"
layout 'mail'
def creation(supplier)
I18n.locale = :nl
@supplier = supplier
mail to: supplier.email, subject: I18n.t('mailer.supplier.creation.subject', name: supplier.name)
end
end
+7 -1
View File
@@ -1,7 +1,8 @@
class Supplier
include SimplyStored::Couch
include Devise::Orm::SimplyStored
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :confirmable
property :unconfirmed_email
property :name
property :open, type: :boolean, default: false
@@ -30,6 +31,7 @@ class Supplier
has_many :sections, dependent: :destroy
after_create :add_section_on_create
after_create :send_creation_notifications
view :by_email, key: :email
@@ -92,4 +94,8 @@ class Supplier
@section = Section.create supplier: self, title: I18n.t('supplier.section.first_section_title')
end
def send_creation_notifications
SupplierMailer.creation(self).deliver
end
end
+1 -1
View File
@@ -17,7 +17,7 @@ class Table
view :by_supplier_id_and_id, key: [:supplier_id, :_id]
#validates_uniqueness_of :number
#view :by_number, key: :number # For uniqueness validation
view :by_number, key: :number
def occupied?
return @is_occupied if instance_variable_defined?(:'@is_occupied')
+2
View File
@@ -1,6 +1,8 @@
class User
include SimplyStored::Couch
include Devise::Orm::SimplyStored
property :name
property :active_list_id
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :token_authenticatable # , :registerable
+11
View File
@@ -0,0 +1,11 @@
doctype strict
html
head
title
meta http-equiv="Content-Type" content="text/html; charset=utf-8"
body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="-webkit-text-size-adjust:none;margin:0;padding:0;background-color:#eaeef0;width:100%;"
center
table border="0" cellpadding="0" cellspacing="0" height="100%" id="backgroundTable" style="margin:20px 0 20px 0;padding:0;height:100%;width:600px;background-color:#ffffff"
tr
td align="left" valign="top" style="color:#4C7334;font-family:Arial;padding:22px"
= yield
@@ -0,0 +1,20 @@
h2= t('mailer.supplier.creation.title', name: @supplier.name)
p
|
Welkom bij Qwaiter! Leuk dat je gebruik wil maken van bestellen via de smartphone. De eerste stap is gezet! Maak je gebruik van een reeds
bestaand kassasysteem dan is de kans groot dat Qwaiter deze ondersteunt. Selecteer in
dit geval eerst je kassasysteem. De inrichting van Qwaiter zich hierop zal
aanpassen.
p
|
Wij van Qwaiter hopen dat dit een waardevolle toevoeging op je bedrijf zal zijn en
zullen er alles aan doen om de relatie zo aangenaam mogelijk te maken.
p
br
| Met vriendelijke groet,
br
br
| Qwaiter
br
= link_to 'www.Qwaiter.com', root_url, style: "color:#FAA732"
+19
View File
@@ -0,0 +1,19 @@
ul.nav.nav-pills
- if controller_name != 'sessions'
li= link_to t('devise.sessions.button'), new_session_path(resource_name), class: [:devise, :btn]
- if devise_mapping.registerable? && controller_name != 'registrations'
li= link_to t('devise.registrations.button'), new_registration_path(resource_name), class: [:devise, :btn]
- if devise_mapping.recoverable? && controller_name != 'passwords'
li= link_to t('devise.sessions.forgot_your_password'), new_password_path(resource_name), class: [:devise, :btn]
- if devise_mapping.confirmable? && controller_name != 'confirmations'
li= link_to t('devise.confirmations.did_not_receive_instructions_link'), new_confirmation_path(resource_name), class: [:devise, :btn]
- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
li= link_to t('devise.unlocks.did_not_receive_instructions_link'), new_unlock_path(resource_name), class: [:devise, :btn]
- if devise_mapping.omniauthable?
- resource_class.omniauth_providers.each do |provider|
li= link_to t('devise.omniauth_callbacks.sign_in_with', provider: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider), class: [:devise, :btn]
@@ -0,0 +1,12 @@
<h2>Resend confirmation instructions</h2>
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Resend confirmation instructions" %></div>
<% end %>
<%= render "links" %>
@@ -0,0 +1,5 @@
<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,8 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
+14
View File
@@ -0,0 +1,14 @@
h2= t('devise.passwords.edit.title')
= form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal', method: :put}) do |f|
= devise_error_messages!
= f.hidden_field :reset_password_token
.control-group
= f.label :password, class: 'control-label'
.controls= f.password_field :password
.control-group
= f.label :password_confirmation, class: 'control-label'
.controls= f.password_field :password_confirmation
.control-group
.controls
= f.submit t('devise.passwords.edit.button'), class: 'btn btn-primary'
= render "links"
+10
View File
@@ -0,0 +1,10 @@
h2= t('devise.passwords.title')
= form_for(resource, :as => resource_name, :url => password_path(resource_name), html: {class: 'form-horizontal'}) do |f|
= devise_error_messages!
.control-group
= f.label :email, class: 'control-label'
.controls= f.email_field :email
.control-group
.controls
= f.submit t('devise.passwords.button'), class: 'btn btn-primary'
= render "links"
@@ -0,0 +1,25 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password, :autocomplete => "off" %></div>
<div><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></div>
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.password_field :current_password %></div>
<div><%= f.submit "Update" %></div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
<%= link_to "Back", :back %>
@@ -0,0 +1,19 @@
h2= t('devise.registrations.title')
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), html: {class: 'form-horizontal'}) do |f|
= devise_error_messages!
.control-group
= f.label :name, class: 'control-label'
.controls= f.text_field :name
.control-group
= f.label :email, class: 'control-label'
.controls= f.email_field :email
.control-group
= f.label :password, class: 'control-label'
.controls= f.password_field :password
.control-group
= f.label :password_confirmation, class: 'control-label'
.controls= f.password_field :password_confirmation
.control-group
.controls
= f.submit t('devise.registrations.button'), class: 'btn btn-primary'
= render "links"
+19
View File
@@ -0,0 +1,19 @@
h2= t('devise.sessions.title')
= form_for(resource, :as => resource_name, :url => session_path(resource_name), html: {class: 'form-horizontal'}) do |f|
= devise_error_messages!
.control-group
= f.label :email, class: 'control-label'
.controls= f.email_field :email
.control-group
= f.label :password, class: 'control-label'
.controls= f.password_field :password
.control-group
.controls
= f.label :remember_me do
= f.check_box :remember_me
|&nbsp;
= t('devise.sessions.remember_me')
.control-group
.controls
= f.submit t('devise.sessions.button'), class: 'btn btn-primary'
= render "links"
+12
View File
@@ -0,0 +1,12 @@
<h2>Resend unlock instructions</h2>
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Resend unlock instructions" %></div>
<% end %>
<%= render "links" %>