effective_products 0.0.2 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/admin/stamps_controller.rb +9 -0
  3. data/app/controllers/effective/ring_wizards_controller.rb +10 -0
  4. data/app/controllers/effective/stamp_wizards_controller.rb +10 -0
  5. data/app/datatables/admin/effective_rings_datatable.rb +4 -5
  6. data/app/datatables/admin/effective_stamps_datatable.rb +43 -0
  7. data/app/datatables/{effective_ring_payments_datatable.rb → effective_ring_wizards_datatable.rb} +5 -5
  8. data/app/datatables/effective_stamp_wizards_datatable.rb +36 -0
  9. data/app/helpers/effective_products_helper.rb +0 -1
  10. data/app/models/concerns/{effective_products_ring_payment.rb → effective_products_ring_wizard.rb} +27 -36
  11. data/app/models/concerns/effective_products_stamp_wizard.rb +139 -0
  12. data/app/models/effective/ring.rb +2 -24
  13. data/app/models/effective/ring_wizard.rb +7 -0
  14. data/app/models/effective/stamp.rb +69 -0
  15. data/app/models/effective/stamp_wizard.rb +7 -0
  16. data/app/views/admin/rings/_ring.html.haml +23 -15
  17. data/app/views/admin/stamps/_stamp.html.haml +53 -0
  18. data/app/views/effective/{ring_payments → ring_wizards}/_content.html.haml +0 -0
  19. data/app/views/effective/ring_wizards/_dashboard.html.haml +27 -0
  20. data/app/views/effective/{ring_payments → ring_wizards}/_layout.html.haml +0 -0
  21. data/app/views/effective/ring_wizards/_orders.html.haml +4 -0
  22. data/app/views/effective/ring_wizards/_ring.html.haml +40 -0
  23. data/app/views/effective/{rings/_fields.html.haml → ring_wizards/_ring_fields.html.haml} +25 -7
  24. data/app/views/effective/ring_wizards/_ring_wizard.html.haml +3 -0
  25. data/app/views/effective/ring_wizards/_summary.html.haml +31 -0
  26. data/app/views/effective/ring_wizards/billing.html.haml +15 -0
  27. data/app/views/effective/ring_wizards/checkout.html.haml +6 -0
  28. data/app/views/effective/{ring_payments → ring_wizards}/ring.html.haml +4 -4
  29. data/app/views/effective/{ring_payments → ring_wizards}/start.html.haml +1 -1
  30. data/app/views/effective/ring_wizards/submitted.html.haml +16 -0
  31. data/app/views/effective/ring_wizards/summary.html.haml +8 -0
  32. data/app/views/effective/stamp_wizards/_content.html.haml +10 -0
  33. data/app/views/effective/stamp_wizards/_dashboard.html.haml +27 -0
  34. data/app/views/effective/stamp_wizards/_layout.html.haml +3 -0
  35. data/app/views/effective/stamp_wizards/_orders.html.haml +4 -0
  36. data/app/views/effective/stamp_wizards/_stamp.html.haml +45 -0
  37. data/app/views/effective/stamp_wizards/_stamp_fields.html.haml +45 -0
  38. data/app/views/effective/stamp_wizards/_stamp_wizard.html.haml +3 -0
  39. data/app/views/effective/stamp_wizards/_summary.html.haml +31 -0
  40. data/app/views/effective/{ring_payments → stamp_wizards}/billing.html.haml +1 -1
  41. data/app/views/effective/{ring_payments → stamp_wizards}/checkout.html.haml +1 -1
  42. data/app/views/effective/stamp_wizards/stamp.html.haml +18 -0
  43. data/app/views/effective/stamp_wizards/start.html.haml +16 -0
  44. data/app/views/effective/{ring_payments → stamp_wizards}/submitted.html.haml +4 -3
  45. data/app/views/effective/{ring_payments → stamp_wizards}/summary.html.haml +2 -2
  46. data/config/effective_products.rb +4 -4
  47. data/config/routes.rb +11 -3
  48. data/db/migrate/01_create_effective_products.rb.erb +98 -1
  49. data/lib/effective_products/engine.rb +2 -1
  50. data/lib/effective_products/version.rb +1 -1
  51. data/lib/effective_products.rb +6 -6
  52. metadata +42 -21
  53. data/app/controllers/effective/ring_payments_controller.rb +0 -31
  54. data/app/models/effective/ring_payment.rb +0 -7
  55. data/app/views/effective/ring_payments/_dashboard.html.haml +0 -27
  56. data/app/views/effective/ring_payments/_orders.html.haml +0 -4
  57. data/app/views/effective/ring_payments/_ring.html.haml +0 -29
  58. data/app/views/effective/ring_payments/_ring_fields.html.haml +0 -4
  59. data/app/views/effective/ring_payments/_ring_payment.html.haml +0 -8
  60. data/app/views/effective/ring_payments/_summary.html.haml +0 -31
