piggybak_giftcerts 0.0.12 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6357dce3baab4878bd0277819aa8970b287ce582
4
+ data.tar.gz: 7a127581e4f6b8389f307a974c2713e17b89b755
5
+ SHA512:
6
+ metadata.gz: a47c4b1bde44994439bac3812948493d486cf197c804d22d60ffade76ee5ca9f3f2ff14272027e1496f87ed2b46babddc2136dd689c2aae19c88c1415044b691
7
+ data.tar.gz: 5f5ab54db83970ccdc76e3ed9b8a0525c543269e2b8db0565f16da445791257e3f7f22df6ad69cbde4a06cae7bfecac79985c4d3d8ac1c8cd3dddaae049849a2
@@ -0,0 +1 @@
1
+ //= require piggybak_giftcerts/piggybak_giftcerts
@@ -1,4 +1,7 @@
1
1
  $(function() {
2
+ if($('form#new_order').size() == 0) {
3
+ return;
4
+ }
2
5
  $('#giftcert_code').change(function() {
3
6
  piggybak_giftcerts.apply_giftcert();
4
7
  });
@@ -31,7 +34,7 @@ var piggybak_giftcerts = {
31
34
  $('#giftcert_response, #giftcert_application_row').hide();
32
35
  $('#giftcert_application_total').html('$0.00');
33
36
  if(!$('#payment').is(':visible')) {
34
- $('#piggybak_order_line_items_attributes_1_payment_attributes_number').val('');
37
+ $('#order_line_items_attributes_1_payment_attributes_number').val('');
35
38
  $('#payment').show();
36
39
  }
37
40
  var totalcost = piggybak.update_totals();
@@ -45,8 +48,8 @@ var piggybak_giftcerts = {
45
48
  dataType: "JSON",
46
49
  success: function(data) {
47
50
  if(data.valid_giftcert) {
48
- var el1 = $('<input>').attr('type', 'hidden').attr('name', 'piggybak_order[line_items_attributes][3][line_item_type]').val('giftcert_application');
49
- var el2 = $('<input>').attr('type', 'hidden').attr('name', 'piggybak_order[line_items_attributes][3][giftcert_application_attributes][code]').val($('#giftcert_code').val());
51
+ var el1 = $('<input>').attr('type', 'hidden').attr('name', 'order[line_items_attributes][3][line_item_type]').val('giftcert_application');
52
+ var el2 = $('<input>').attr('type', 'hidden').attr('name', 'order[line_items_attributes][3][giftcert_application_attributes][code]').val($('#giftcert_code').val());
50
53
  $('#giftcert').append(el1);
51
54
  $('#giftcert').append(el2);
52
55
  $('#giftcert_response').html('Gift Certificate successfully applied to order.').show();
@@ -54,7 +57,7 @@ var piggybak_giftcerts = {
54
57
  $('#giftcert_application_row').show();
55
58
  piggybak.update_totals();
56
59
  if($('#order_total').html() == '$0.00') {
57
- $('#piggybak_order_line_items_attributes_1_payment_attributes_number').val('giftcert');
60
+ $('#order_line_items_attributes_1_payment_attributes_number').val('giftcert');
58
61
  $('#payment').hide();
59
62
  }
60
63
  } else {
@@ -1,7 +1,5 @@
1
1
  module PiggybakGiftcerts
2
2
  class BuyableGiftcert < ActiveRecord::Base
3
- self.table_name = 'buyable_giftcerts'
4
-
5
3
  acts_as_sellable_with_variants
6
4
 
7
5
  validate :only_one
@@ -1,12 +1,10 @@
1
1
  module PiggybakGiftcerts
2
2
  class Giftcert < ActiveRecord::Base
3
- self.table_name = 'giftcerts'
4
-
5
3
  has_many :giftcert_applications
6
4
  belongs_to :order, :class_name => "::Piggybak::Order"
7
5
 
8
6
  attr_accessor :application_detail
9
- attr_accessible :code, :amount, :expiration_date, :order_id
7
+ # attr_accessible :code, :amount, :expiration_date, :order_id
10
8
 
11
9
  validates_presence_of :code, :amount, :expiration_date
12
10
  validates_uniqueness_of :code
@@ -1,12 +1,10 @@
1
1
  module PiggybakGiftcerts
2
2
  class GiftcertApplication < ActiveRecord::Base
3
- self.table_name = "giftcert_applications"
4
-
5
3
  belongs_to :giftcert
6
4
  belongs_to :line_item, :class_name => "::Piggybak::LineItem", :dependent => :destroy
7
5
 
8
6
  attr_accessor :code, :order
9
- attr_accessible :line_item_id, :gift_cert_id, :code
7
+ # attr_accessible :line_item_id, :gift_cert_id, :code
10
8
 
11
9
  validate :validate_giftcert
12
10
  def validate_giftcert
@@ -1,5 +1,3 @@
1
- <%= javascript_include_tag "piggybak_giftcerts/piggybak_giftcerts" %>
2
-
3
1
  <div id="piggybak_giftcert_apply_box">
4
2
  <div id="giftcert_response" style="display:none;"></div>
5
3
  <input type="text" name="piggybak_giftcert_code" id="giftcert_code" value="<%= params.has_key?(:piggybak_giftcert_code) ? params[:piggybak_giftcert_code] : '' %>" />
@@ -1,4 +1,4 @@
1
1
  PiggybakGiftcerts::Engine.routes.draw do
2
- match "/apply_giftcert" => "giftcert#apply"
3
- match "/giftcert" => "giftcert#purchase", :as => "buy_giftcert"
2
+ get "/apply_giftcert" => "giftcert#apply"
3
+ get "/giftcert" => "giftcert#purchase", :as => "buy_giftcert"
4
4
  end
@@ -0,0 +1,7 @@
1
+ class UpdatePiggybakGiftcertsTables < ActiveRecord::Migration
2
+ def change
3
+ rename_table :giftcerts, :piggybak_giftcerts_giftcerts
4
+ rename_table :buyable_giftcerts, :piggybak_giftcerts_buyable_giftcerts
5
+ rename_table :giftcert_applications, :piggybak_giftcerts_giftcert_applications
6
+ end
7
+ end
@@ -26,6 +26,7 @@ module PiggybakGiftcerts
26
26
  :sort => config.line_item_types[:payment][:sort]
27
27
  }
28
28
  config.line_item_types[:payment][:sort] += 1
29
+ config.additional_line_item_attributes[:giftcert_application_attributes] = [:code]
29
30
  end
30
31
  end
31
32
 
@@ -35,8 +36,8 @@ module PiggybakGiftcerts
35
36
  end
36
37
  end
37
38
 
38
- initializer "piggybak_giftcerts.precompile_hook", :group => :all do |app|
39
- app.config.assets.precompile += ['piggybak_giftcerts/piggybak_giftcerts.js']
39
+ initializer "piggybak_giftcerts.assets.precompile" do |app|
40
+ app.config.assets.precompile += ['piggybak_giftcerts/piggybak_coupons.js']
40
41
  end
41
42
 
42
43
  initializer "piggybak_giftcerts.rails_admin_config" do |app|
@@ -1,3 +1,3 @@
1
1
  module PiggybakGiftcerts
2
- VERSION = "0.0.12"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,62 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: piggybak_giftcerts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Steph Skardal
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-20 00:00:00.000000000 Z
11
+ date: 2014-03-27 00:00:00.000000000 Z
13
12
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 3.2.8
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 3.2.8
30
- - !ruby/object:Gem::Dependency
31
- name: piggybak
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
13
  - !ruby/object:Gem::Dependency
47
14
  name: piggybak_variants
48
15
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
16
  requirements:
51
- - - ! '>='
17
+ - - ">="
52
18
  - !ruby/object:Gem::Version
53
19
  version: '0'
54
20
  type: :runtime
55
21
  prerelease: false
56
22
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
23
  requirements:
59
- - - ! '>='
24
+ - - ">="
60
25
  - !ruby/object:Gem::Version
61
26
  version: '0'
62
27
  description: Gift Certificate support for Piggybak.
@@ -66,86 +31,81 @@ executables: []
66
31
  extensions: []
67
32
  extra_rdoc_files: []
68
33
  files:
69
- - app/controllers/piggybak_giftcerts/giftcert_controller.rb
34
+ - LICENSE
35
+ - README.md
36
+ - Rakefile
37
+ - app/assets/javascripts/piggybak_giftcerts/piggybak_giftcerts-application.js
70
38
  - app/assets/javascripts/piggybak_giftcerts/piggybak_giftcerts.js
39
+ - app/controllers/piggybak_giftcerts/giftcert_controller.rb
40
+ - app/mailers/piggybak_giftcerts/giftcert_mailer.rb
71
41
  - app/models/piggybak_giftcerts/buyable_giftcert.rb
72
- - app/models/piggybak_giftcerts/giftcert_application.rb
73
42
  - app/models/piggybak_giftcerts/giftcert.rb
74
- - app/views/piggybak_giftcerts/giftcert/purchase.html.erb
43
+ - app/models/piggybak_giftcerts/giftcert_application.rb
75
44
  - app/views/piggybak_giftcerts/_apply_giftcert.html.erb
45
+ - app/views/piggybak_giftcerts/giftcert/purchase.html.erb
76
46
  - app/views/piggybak_giftcerts/giftcert_mailer/info.text.erb
77
- - app/mailers/piggybak_giftcerts/giftcert_mailer.rb
78
47
  - config/routes.rb
79
48
  - db/migrate/20121026200953_piggybak_giftcert_setup.rb
49
+ - db/migrate/20140325200816_update_piggybak_giftcerts_tables.rb
50
+ - lib/piggybak_giftcerts.rb
51
+ - lib/piggybak_giftcerts/engine.rb
80
52
  - lib/piggybak_giftcerts/line_item_decorator.rb
81
- - lib/piggybak_giftcerts/percent_decorator.rb
82
53
  - lib/piggybak_giftcerts/order_decorator.rb
83
- - lib/piggybak_giftcerts/engine.rb
54
+ - lib/piggybak_giftcerts/percent_decorator.rb
84
55
  - lib/piggybak_giftcerts/version.rb
85
- - lib/piggybak_giftcerts.rb
86
- - LICENSE
87
- - Rakefile
88
- - README.md
89
- - test/integration/navigation_test.rb
90
- - test/test_helper.rb
91
- - test/piggybak_giftcerts_test.rb
92
- - test/dummy/script/rails
93
- - test/dummy/Rakefile
94
56
  - test/dummy/README.rdoc
95
- - test/dummy/app/controllers/application_controller.rb
96
- - test/dummy/app/assets/stylesheets/application.css
57
+ - test/dummy/Rakefile
97
58
  - test/dummy/app/assets/javascripts/application.js
59
+ - test/dummy/app/assets/stylesheets/application.css
60
+ - test/dummy/app/controllers/application_controller.rb
98
61
  - test/dummy/app/helpers/application_helper.rb
99
62
  - test/dummy/app/views/layouts/application.html.erb
100
- - test/dummy/config/locales/en.yml
63
+ - test/dummy/config.ru
64
+ - test/dummy/config/application.rb
65
+ - test/dummy/config/boot.rb
66
+ - test/dummy/config/database.yml
101
67
  - test/dummy/config/environment.rb
102
- - test/dummy/config/routes.rb
68
+ - test/dummy/config/environments/development.rb
103
69
  - test/dummy/config/environments/production.rb
104
70
  - test/dummy/config/environments/test.rb
105
- - test/dummy/config/environments/development.rb
106
- - test/dummy/config/initializers/wrap_parameters.rb
107
- - test/dummy/config/initializers/secret_token.rb
108
- - test/dummy/config/initializers/mime_types.rb
109
- - test/dummy/config/initializers/session_store.rb
110
71
  - test/dummy/config/initializers/backtrace_silencers.rb
111
72
  - test/dummy/config/initializers/inflections.rb
112
- - test/dummy/config/boot.rb
113
- - test/dummy/config/application.rb
114
- - test/dummy/config/database.yml
115
- - test/dummy/public/500.html
73
+ - test/dummy/config/initializers/mime_types.rb
74
+ - test/dummy/config/initializers/secret_token.rb
75
+ - test/dummy/config/initializers/session_store.rb
76
+ - test/dummy/config/initializers/wrap_parameters.rb
77
+ - test/dummy/config/locales/en.yml
78
+ - test/dummy/config/routes.rb
79
+ - test/dummy/public/404.html
116
80
  - test/dummy/public/422.html
81
+ - test/dummy/public/500.html
117
82
  - test/dummy/public/favicon.ico
118
- - test/dummy/public/404.html
119
- - test/dummy/config.ru
83
+ - test/dummy/script/rails
84
+ - test/integration/navigation_test.rb
85
+ - test/piggybak_giftcerts_test.rb
86
+ - test/test_helper.rb
120
87
  homepage: http://www.piggybak.org/
121
88
  licenses: []
89
+ metadata: {}
122
90
  post_install_message:
123
91
  rdoc_options: []
124
92
  require_paths:
125
93
  - lib
126
94
  required_ruby_version: !ruby/object:Gem::Requirement
127
- none: false
128
95
  requirements:
129
- - - ! '>='
96
+ - - ">="
130
97
  - !ruby/object:Gem::Version
131
98
  version: '0'
132
- segments:
133
- - 0
134
- hash: 3703336564706327832
135
99
  required_rubygems_version: !ruby/object:Gem::Requirement
136
- none: false
137
100
  requirements:
138
- - - ! '>='
101
+ - - ">="
139
102
  - !ruby/object:Gem::Version
140
103
  version: '0'
141
- segments:
142
- - 0
143
- hash: 3703336564706327832
144
104
  requirements: []
145
105
  rubyforge_project:
146
- rubygems_version: 1.8.23
106
+ rubygems_version: 2.2.2
147
107
  signing_key:
148
- specification_version: 3
108
+ specification_version: 4
149
109
  summary: Gift Certificate support for Piggybak.
150
110
  test_files:
151
111
  - test/integration/navigation_test.rb