shoppe_promocode 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/shoppe/promocodes_controller.rb +4 -3
- data/app/models/shoppe/promocode.rb +2 -2
- data/app/views/shoppe/promocodes/_form.html.haml +11 -11
- data/app/views/shoppe/promocodes/edit.html.haml +3 -3
- data/app/views/shoppe/promocodes/index.html.haml +5 -5
- data/app/views/shoppe/promocodes/new.html.haml +3 -3
- data/lib/shoppe_promocode.rb +2 -0
- data/lib/shoppe_promocode/version.rb +1 -1
- metadata +2 -3
- data/README.rdoc +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d278f842d16b41e704a69079f9d195d633ab0803
|
4
|
+
data.tar.gz: f5f5f967871412dd355686e84e9a8643efd25793
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb0160556b469c88818ca2329544027d4f97cd1781578483e31d181ebba71b6f40b2d7ab1e23e0e4ee295b8d29e82acebb446ec3dfb6beca8bfb43c1c3dc885
|
7
|
+
data.tar.gz: 68342509e621d804f62d73373cee814e3619d5c092244bd7c5a0894f2845a3c6193d1282b12eed52f1c7d84c47598981bf1e453e0335ed57a108fe980a5770c8
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Shoppe
|
2
2
|
class PromocodesController < Shoppe::ApplicationController
|
3
|
+
|
3
4
|
before_filter { @active_nav = :promocodes }
|
4
5
|
|
5
6
|
def index
|
@@ -13,7 +14,7 @@ module Shoppe
|
|
13
14
|
def create
|
14
15
|
@promocode = Shoppe::Promocode.new(promocode_params)
|
15
16
|
if @promocode.save
|
16
|
-
redirect_to :promocodes, flash: {notice: '
|
17
|
+
redirect_to :promocodes, flash: {notice: 'Promo code has been created successfully'}
|
17
18
|
else
|
18
19
|
render 'new'
|
19
20
|
end
|
@@ -22,7 +23,7 @@ module Shoppe
|
|
22
23
|
def destroy
|
23
24
|
@promocode = Shoppe::Promocode.find params[:id]
|
24
25
|
@promocode.destroy
|
25
|
-
redirect_to @promocode, :notice => "
|
26
|
+
redirect_to @promocode, :notice => "Promo code has been removed successfully"
|
26
27
|
end
|
27
28
|
|
28
29
|
def edit
|
@@ -32,7 +33,7 @@ module Shoppe
|
|
32
33
|
def update
|
33
34
|
@promocode = Shoppe::Promocode.find(params[:id])
|
34
35
|
if @promocode.update(promocode_params)
|
35
|
-
redirect_to [:edit, @promocode], :flash => {:notice => "
|
36
|
+
redirect_to [:edit, @promocode], :flash => {:notice => "Promo code has been updated successfully"}
|
36
37
|
else
|
37
38
|
render :action => "edit"
|
38
39
|
end
|
@@ -12,11 +12,11 @@ module Shoppe
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def redeem_coupon
|
15
|
-
update_attributes(times_used: times_used+1)
|
15
|
+
update_attributes(times_used: times_used + 1)
|
16
16
|
end
|
17
17
|
|
18
18
|
def display_discount_type
|
19
|
-
discount_type == "percentage" ? "%" :
|
19
|
+
discount_type == "percentage" ? "%" : Shoppe.settings.currency_unit
|
20
20
|
end
|
21
21
|
|
22
22
|
def active?
|
@@ -1,31 +1,31 @@
|
|
1
1
|
= form_for @promocode do |f|
|
2
2
|
= f.error_messages
|
3
|
-
= field_set_tag '
|
3
|
+
= field_set_tag 'Promo Code Details' do
|
4
4
|
.splitContainer
|
5
5
|
%dl.third
|
6
6
|
%dt= f.label :title
|
7
|
-
%dd= f.text_field :title, :
|
7
|
+
%dd= f.text_field :title, class: 'focus text'
|
8
8
|
%dl.third
|
9
9
|
%dt= f.label :code
|
10
|
-
%dd= f.text_field :code, :
|
10
|
+
%dd= f.text_field :code, class: 'text'
|
11
11
|
%dl.third
|
12
12
|
%dt= f.label :usage_limit
|
13
|
-
%dd= f.number_field :usage_limit, :
|
13
|
+
%dd= f.number_field :usage_limit, class: 'text'
|
14
14
|
.splitContainer
|
15
15
|
%dl.quarter
|
16
16
|
%dt= f.label :discount_type
|
17
|
-
%dd= f.select :discount_type, options_for_select([['Percentage', 'percentage'], ['
|
17
|
+
%dd= f.select :discount_type, options_for_select([['Percentage', 'percentage'], ['Fixed Amount', 'fixed']], @promocode.discount_type), {}, { class: 'chosen' }
|
18
18
|
%dl.quarter
|
19
19
|
%dt= f.label :discount_value
|
20
|
-
%dd= f.text_field :discount_value, :
|
20
|
+
%dd= f.text_field :discount_value, class: 'text'
|
21
21
|
%dl.quarter
|
22
22
|
%dt= f.label :active_start_date
|
23
|
-
%dd= f.date_select :active_start_date, :
|
23
|
+
%dd= f.date_select :active_start_date, order: [:day, :month, :year]
|
24
24
|
%dl.quarter
|
25
25
|
%dt= f.label :active_end_date
|
26
|
-
%dd= f.date_select :active_end_date, :
|
26
|
+
%dd= f.date_select :active_end_date, order: [:day, :month, :year]
|
27
27
|
%p.submit
|
28
28
|
- unless @promocode.new_record?
|
29
|
-
%span.right= link_to "Delete", @promocode, :
|
30
|
-
= f.submit :
|
31
|
-
= link_to "Cancel", :promocodes, :
|
29
|
+
%span.right= link_to "Delete", @promocode, class: 'button purple', :method => :delete, :data => { confirm: "Are you sure you wish to remove this promo code?" }
|
30
|
+
= f.submit 'Submit', class: 'button green'
|
31
|
+
= link_to "Cancel", :promocodes, class: 'button'
|
@@ -1,5 +1,5 @@
|
|
1
|
-
- @page_title = "
|
1
|
+
- @page_title = "Promo Codes"
|
2
2
|
= content_for :header do
|
3
|
-
%p.buttons= link_to "Back to
|
4
|
-
%h2.products
|
3
|
+
%p.buttons= link_to "Back to Promo Codes", :promocodes, :class => 'button grey'
|
4
|
+
%h2.products Promo Codes
|
5
5
|
= render 'form'
|
@@ -1,8 +1,8 @@
|
|
1
|
-
- @page_title = "
|
1
|
+
- @page_title = "Promo Codes"
|
2
2
|
|
3
3
|
= content_for :header do
|
4
|
-
%p.buttons=link_to "New
|
5
|
-
%h2.products
|
4
|
+
%p.buttons=link_to "New Promo Code", :new_promocode, :class => 'button green'
|
5
|
+
%h2.products Promo Codes
|
6
6
|
|
7
7
|
.table
|
8
8
|
%table.data
|
@@ -17,13 +17,13 @@
|
|
17
17
|
%tbody
|
18
18
|
- if @promocodes.empty?
|
19
19
|
%tr.empty
|
20
|
-
%td{colspan:6} No
|
20
|
+
%td{colspan: 6} No promo codes to display.
|
21
21
|
- else
|
22
22
|
- for code in @promocodes
|
23
23
|
%tr
|
24
24
|
%td= link_to code.title, [:edit, code]
|
25
25
|
%td= code.code
|
26
|
-
%td
|
26
|
+
%td #{code.discount_value}#{code.display_discount_type}
|
27
27
|
%td= code.usage_limit
|
28
28
|
%td= code.times_used
|
29
29
|
%td= code.active? ? "Active" : "Not active"
|
@@ -1,5 +1,5 @@
|
|
1
|
-
- @page_title = "
|
1
|
+
- @page_title = "Promo Codes"
|
2
2
|
= content_for :header do
|
3
|
-
%p.buttons= link_to "Back to
|
4
|
-
%h2.products
|
3
|
+
%p.buttons= link_to "Back to Promo Codes", :promocodes, :class => 'button grey'
|
4
|
+
%h2.products Promo Codes
|
5
5
|
= render 'form'
|
data/lib/shoppe_promocode.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoppe_promocode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taras Zubyak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -46,7 +46,6 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- MIT-LICENSE
|
49
|
-
- README.rdoc
|
50
49
|
- Rakefile
|
51
50
|
- app/controllers/shoppe/promocodes_controller.rb
|
52
51
|
- app/models/shoppe/promocode.rb
|
data/README.rdoc
DELETED