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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dade9ee8f0a06d101188d8fa2076292b62c8ae80
4
- data.tar.gz: f2a6f8e6362749033640686099c2482ff2e1b31c
3
+ metadata.gz: d278f842d16b41e704a69079f9d195d633ab0803
4
+ data.tar.gz: f5f5f967871412dd355686e84e9a8643efd25793
5
5
  SHA512:
6
- metadata.gz: c5b99c77a596bb7625efcfd1774f7f12c3aa1876fc12c285be14abebec56466b85b265d5b836c0191085d1cfc76652069ddac665a3e0f54a4caf578fbd4fe799
7
- data.tar.gz: f9d9b2c5216747537d07fceeb5b3d6f399d9948929455bf5d2f28386896b357381dda47cddcd277c9f1a62bc7934405ec8cb4cc1c833bf0605c9ac68e0508bba
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: 'Promocode has been created successfully'}
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 => "Promocode has been removed successfully"
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 => "Promocode has been updated successfully"}
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 'Promocode Details' do
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, :class => 'focus text'
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, :class => 'text'
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, :class => 'text'
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'], ['Dollar Value', 'dollar']], @promocode.discount_type), {}, {:class => 'chosen'}
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, :class => 'text'
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, :class => 'chosen'
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, :class => 'chosen'
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, :class => 'button purple', :method => :delete, :data => {:confirm => "Are you sure you wish to remove this promocode?"}
30
- = f.submit :class => 'button green'
31
- = link_to "Cancel", :promocodes, :class => 'button'
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 = "Promocodes"
1
+ - @page_title = "Promo Codes"
2
2
  = content_for :header do
3
- %p.buttons= link_to "Back to promocodes list", :promocodes, :class => 'button'
4
- %h2.products Promocodes
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 = "Promocodes"
1
+ - @page_title = "Promo Codes"
2
2
 
3
3
  = content_for :header do
4
- %p.buttons=link_to "New promocode", :new_promocode, :class => 'button green'
5
- %h2.products Promocodes
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 promocodes to display.
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= "#{code.discount_value} #{code.display_discount_type}"
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 = "Promocodes"
1
+ - @page_title = "Promo Codes"
2
2
  = content_for :header do
3
- %p.buttons= link_to "Back to promocodes list", :promocodes, :class => 'button'
4
- %h2.products Promocodes
3
+ %p.buttons= link_to "Back to Promo Codes", :promocodes, :class => 'button grey'
4
+ %h2.products Promo Codes
5
5
  = render 'form'
@@ -1,4 +1,6 @@
1
1
  require "shoppe_promocode/engine"
2
+ require "shoppe/navigation_manager"
2
3
 
3
4
  module ShoppePromocode
5
+ #TODO: prepend a navigational item for Promo Codes
4
6
  end
@@ -1,3 +1,3 @@
1
1
  module ShoppePromocode
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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: 2015-10-05 00:00:00.000000000 Z
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
@@ -1,3 +0,0 @@
1
- = ShoppePromocode
2
-
3
- This project rocks and uses MIT-LICENSE.