@@ -1,3 +1,3 @@
1
1
  module EffectiveProducts
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.6'.freeze
3
3
  end
@@ -7,20 +7,20 @@ module EffectiveProducts
7
7
 
8
8
  def self.config_keys
9
9
  [
10
- :rings_table_name, :ring_payments_table_name, :ring_payment_class_name,
11
- :stamps_table_name, :stamp_payments_table_name, :stamp_payment_class_name,
10
+ :rings_table_name, :ring_wizards_table_name, :ring_wizard_class_name,
11
+ :stamps_table_name, :stamp_wizards_table_name, :stamp_wizard_class_name,
12
12
  :layout, :use_effective_roles
13
13
  ]
14
14
  end
15
15
 
16
16
  include EffectiveGem
17
17
 
18
- def self.RingPayment
19
- ring_payment_class_name&.constantize || Effective::RingPayment
18
+ def self.RingWizard
19
+ ring_wizard_class_name&.constantize || Effective::RingWizard
20
20
  end
21
21
 
22
- def self.StampPayment
23
- stamp_payment_class_name&.constantize || Effective::StampPayment
22
+ def self.StampWizard
23
+ stamp_wizard_class_name&.constantize || Effective::StampWizard
24
24
  end
25
25
 
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_products
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-27 00:00:00.000000000 Z
11
+ date: 2022-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -222,29 +222,50 @@ files:
222
222
  - app/assets/stylesheets/effective_products.scss
223
223
  - app/assets/stylesheets/effective_products/base.scss
224
224
  - app/controllers/admin/rings_controller.rb
225
- - app/controllers/effective/ring_payments_controller.rb
225
+ - app/controllers/admin/stamps_controller.rb
226
+ - app/controllers/effective/ring_wizards_controller.rb
227
+ - app/controllers/effective/stamp_wizards_controller.rb
226
228
  - app/datatables/admin/effective_rings_datatable.rb
227
- - app/datatables/effective_ring_payments_datatable.rb
229
+ - app/datatables/admin/effective_stamps_datatable.rb
230
+ - app/datatables/effective_ring_wizards_datatable.rb
231
+ - app/datatables/effective_stamp_wizards_datatable.rb
228
232
  - app/helpers/effective_products_helper.rb
229
- - app/models/concerns/effective_products_ring_payment.rb
233
+ - app/models/concerns/effective_products_ring_wizard.rb
234
+ - app/models/concerns/effective_products_stamp_wizard.rb
230
235
  - app/models/effective/ring.rb
231
- - app/models/effective/ring_payment.rb
236
+ - app/models/effective/ring_wizard.rb
237
+ - app/models/effective/stamp.rb
238
+ - app/models/effective/stamp_wizard.rb
232
239
  - app/views/admin/rings/_ring.html.haml
