mix-rails-vouchers 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +27 -0
- data/app/controllers/admix/vouchers_controller.rb +24 -0
- data/app/controllers/vouchers_controller.rb +68 -0
- data/app/mailers/voucher_mailer.rb +10 -0
- data/app/models/admix/vouchers_datagrid.rb +18 -0
- data/app/models/email_validator.rb +9 -0
- data/app/models/voucher.rb +22 -0
- data/app/models/voucher_user.rb +48 -0
- data/app/models/vouchers/contact.rb +17 -0
- data/app/uploaders/vouchers/photo_uploader.rb +65 -0
- data/app/views/admix/vouchers/_form_fields.html.haml +6 -0
- data/app/views/admix/vouchers/_show.html.haml +9 -0
- data/app/views/admix/vouchers/_table_actions.html.haml +9 -0
- data/app/views/admix/vouchers/print.html.haml +27 -0
- data/app/views/admix/vouchers/users.html.haml +31 -0
- data/app/views/voucher_mailer/send_confirmation_link.text.erb +7 -0
- data/app/views/vouchers/_voucher.html.haml +12 -0
- data/app/views/vouchers/_voucher_show.html.haml +30 -0
- data/app/views/vouchers/confirmation.html.haml +0 -0
- data/app/views/vouchers/confirmation_error.html.haml +5 -0
- data/app/views/vouchers/email_sent.html.haml +4 -0
- data/app/views/vouchers/index.html.haml +9 -0
- data/app/views/vouchers/print.html.haml +56 -0
- data/app/views/vouchers/show.html.haml +3 -0
- data/config/initializers/carrier_wave.rb +0 -0
- data/config/locales/vouchers.pt-BR.yml +15 -0
- data/config/routes.rb +15 -0
- data/lib/mix-rails-vouchers/engine.rb +21 -0
- data/lib/mix-rails-vouchers/version.rb +10 -0
- data/lib/mix-rails-vouchers.rb +5 -0
- data/lib/tasks/mix-vouchers_tasks.rake +4 -0
- metadata +134 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'MixVouchers'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Admix::VouchersController < Admix::InheritedController
|
2
|
+
|
3
|
+
before_filter :voucher, only: [:print, :users, :delete]
|
4
|
+
|
5
|
+
def print
|
6
|
+
@users = @voucher.users.where(confirmed: true).order_by(name: 1)
|
7
|
+
render layout: false
|
8
|
+
end
|
9
|
+
|
10
|
+
def users
|
11
|
+
@users = @voucher.users.order_by(confirmed: -1, name: 1)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete_user
|
15
|
+
@voucher.users.find(params[:user_id]).delete
|
16
|
+
redirect_to admix_voucher_users_url
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def voucher
|
21
|
+
@voucher = Voucher.find(params[:id])
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
class VouchersController < ApplicationController
|
2
|
+
|
3
|
+
def index
|
4
|
+
@vouchers = Voucher.actives
|
5
|
+
end
|
6
|
+
|
7
|
+
def show
|
8
|
+
@voucher = Voucher.find(params[:id])
|
9
|
+
@user = VoucherUser.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def confirmation
|
13
|
+
@user = VoucherUser.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def email_sent
|
17
|
+
@voucher = Voucher.find(params[:id])
|
18
|
+
end
|
19
|
+
|
20
|
+
def send_confirmation
|
21
|
+
@voucher = Voucher.find(params[:id])
|
22
|
+
@user = VoucherUser.new(params[:voucher_user])
|
23
|
+
|
24
|
+
if @user.already_required(@voucher)
|
25
|
+
if @user.has_confirmed(@voucher)
|
26
|
+
render :show, notice: 'Voce ja requisitou este voucher, por favor, aguardo outra promocao'
|
27
|
+
else
|
28
|
+
render :show, notice: 'Voce ja requisitou este voucher, por favor, acesse seu email para imprimi-lo'
|
29
|
+
end
|
30
|
+
else
|
31
|
+
@voucher.users << @user
|
32
|
+
if @voucher.save
|
33
|
+
redirect_to :vouchers_email_sent
|
34
|
+
else
|
35
|
+
render :show, notice: 'Por favor, corrija os erros abaixo'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def confirmation
|
41
|
+
begin
|
42
|
+
voucher = Voucher.find(params[:id])
|
43
|
+
user = VoucherUser.where(voucher_id: voucher.id).find(params[:user_id])
|
44
|
+
user.confirmed = true
|
45
|
+
user.confirmation_date = Time.now
|
46
|
+
user.save
|
47
|
+
|
48
|
+
redirect_to vouchers_print_path
|
49
|
+
rescue
|
50
|
+
render :confirmation_error
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def print
|
55
|
+
begin
|
56
|
+
@voucher = Voucher.find(params[:id])
|
57
|
+
@user = VoucherUser.where(voucher_id: @voucher.id).find(params[:user_id])
|
58
|
+
|
59
|
+
render layout: false
|
60
|
+
rescue
|
61
|
+
render :confirmation_error
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def confirmation_error
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class VoucherMailer < AdmixMailer
|
2
|
+
|
3
|
+
def send_confirmation_link(voucher_user)
|
4
|
+
@voucher_user = voucher_user
|
5
|
+
@url = vouchers_confirmation_url(voucher_user.voucher, voucher_user)
|
6
|
+
|
7
|
+
mail(to: voucher_user.email, subject: t('vouchers.mailers.send_confirmation_link.subject'))
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Admix::VouchersDatagrid
|
2
|
+
include Datagrid
|
3
|
+
|
4
|
+
scope do
|
5
|
+
Voucher.all
|
6
|
+
end
|
7
|
+
column :name, header: I18n.t('vouchers.fields.name')
|
8
|
+
|
9
|
+
column :date_from, header: I18n.t('vouchers.fields.date_from') do |voucher|
|
10
|
+
voucher.date_from.strftime('%d/%m/%Y')
|
11
|
+
end
|
12
|
+
|
13
|
+
column :date_to, header: I18n.t('vouchers.fields.date_to') do |voucher|
|
14
|
+
voucher.date_to.strftime('%d/%m/%Y')
|
15
|
+
end
|
16
|
+
|
17
|
+
include Admix::TableActions
|
18
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# TODO change the place of this validator
|
2
|
+
|
3
|
+
class EmailValidator < ActiveModel::EachValidator
|
4
|
+
def validate_each(record, attribute, value)
|
5
|
+
unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
|
6
|
+
record.errors[attribute] << (options[:message] or I18n.t("errors.invalid_email"))
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Voucher
|
2
|
+
include Mongoid::Document
|
3
|
+
include Mongoid::Timestamps
|
4
|
+
include Mongoid::Slug
|
5
|
+
|
6
|
+
scope :actives, -> { where({:date_from.lte => Date.today, :date_to.gte => Date.today}) }
|
7
|
+
|
8
|
+
field :name, type: String
|
9
|
+
field :rules, type: Array
|
10
|
+
field :date_from, type: Date
|
11
|
+
field :date_to, type: Date
|
12
|
+
mount_uploader :photo, Vouchers::PhotoUploader
|
13
|
+
mount_uploader :partner_photo, Vouchers::PhotoUploader
|
14
|
+
|
15
|
+
has_many :users, class_name: 'VoucherUser', dependent: :delete
|
16
|
+
|
17
|
+
validates_presence_of :name, :rules, :photo
|
18
|
+
|
19
|
+
slug :name, history: true do |voucher|
|
20
|
+
voucher.name.parameterize
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class VoucherUser
|
2
|
+
include Mongoid::Document
|
3
|
+
include Mongoid::Timestamps
|
4
|
+
|
5
|
+
field :name, type: String
|
6
|
+
field :email, type: String
|
7
|
+
field :confirmed, type: Boolean, default: false
|
8
|
+
field :confirmation_date, type: Date
|
9
|
+
|
10
|
+
belongs_to :voucher
|
11
|
+
|
12
|
+
attr_protected :confirmed, :confirmation_date
|
13
|
+
validates_presence_of :name, :email
|
14
|
+
validates :email, email: true
|
15
|
+
|
16
|
+
after_create :send_confirmation_email
|
17
|
+
|
18
|
+
|
19
|
+
def confirm
|
20
|
+
@confirmed = true
|
21
|
+
@confirmation_date = Time.now
|
22
|
+
@save
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param voucher instance of Voucher
|
26
|
+
def already_required(voucher)
|
27
|
+
user = VoucherUser.where({voucher_id: voucher[:_id], _id: @attributes['_id']}).first
|
28
|
+
if user
|
29
|
+
true
|
30
|
+
else
|
31
|
+
false
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def has_confirmed(voucher)
|
36
|
+
user = VoucherUser.where({voucher_id: voucher[:_id], _id: @attributes['_id'], confirmed: true}).first
|
37
|
+
if user
|
38
|
+
true
|
39
|
+
else
|
40
|
+
false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def send_confirmation_email
|
45
|
+
VoucherMailer.send_confirmation_link(self).deliver
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Vouchers
|
2
|
+
class Contact < MailForm::Base
|
3
|
+
attribute :name
|
4
|
+
attribute :email
|
5
|
+
attribute :message
|
6
|
+
|
7
|
+
def headers
|
8
|
+
{
|
9
|
+
to: %("#{name}" <#{email}>),
|
10
|
+
subject: "Imprima seu Voucher",
|
11
|
+
# TODO get site name automatically
|
12
|
+
from: "Forro com turista <noreply@forrocomturista.com.br"
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class Vouchers::PhotoUploader < CarrierWave::Uploader::Base
|
4
|
+
|
5
|
+
grid_fs_access_url = "public/uploads"
|
6
|
+
|
7
|
+
def store_dir
|
8
|
+
'public/uploads'
|
9
|
+
end
|
10
|
+
|
11
|
+
def extension_white_list
|
12
|
+
%w(jpg jpeg gif png)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Include RMagick or MiniMagick support:
|
16
|
+
# include CarrierWave::RMagick
|
17
|
+
# include CarrierWave::MiniMagick
|
18
|
+
|
19
|
+
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
|
20
|
+
# include Sprockets::Helpers::RailsHelper
|
21
|
+
# include Sprockets::Helpers::IsolatedHelper
|
22
|
+
|
23
|
+
# Choose what kind of storage to use for this uploader:
|
24
|
+
storage :grid_fs
|
25
|
+
# storage :fog
|
26
|
+
|
27
|
+
# Override the directory where uploaded files will be stored.
|
28
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
29
|
+
def store_dir
|
30
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
31
|
+
end
|
32
|
+
|
33
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
34
|
+
# def default_url
|
35
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
36
|
+
# # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
37
|
+
#
|
38
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
39
|
+
# end
|
40
|
+
|
41
|
+
# Process files as they are uploaded:
|
42
|
+
# process :scale => [200, 300]
|
43
|
+
#
|
44
|
+
# def scale(width, height)
|
45
|
+
# # do something
|
46
|
+
# end
|
47
|
+
|
48
|
+
# Create different versions of your uploaded files:
|
49
|
+
# version :thumb do
|
50
|
+
# process :scale => [50, 50]
|
51
|
+
# end
|
52
|
+
|
53
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
54
|
+
# For images you might use something like this:
|
55
|
+
# def extension_white_list
|
56
|
+
# %w(jpg jpeg gif png)
|
57
|
+
# end
|
58
|
+
|
59
|
+
# Override the filename of the uploaded files:
|
60
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
61
|
+
# def filename
|
62
|
+
# "something.jpg" if original_filename
|
63
|
+
# end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
= f.input :name, label: t('vouchers.fields.name')
|
2
|
+
= f.input :date_from, label: t('vouchers.fields.date_from'), as: 'datepicker'
|
3
|
+
= f.input :date_to, label: t('vouchers.fields.date_to'), as: 'datepicker'
|
4
|
+
= f.input :photo, label: t('vouchers.fields.photo'), as: :file
|
5
|
+
= f.input :rules, label: t('vouchers.fields.rules'), as: :text, input_html: {class: 'niceditor'}
|
6
|
+
= f.input :partner_photo, label: t('vouchers.fields.partner_photo'), as: :file
|
@@ -0,0 +1,9 @@
|
|
1
|
+
- if resource.users.length > 0
|
2
|
+
= link_to image_tag('admix/icons/printer.png'), admix_voucher_print_url(resource), class: 'btn', title: 'Imprimir usuários deste voucher'
|
3
|
+
= link_to image_tag('admix/icons/user_go.png'), admix_voucher_users_url(resource), class: 'btn', title: 'Listar usuários deste voucher'
|
4
|
+
- else
|
5
|
+
%a.btn.disabled{title:'Nenhum usuário'}= image_tag('admix/icons/printer.png')
|
6
|
+
%a.btn.disabled{title:'Nenhum usuário'}= image_tag('admix/icons/user_go.png')
|
7
|
+
= link_to image_tag('admix/icons/zoom.png'), resource_url(resource), class: 'btn', title:'Visualizar registro'
|
8
|
+
= link_to image_tag('admix/icons/page_edit.png'), edit_resource_url(resource), class: 'btn', title:'Editar registro'
|
9
|
+
= link_to image_tag('admix/icons/cancel.png'), resource_url(resource), method: :delete, data: { confirm: t('admix.crud.destroy_confirm') }, class: 'btn', title:'Deletar registro'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:charset => "utf-8"}
|
5
|
+
%meta{:content => "noindex, nofollow", :name => "robots"}
|
6
|
+
%title Admix
|
7
|
+
= stylesheet_link_tag "admix/application", :media => "all"
|
8
|
+
= javascript_include_tag "admix/application"
|
9
|
+
= csrf_meta_tags
|
10
|
+
%body
|
11
|
+
%h2 Lista do voucher "#{@voucher.name}"
|
12
|
+
- if @users.length > 0
|
13
|
+
%table.table
|
14
|
+
%thead
|
15
|
+
%tr
|
16
|
+
%th Nome
|
17
|
+
%th Email
|
18
|
+
%tbody
|
19
|
+
- @users.each do |user|
|
20
|
+
%tr
|
21
|
+
%td= user.name.titleize
|
22
|
+
%td= user.email.downcase
|
23
|
+
|
24
|
+
%script
|
25
|
+
window.print();
|
26
|
+
- else
|
27
|
+
%p Nenhum cliente imprimiu este voucher
|
@@ -0,0 +1,31 @@
|
|
1
|
+
%h1 Usuários do voucher "#{@voucher.name}"
|
2
|
+
|
3
|
+
- if @users.length > 0
|
4
|
+
%table.table.table-striped
|
5
|
+
%table.table
|
6
|
+
%thead
|
7
|
+
%tr
|
8
|
+
%th Nome
|
9
|
+
%th Email
|
10
|
+
%th Confirmou por email?
|
11
|
+
%th Ações
|
12
|
+
%tbody
|
13
|
+
- @users.each do |user|
|
14
|
+
%tr
|
15
|
+
%td= user.name.titleize
|
16
|
+
%td= user.email.downcase
|
17
|
+
%td= user.confirmed ? 'Sim' : 'Não'
|
18
|
+
%td
|
19
|
+
= link_to image_tag('admix/icons/delete.png'), admix_voucher_user_delete_url(id: @voucher.id, user_id: user.id), method: :delete, class: 'btn', title: 'Deletar este usuário'
|
20
|
+
- if user.confirmed
|
21
|
+
= link_to image_tag('admix/icons/printer.png'), vouchers_print_url(id: @voucher.id, user_id: user.id), class: 'btn', title: 'Imprimir voucher do usuário'
|
22
|
+
- else
|
23
|
+
%a.btn.disabled{title: 'Usuário não confirmado'}= image_tag('admix/icons/printer.png')
|
24
|
+
|
25
|
+
- else
|
26
|
+
%p Nenhum cliente requisitou este voucher
|
27
|
+
|
28
|
+
|
29
|
+
= link_to t('admix.crud.back'), collection_url, class: 'btn'
|
30
|
+
|
31
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
.row
|
2
|
+
.span5
|
3
|
+
= image_tag voucher.photo.url
|
4
|
+
.span10.offset1
|
5
|
+
%p.fz18.fb.white
|
6
|
+
= voucher.name
|
7
|
+
%p.p.red.fz14.fb Regras de utilização:
|
8
|
+
!= voucher.rules
|
9
|
+
%hr
|
10
|
+
%div
|
11
|
+
%h3.fb.white.p.mini Imprima seu Voucher
|
12
|
+
%p.muted.p
|
13
|
+
Para ter acesso ao voucher é necessário preencher apenas essas informações abaixo e imprimir o cupom que será gerado na tela seguinte e apresentá-lo no estabelecimento para obter o benefício.
|
14
|
+
|
15
|
+
= simple_form_for @user, url: vouchers_send_confirmation_url do |f|
|
16
|
+
%form{:action => vouchers_send_confirmation_url}
|
17
|
+
.row.p.mini
|
18
|
+
.span
|
19
|
+
= f.label :name
|
20
|
+
= f.input_field :name, class: 'span8'
|
21
|
+
%p
|
22
|
+
= f.error :name
|
23
|
+
.span.offset1
|
24
|
+
= f.label :email
|
25
|
+
= f.input_field :email, class: 'span7', type: :email
|
26
|
+
%p
|
27
|
+
= f.error :email
|
28
|
+
.ta-r
|
29
|
+
%button.no-style{:type => "submit"}
|
30
|
+
= image_tag 'btn_seguir.png'
|
File without changes
|
@@ -0,0 +1,56 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:charset => "utf-8"}
|
5
|
+
%meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}
|
6
|
+
%title Forro com Turista
|
7
|
+
%meta{:content => "width=device-width", :name => "viewport"}
|
8
|
+
%meta{:content => "", :name => "description"}
|
9
|
+
%meta{:content => "", :name => "keywords"}
|
10
|
+
= stylesheet_link_tag "application", :media => "all"
|
11
|
+
= javascript_include_tag "application"
|
12
|
+
= csrf_meta_tags
|
13
|
+
%link{:href => "favicon.png", :rel => "shortcut icon", :type => "image/png"}
|
14
|
+
%link{:href => "http://fonts.googleapis.com/css?family=Open+Sans:600italic,800italic,700,400", :rel => "stylesheet", :type => "text/css"}
|
15
|
+
%body.print
|
16
|
+
.row
|
17
|
+
.span16
|
18
|
+
.row.p
|
19
|
+
.span8
|
20
|
+
= image_tag 'logo_bw.png'
|
21
|
+
.span8.ta-r
|
22
|
+
.p.inverse
|
23
|
+
%h2.i Voucher de desconto
|
24
|
+
%p.i.gray.fz14.b forrocomturista.com.br
|
25
|
+
.line.big.p
|
26
|
+
%h2.i.p= @voucher.name
|
27
|
+
%p.fz14.p.b.i Regras de utilização:
|
28
|
+
%p.muted.p!= @voucher.rules
|
29
|
+
|
30
|
+
.pad-content.p.super
|
31
|
+
%table
|
32
|
+
%tbody
|
33
|
+
%tr
|
34
|
+
%td.gray.fz14
|
35
|
+
Nome:
|
36
|
+
%strong.gray= @user.name
|
37
|
+
%tr
|
38
|
+
%td.gray.fz14
|
39
|
+
Email:
|
40
|
+
%strong.gray= @user.email
|
41
|
+
%tr
|
42
|
+
%td.gray.fz14
|
43
|
+
Data de Impressão:
|
44
|
+
%strong.gray= @user.confirmation_date.strftime("%d/%m/%Y")
|
45
|
+
%tr
|
46
|
+
%td.gray.fz14
|
47
|
+
Válido até
|
48
|
+
%strong.gray= @voucher.date_to.strftime("%d/%m/%Y")
|
49
|
+
.line.big.p.super
|
50
|
+
%p.ta-c.i.fz14
|
51
|
+
Agradecemos seu interesse em nossos produtos/serviços,vamos continuar trabalhando
|
52
|
+
para que sua experiência em Natal/RN seja sempre inesquessível!
|
53
|
+
%br
|
54
|
+
%strong.fz18 www.forrocomturista.com.br
|
55
|
+
%script
|
56
|
+
window.print();
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
pt-BR:
|
2
|
+
vouchers:
|
3
|
+
vouchers: 'Vouchers'
|
4
|
+
mailers:
|
5
|
+
send_confirmation_link:
|
6
|
+
subject: 'Imprima seu Voucher'
|
7
|
+
fields:
|
8
|
+
name: 'Nome'
|
9
|
+
date_from: 'De'
|
10
|
+
date_to: 'Até'
|
11
|
+
rules: 'Regras'
|
12
|
+
photo: 'Foto'
|
13
|
+
partner_photo: 'Foto do parceiro'
|
14
|
+
errors:
|
15
|
+
invalid_email: 'Email inválido'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
resources :vouchers
|
3
|
+
|
4
|
+
post 'vouchers/:id' => 'vouchers#send_confirmation', as: :vouchers_send_confirmation
|
5
|
+
match 'vouchers/:id/email-enviado' => 'vouchers#email_sent', as: :vouchers_email_sent
|
6
|
+
match 'vouchers/:id/confirm/:user_id' => 'vouchers#confirmation', as: :vouchers_confirmation
|
7
|
+
match 'vouchers/:id/imprimir/:user_id' => 'vouchers#print', as: :vouchers_print
|
8
|
+
|
9
|
+
namespace :admix do
|
10
|
+
get 'vouchers/:id/users/print' => 'vouchers#print', as: :voucher_print
|
11
|
+
get 'vouchers/:id/users' => 'vouchers#users', as: :voucher_users
|
12
|
+
delete 'vouchers/:id/users/:user_id/delete' => 'vouchers#delete_user', as: :voucher_user_delete
|
13
|
+
resources :vouchers
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module MixRailsVouchers
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
|
4
|
+
def navigation
|
5
|
+
if defined? Admix
|
6
|
+
|
7
|
+
Admix::Navigation::NavBar.post_menu do
|
8
|
+
Admix::Navigation::NavBar.find(:content) do |menu|
|
9
|
+
menu.submenu do |submenu|
|
10
|
+
submenu.key = :vouchers
|
11
|
+
submenu.title = I18n.t 'vouchers.vouchers'
|
12
|
+
submenu.url = 'admix_vouchers_url'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mix-rails-vouchers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Rafael Garcia
|
9
|
+
- Sadjow Medeiros Leão
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-01-22 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: mail_form
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.4.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 1.4.0
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: rails
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 3.2.9
|
39
|
+
type: :runtime
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 3.2.9
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: carrierwave-mongoid
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.3.0
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.3.0
|
63
|
+
description: Vouchers module for mix-rails
|
64
|
+
email:
|
65
|
+
- rafbgarcia@gmail.com
|
66
|
+
- sadjow@gmail.com
|
67
|
+
executables: []
|
68
|
+
extensions: []
|
69
|
+
extra_rdoc_files: []
|
70
|
+
files:
|
71
|
+
- app/uploaders/vouchers/photo_uploader.rb
|
72
|
+
- app/controllers/admix/vouchers_controller.rb
|
73
|
+
- app/controllers/vouchers_controller.rb
|
74
|
+
- app/mailers/voucher_mailer.rb
|
75
|
+
- app/models/admix/vouchers_datagrid.rb
|
76
|
+
- app/models/email_validator.rb
|
77
|
+
- app/models/voucher_user.rb
|
78
|
+
- app/models/vouchers/contact.rb
|
79
|
+
- app/models/voucher.rb
|
80
|
+
- app/views/admix/vouchers/_show.html.haml
|
81
|
+
- app/views/admix/vouchers/_table_actions.html.haml
|
82
|
+
- app/views/admix/vouchers/print.html.haml
|
83
|
+
- app/views/admix/vouchers/users.html.haml
|
84
|
+
- app/views/admix/vouchers/_form_fields.html.haml
|
85
|
+
- app/views/vouchers/confirmation.html.haml
|
86
|
+
- app/views/vouchers/_voucher.html.haml
|
87
|
+
- app/views/vouchers/_voucher_show.html.haml
|
88
|
+
- app/views/vouchers/email_sent.html.haml
|
89
|
+
- app/views/vouchers/print.html.haml
|
90
|
+
- app/views/vouchers/index.html.haml
|
91
|
+
- app/views/vouchers/confirmation_error.html.haml
|
92
|
+
- app/views/vouchers/show.html.haml
|
93
|
+
- app/views/voucher_mailer/send_confirmation_link.text.erb
|
94
|
+
- config/locales/vouchers.pt-BR.yml
|
95
|
+
- config/initializers/carrier_wave.rb
|
96
|
+
- config/routes.rb
|
97
|
+
- lib/mix-rails-vouchers/version.rb
|
98
|
+
- lib/mix-rails-vouchers/engine.rb
|
99
|
+
- lib/tasks/mix-vouchers_tasks.rake
|
100
|
+
- lib/mix-rails-vouchers.rb
|
101
|
+
- MIT-LICENSE
|
102
|
+
- Rakefile
|
103
|
+
- README.rdoc
|
104
|
+
homepage: https://github.com/mixinternet/mix-rails
|
105
|
+
licenses: []
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
hash: 2811653840542869922
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
hash: 2811653840542869922
|
128
|
+
requirements: []
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 1.8.24
|
131
|
+
signing_key:
|
132
|
+
specification_version: 3
|
133
|
+
summary: Vouchers module for mix-rails
|
134
|
+
test_files: []
|