233
- - app/views/effective/ring_payments/_content.html.haml
234
- - app/views/effective/ring_payments/_dashboard.html.haml
235
- - app/views/effective/ring_payments/_layout.html.haml
236
- - app/views/effective/ring_payments/_orders.html.haml
237
- - app/views/effective/ring_payments/_ring.html.haml
238
- - app/views/effective/ring_payments/_ring_fields.html.haml
239
- - app/views/effective/ring_payments/_ring_payment.html.haml
240
- - app/views/effective/ring_payments/_summary.html.haml
241
- - app/views/effective/ring_payments/billing.html.haml
242
- - app/views/effective/ring_payments/checkout.html.haml
243
- - app/views/effective/ring_payments/ring.html.haml
244
- - app/views/effective/ring_payments/start.html.haml
245
- - app/views/effective/ring_payments/submitted.html.haml
246
- - app/views/effective/ring_payments/summary.html.haml
247
- - app/views/effective/rings/_fields.html.haml
240
+ - app/views/admin/stamps/_stamp.html.haml
241
+ - app/views/effective/ring_wizards/_content.html.haml
242
+ - app/views/effective/ring_wizards/_dashboard.html.haml
243
+ - app/views/effective/ring_wizards/_layout.html.haml
244
+ - app/views/effective/ring_wizards/_orders.html.haml
245
+ - app/views/effective/ring_wizards/_ring.html.haml
246
+ - app/views/effective/ring_wizards/_ring_fields.html.haml
247
+ - app/views/effective/ring_wizards/_ring_wizard.html.haml
248
+ - app/views/effective/ring_wizards/_summary.html.haml
249
+ - app/views/effective/ring_wizards/billing.html.haml
250
+ - app/views/effective/ring_wizards/checkout.html.haml
251
+ - app/views/effective/ring_wizards/ring.html.haml
252
+ - app/views/effective/ring_wizards/start.html.haml
253
+ - app/views/effective/ring_wizards/submitted.html.haml
254
+ - app/views/effective/ring_wizards/summary.html.haml
255
+ - app/views/effective/stamp_wizards/_content.html.haml
256
+ - app/views/effective/stamp_wizards/_dashboard.html.haml
257
+ - app/views/effective/stamp_wizards/_layout.html.haml
258
+ - app/views/effective/stamp_wizards/_orders.html.haml
259
+ - app/views/effective/stamp_wizards/_stamp.html.haml
260
+ - app/views/effective/stamp_wizards/_stamp_fields.html.haml
261
+ - app/views/effective/stamp_wizards/_stamp_wizard.html.haml
262
+ - app/views/effective/stamp_wizards/_summary.html.haml
263
+ - app/views/effective/stamp_wizards/billing.html.haml
264
+ - app/views/effective/stamp_wizards/checkout.html.haml
265
+ - app/views/effective/stamp_wizards/stamp.html.haml
266
+ - app/views/effective/stamp_wizards/start.html.haml
267
+ - app/views/effective/stamp_wizards/submitted.html.haml
268
+ - app/views/effective/stamp_wizards/summary.html.haml
248
269
  - config/effective_products.rb
249
270
  - config/routes.rb
250
271
  - db/migrate/01_create_effective_products.rb.erb
@@ -1,31 +0,0 @@
1
- module Effective
2
- class RingPaymentsController < ApplicationController
3
- before_action(:authenticate_user!) if defined?(Devise)
4
-
5
- include Effective::WizardController
6
-
7
- resource_scope -> { EffectiveProducts.RingPayment.deep.where(owner: current_user) }
8
-
9
- # Allow only 1 in-progress application at a time
10
- before_action(only: [:new, :show], unless: -> { resource&.done? }) do
11
- existing = resource_scope.in_progress.where.not(id: resource).first
12
-
13
- if existing.present?
14
- flash[:success] = "You have been redirected to your existing in progress payment"
15
- redirect_to effective_products.ring_payment_build_path(existing, existing.next_step)
16
- end
17
- end
18
-
19
- after_save do
20
- flash.now[:success] = ''
21
- end
22
-
23
- private
24
-
25
- def permitted_params
26
- model = (params.key?(:effective_ring_payment) ? :effective_ring_payment : :ring_payment)
27
- params.require(model).permit!.except(:status, :status_steps, :wizard_steps, :submitted_at)
28
- end
29
-
30
- end
31
- end
@@ -1,7 +0,0 @@
1
- module Effective
2
- class RingPayment < ActiveRecord::Base
3
- self.table_name = EffectiveProducts.ring_payments_table_name.to_s
4
-
5
- effective_products_ring_payment
6
- end
7
- end
@@ -1,27 +0,0 @@
1
- -# In progress payments
2
- - existing = EffectiveProducts.RingPayment.in_progress.for(current_user).first
3
- - datatable = EffectiveResources.best('EffectiveRingPaymentsDatatable').new(self, namespace: :effective)
4
-
5
- - if existing.present?
6
- %h2 In Progress Ring Payments
7
-
8
- %p Your payment for Professional Ring is incomplete
9
-
10
- %p
11
- Please
12
- = link_to("Continue payment for #{existing}", effective_products.ring_payment_build_path(existing, existing.next_step), 'data-turbolinks' => false, class: 'btn btn-primary')
13
- or you can
14
- = link_to('Abandon registration', effective_products.ring_payment_path(existing), 'data-confirm': "Really delete #{existing}?", 'data-method': :delete, class: 'btn btn-danger')
15
- to start over.
16
-
17
- %hr
18
-
19
- %h2 Ring Payments
20
-
21
- - if datatable.present?
22
- = render_simple_datatable(datatable)
23
- - else
24
- %p You have no past ring payments. When you do, we'll show them here.
25
-
26
- - if existing.blank?
27
- %p= link_to 'Order a Professional Ring', effective_products.new_ring_payment_path, class: 'btn btn-primary'
@@ -1,4 +0,0 @@
1
- - if ring_payment.submit_order&.purchased?
2
- .card.mb-4
3
- .card-body
4
- = render(ring_payment.submit_order)
@@ -1,29 +0,0 @@
1
- = card('Ring') do
2
- - ring = ring_payment.ring
3
-
4
- %table.table.table-sm
5
- %tbody
6
- %tr
7
- %th Contact Info
8
- %td
9
- #{ring.first_name} #{ring.last_name}
10
- %br
11
- = mail_to(ring.email)
12
- %br
13
- = ring.phone
14
-
15
- %tr
16
- %th Address
17
- %td= ring.shipping_address.to_html
18
-
19
- %tr
20
- %th Member Number
21
- %td= ring_payment.owner.membership&.number || 'None'
22
-
23
- %tr
24
- %th Metal
25
- %td= ring.metal
26
-
27
- %tr
28
- %th Size
29
- %td Size #{ring.size}
@@ -1,4 +0,0 @@
1
- = f.text_field :first_name
2
- = f.text_field :last_name
3
- = f.email_field :email
4
- = f.phone_field :phone
@@ -1,8 +0,0 @@
1
- .effective-ring-payment
2
- - blacklist = ring_payment.class.required_wizard_steps + [:summary]
3
- - steps = ring_payment.required_steps - blacklist
4
-
5
- = render "effective/ring_payments/summary", ring_payment: ring_payment
6
-
7
- - steps.select { |step| ring_payment.has_completed_step?(step) }.each do |partial|
8
- = render "effective/ring_payments/#{partial}", ring_payment: ring_payment, step: partial
@@ -1,31 +0,0 @@
1
- = card('Ring Payment') do
2
- - ring = ring_payment.ring
3
-
4
- %table.table.table-sm
5
- %tbody
6
- - if request.path.start_with?('/admin')
7
- %tr
8
- %th Ordered by
9
- %td
10
- - url = (polymorphic_admin_path(ring_payment.owner) rescue "/admin/users/#{ring_payment.owner.to_param}/edit")
11
- = link_to(ring_payment.owner, url)
12
- - else
13
- %tr
14
- %th Ordered by
15
- %td= ring_payment.owner
16
-
17
- - if ring_payment.orders.present?
18
- %tr
19
- %th Order
20
- %td
21
- - ring_payment.orders.each do |order|
22
- = link_to(order, effective_orders.order_path(order))
23
-
24
- - if ring_payment.was_submitted?
25
- %tr
26
- %th Submitted
27
- %td= ring_payment.submitted_at.strftime('%F')
28
-
29
- %tr
30
- %th Issued
31
- %td= ring.issued_at&.strftime('%F') || 'Not Issued'