effective_classifieds 0.3.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/effective/classifieds_controller.rb +2 -3
  3. data/app/datatables/admin/effective_classified_wizards_datatable.rb +2 -0
  4. data/app/datatables/admin/effective_classifieds_datatable.rb +2 -0
  5. data/app/datatables/effective_classified_wizards_datatable.rb +2 -2
  6. data/app/datatables/effective_classifieds_datatable.rb +4 -5
  7. data/app/models/concerns/effective_classifieds_classified_wizard.rb +66 -14
  8. data/app/models/effective/classified.rb +11 -1
  9. data/app/views/admin/classifieds/_form.html.haml +7 -1
  10. data/app/views/admin/classifieds/_form_access.html.haml +2 -2
  11. data/app/views/admin/classifieds/_form_classified.html.haml +1 -0
  12. data/app/views/effective/classified_wizards/_additional_fields.html.haml +1 -0
  13. data/app/views/effective/classified_wizards/_classified.html.haml +1 -1
  14. data/app/views/effective/classified_wizards/_dashboard.html.haml +5 -6
  15. data/app/views/effective/classified_wizards/_layout.html.haml +1 -1
  16. data/app/views/effective/classified_wizards/_orders.html.haml +4 -0
  17. data/app/views/effective/classified_wizards/_summary.html.haml +25 -26
  18. data/app/views/effective/classified_wizards/billing.html.haml +15 -0
  19. data/app/views/effective/classified_wizards/checkout.html.haml +5 -0
  20. data/app/views/effective/classified_wizards/classified.html.haml +3 -1
  21. data/app/views/effective/classified_wizards/start.html.haml +3 -4
  22. data/app/views/effective/classified_wizards/submitted.html.haml +16 -1
  23. data/app/views/effective/classified_wizards/summary.html.haml +1 -1
  24. data/app/views/effective/classifieds/_classified.html.haml +49 -46
  25. data/app/views/effective/classifieds/_dashboard.html.haml +3 -3
  26. data/app/views/effective/classifieds/_fields.html.haml +8 -6
  27. data/app/views/effective/classifieds/_layout.html.haml +2 -0
  28. data/app/views/effective/classifieds/_summary.html.haml +49 -0
  29. data/app/views/effective/classifieds/index.html.haml +8 -7
  30. data/app/views/effective/classifieds/show.html.haml +2 -2
  31. data/app/views/effective/classifieds_mailer/classified_submitted.html.haml +4 -4
  32. data/config/effective_classifieds.rb +3 -0
  33. data/db/migrate/01_create_effective_classifieds.rb.erb +9 -0
  34. data/lib/effective_classifieds/version.rb +1 -1
  35. data/lib/effective_classifieds.rb +1 -1
  36. metadata +23 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb0cfd942db297b12029c3482f9640b4016070b23293a8920f09cf7308b9f511
4
- data.tar.gz: 5677c6e19346e790344bf5dfaca5d411a06ec089e660a6fb0c13f19481b3393e
3
+ metadata.gz: 7791ff5277633953b3d9d43f9cdf8521954411ef5eb00ece46e14386cff7b0f4
4
+ data.tar.gz: '083ed5e9866481fc5513262496053f5ba4f5ea3b597d7d5a7218035dd75ecda5'
5
5
  SHA512:
6
- metadata.gz: 2af2f02865c7961f045b3f259e6ba238b5b8f1485a72645771f278806a929887256971e8ca71e5d220e1e5f41cd04abd0354325ac72b380956d6e9b4e755b10d
7
- data.tar.gz: 0c80ae59bf92b7777cc0924a08c950a8687aee561ebe4901d4fe7023d8023f10ad03897eb68e29edcafac462fbc405911e9eccd8055a86b4c0b08e31bbe54017
6
+ metadata.gz: fe6fc5ad68ad34f5c34915a997b08cb8550d8245e254d25b8c2e0f121e88e58b7d9af2918e0f4207e98746ad0040e00268fb88772956453121a82d0eaec63c9b
7
+ data.tar.gz: d8503e3830fdedbf1b7ac6d01df2050c134ce23dd7fc5151462218572620fd02df1b8f754e9bc1b4e200c7640278a4a93ff1f3de1a599faa647a9c6a4ebf607c
@@ -14,9 +14,8 @@ module Effective
14
14
  if EffectiveResources.authorized?(self, :admin, :effective_classifieds)
15
15
  flash.now[:warning] = [
16
16
  'Hi Admin!',
17
- ('You are viewing a hidden classified.' unless @classified.published?),
18
- 'Click here to',
19
- ("<a href='#{effective_classifieds.edit_admin_classified_path(@classified)}' class='alert-link'>edit classified settings</a>.")
17
+ ('You are viewing a hidden posting.' unless @classified.published?),
18
+ ("<a href='#{effective_classifieds.edit_admin_classified_path(@classified)}' class='alert-link'>Click here to edit settings</a>.")
20
19
  ].compact.join(' ')
21
20
  end
22
21
 
@@ -12,6 +12,8 @@ class Admin::EffectiveClassifiedWizardsDatatable < Effective::Datatable
12
12
  col :classified, search: :string
13
13
  col :owner
14
14
 
15
+ col :orders
16
+
15
17
  actions_col
16
18
  end
17
19
 
@@ -45,6 +45,8 @@ module Admin
45
45
  col :status, search: ['submitted', 'approved']
46
46
  end
47
47
 
48
+ col :purchased_order, visible: false
49
+
48
50
  actions_col do |classified|
49
51
  dropdown_link_to('View Classified', effective_classifieds.classified_path(classified), target: '_blank')
50
52
  end
@@ -10,7 +10,7 @@ class EffectiveClassifiedWizardsDatatable < Effective::Datatable
10
10
  wizard.submitted_at&.strftime('%F') || 'Incomplete'
11
11
  end
12
12
 
13
- col :classified, search: :string, label: 'Title'
13
+ col :classifieds, search: :string, label: 'Title'
14
14
 
15
15
  col :owner, visible: false, search: :string
16
16
 
@@ -30,7 +30,7 @@ class EffectiveClassifiedWizardsDatatable < Effective::Datatable
30
30
  end
31
31
 
32
32
  collection do
33
- EffectiveClassifieds.ClassifiedWizard.deep.where(owner: current_user).left_joins(:classified)
33
+ EffectiveClassifieds.ClassifiedWizard.deep.where(owner: current_user)
34
34
  end
35
35
 
36
36
  end
@@ -4,16 +4,15 @@ class EffectiveClassifiedsDatatable < Effective::Datatable
4
4
  length :all
5
5
  order :start_on
6
6
 
7
- col :start_on, as: :date, label: 'Posted'
7
+ col :start_on, as: :date, label: 'Published'
8
+ col :end_on, as: :date, label: 'Closing'
8
9
 
9
10
  col :title do |classified|
10
11
  link_to classified, effective_classifieds.classified_path(classified)
11
12
  end
12
13
 
13
- col :end_on, as: :date, label: 'Expires', visible: false
14
-
15
- col :organization, visible: false
16
- col :location, visible: false
14
+ col :organization
15
+ col :location
17
16
 
18
17
  col :body, visible: false
19
18
  col :website, visible: false
@@ -19,6 +19,7 @@ module EffectiveClassifiedsClassifiedWizard
19
19
 
20
20
  included do
21
21
  acts_as_tokened
22
+ acts_as_purchasable_parent
22
23
 
23
24
  acts_as_statused(
24
25
  :draft, # Just Started
@@ -27,11 +28,15 @@ module EffectiveClassifiedsClassifiedWizard
27
28
 
28
29
  acts_as_wizard(
29
30
  start: 'Start',
30
- classified: 'Classified',
31
+ classified: 'Posting',
31
32
  summary: 'Review',
33
+ billing: 'Billing Address',
34
+ checkout: 'Checkout',
32
35
  submitted: 'Submitted'
33
36
  )
34
37
 
38
+ acts_as_purchasable_wizard
39
+
35
40
  log_changes(except: :wizard_steps) if respond_to?(:log_changes)
36
41
 
37
42
  # Application Namespace
@@ -39,8 +44,8 @@ module EffectiveClassifiedsClassifiedWizard
39
44
  accepts_nested_attributes_for :owner
40
45
 
41
46
  # Effective Namespace
42
- has_one :classified, class_name: 'Effective::Classified', inverse_of: :classified_wizard, dependent: :destroy
43
- accepts_nested_attributes_for :classified, reject_if: :all_blank, allow_destroy: true
47
+ has_many :classifieds, class_name: 'Effective::Classified', inverse_of: :classified_wizard, dependent: :destroy
48
+ accepts_nested_attributes_for :classifieds, reject_if: :all_blank, allow_destroy: true
44
49
 
45
50
  effective_resource do
46
51
  # Acts as Statused
@@ -50,13 +55,16 @@ module EffectiveClassifiedsClassifiedWizard
50
55
  # Dates
51
56
  submitted_at :datetime
52
57
 
58
+ # Pricing
59
+ price_category :string
60
+
53
61
  # Acts as Wizard
54
62
  wizard_steps :text, permitted: false
55
63
 
56
64
  timestamps
57
65
  end
58
66
 
59
- scope :deep, -> { includes(:classified) }
67
+ scope :deep, -> { includes(:classifieds) }
60
68
  scope :sorted, -> { order(:id) }
61
69
 
62
70
  scope :in_progress, -> { where.not(status: [:submitted]) }
@@ -71,11 +79,35 @@ module EffectiveClassifiedsClassifiedWizard
71
79
  with_options(if: -> { current_step == :classified }) do
72
80
  validates :classified, presence: true
73
81
  end
82
+
83
+ # All Fees and Orders
84
+ def submit_fees
85
+ classifieds
86
+ end
87
+
88
+ def after_submit_purchased!
89
+ # Nothing to do
90
+ end
91
+
92
+ # Overrides the acts_as_purchasable_wizard submit!
93
+ def submit!
94
+ raise('already submitted') if was_submitted?
95
+
96
+ if checkout_required?
97
+ raise('expected a purchased order') unless submit_order&.purchased?
98
+ wizard_steps[:checkout] ||= Time.zone.now
99
+ end
100
+
101
+ wizard_steps[:submitted] = Time.zone.now
102
+ classified.submit! unless classified.was_submitted?
103
+
104
+ submitted!
105
+ end
74
106
  end
75
107
 
76
108
  # Instance Methods
77
109
  def to_s
78
- 'classified ad submission'
110
+ 'posting submission'
79
111
  end
80
112
 
81
113
  def in_progress?
@@ -86,19 +118,39 @@ module EffectiveClassifiedsClassifiedWizard
86
118
  submitted?
87
119
  end
88
120
 
89
- # Called on the Review / Summary Step
90
- # But we actually want to submit it
91
- def summary!
92
- submit!
121
+ def checkout_required?
122
+ required_steps.include?(:billing) && required_steps.include?(:checkout)
123
+ end
124
+
125
+ def no_checkout_required?
126
+ required_steps.exclude?(:billing) && required_steps.exclude?(:checkout)
93
127
  end
94
128
 
95
- def submit!
96
- raise('already submitted') if was_submitted?
129
+ def classified
130
+ classifieds.first
131
+ end
97
132
 
98
- classified.submit! unless classified.was_submitted?
133
+ def build_classified
134
+ classifieds.build(owner: owner)
135
+ end
99
136
 
100
- wizard_steps[:submitted] = Time.zone.now
101
- submitted!
137
+ def assign_pricing
138
+ raise('to be implemented by including class')
139
+ # classified.assign_attributes(price: price, qb_item_name: qb_item_name, tax_exempt: tax_exempt)
140
+ end
141
+
142
+ # After the configure Classified step
143
+ def classified!
144
+ assign_pricing() if classified.present?
145
+ raise('expected classified to have a price') if classified.price.blank?
146
+
147
+ save!
148
+ end
149
+
150
+ # This is the review/summary step. Last one if we're not doing checkout
151
+ def summary!
152
+ return submit! if no_checkout_required?
153
+ save!
102
154
  end
103
155
 
104
156
  end
@@ -7,6 +7,7 @@ module Effective
7
7
  attr_accessor :current_user
8
8
 
9
9
  acts_as_slugged
10
+ acts_as_purchasable
10
11
  log_changes if respond_to?(:log_changes)
11
12
  acts_as_role_restricted if respond_to?(:acts_as_role_restricted)
12
13
 
@@ -17,6 +18,7 @@ module Effective
17
18
  # When submitted through the wizard
18
19
  belongs_to :classified_wizard, polymorphic: true, optional: true
19
20
 
21
+ has_one_attached :file
20
22
  has_rich_text :body
21
23
 
22
24
  acts_as_statused(
@@ -53,6 +55,10 @@ module Effective
53
55
 
54
56
  archived :boolean
55
57
 
58
+ price :integer
59
+ tax_exempt :boolean
60
+ qb_item_name :string
61
+
56
62
  timestamps
57
63
  end
58
64
 
@@ -103,7 +109,7 @@ module Effective
103
109
 
104
110
  # Automatically approve submissions created by admins outside the submissions wizard
105
111
  before_validation(if: -> { new_record? && classified_wizard.blank? }) do
106
- assign_attributes(status: :approved)
112
+ assign_attributes(status: :approved, price: 0)
107
113
  end
108
114
 
109
115
  validates :title, presence: true, length: { maximum: 200 }
@@ -133,6 +139,10 @@ module Effective
133
139
  self.errors.add(:category, 'is invalid') unless Array(EffectiveClassifieds.categories).include?(category)
134
140
  end
135
141
 
142
+ validate(if: -> { file.attached? && !Rails.env.test? }) do
143
+ self.errors.add(:file, 'expected a .pdf file') unless file.content_type == 'application/pdf'
144
+ end
145
+
136
146
  def to_s
137
147
  title.presence || 'New Classified'
138
148
  end
@@ -1,5 +1,5 @@
1
1
  = tabs do
2
- = tab 'Classified' do
2
+ = tab 'Posting' do
3
3
  = render 'admin/classifieds/form_classified', classified: classified
4
4
 
5
5
  - if classified.persisted?
@@ -7,6 +7,12 @@
7
7
  = tab 'Access' do
8
8
  = render '/admin/classifieds/form_access', classified: classified
9
9
 
10
+ - if classified.classified_wizard.present?
11
+ = tab 'Orders' do
12
+ %h2 Orders
13
+ - datatable = Admin::EffectiveOrdersDatatable.new(parent: classified.classified_wizard, owner: classified.owner, user: classified.owner, total: false)
14
+ = render_datatable(datatable, simple: true)
15
+
10
16
  - if classified.respond_to?(:log_changes_datatable)
11
17
  = tab 'Logs' do
12
18
  = render_inline_datatable(classified.log_changes_datatable)
@@ -1,10 +1,10 @@
1
1
  = effective_form_with(model: classified, url: classified.persisted? ? effective_classifieds.admin_classified_path(classified.id) : effective_classifieds.admin_classifieds_path) do |f|
2
- = f.check_box :authenticate_user, label: 'Yes, the user must be be signed in to view this classified', hint: 'Sign up is required to register for any classified'
2
+ = f.check_box :authenticate_user, label: 'Yes, the user must be be signed in to view', hint: 'Sign up is required to register for any classified'
3
3
 
4
4
  - if EffectiveClassifieds.use_effective_roles
5
5
  = f.checks :roles, EffectiveRoles.roles_collection(f.object)
6
6
 
7
7
  %p.text-hint
8
- * leave blank for a regular public classified that anyone can view
8
+ * Do not select a role to allow anyone with an account to view
9
9
 
10
10
  = f.submit
@@ -1,3 +1,4 @@
1
1
  = effective_form_with(model: [:admin, classified], engine: true) do |f|
2
2
  = render('effective/classifieds/fields', f: f, classified: f.object)
3
+
3
4
  = effective_submit(f)
@@ -0,0 +1 @@
1
+ - # Intentionally Blank
@@ -7,4 +7,4 @@
7
7
  = link_to('Edit', wizard_path(:classified)) if edit_effective_wizard?
8
8
 
9
9
  - classified = classified_wizard.classified
10
- = render 'effective/classifieds/classified', classified: classified
10
+ = render 'effective/classifieds/summary', classified: classified
@@ -5,10 +5,9 @@
5
5
  - datatable = EffectiveResources.best('EffectiveClassifiedWizardsDatatable').new(self, namespace: :effective)
6
6
 
7
7
  - if submission.present?
8
- %h2 In-progress Classified Ads
8
+ %h2 In-progress Postings
9
9
 
10
- %p
11
- Your submission for #{submission.classified.presence || 'a classified'} is incomplete.
10
+ %p Your posting submission is incomplete:
12
11
 
13
12
  %p
14
13
  Please
@@ -19,12 +18,12 @@
19
18
 
20
19
  %hr
21
20
 
22
- %h2 Classified Ads
21
+ %h2= EffectiveClassifieds.classifieds_label
23
22
 
24
23
  - if datatable.present?
25
24
  = render_simple_datatable(datatable)
26
25
  - else
27
- %p You don't have any classified ads. When you do, we'll show them here.
26
+ %p You don't have any postings. When you do, we'll show them here.
28
27
 
29
28
  - if submission.blank?
30
- %p= link_to 'Submit New Classified Ad', effective_classifieds.new_classified_wizard_path, class: 'btn btn-primary'
29
+ %p= link_to "Submit New #{EffectiveClassifieds.classifieds_label} Posting", effective_classifieds.new_classified_wizard_path, class: 'btn btn-primary'
@@ -1,3 +1,3 @@
1
1
  .row
2
2
  .col-lg-3.mb-3= render_wizard_sidebar(resource)
3
- .col-lg-9= yield
3
+ .col-lg-9.pb-3= yield
@@ -0,0 +1,4 @@
1
+ - if classified_wizard.submit_order&.purchased?
2
+ .card.mb-4
3
+ .card-body
4
+ = render(classified_wizard.submit_order)
@@ -1,30 +1,29 @@
1
- = card('Classified Ad') do
2
- - classified = classified_wizard.classified
1
+ - classified = classified_wizard.classified
3
2
 
4
- %table.table.table-sm
5
- %tbody
6
- %tr
7
- %th.border-0 Classified
8
- %td.border-0
3
+ %table.table.table-sm
4
+ %tbody
5
+ %tr
6
+ %th.border-0 Posting
7
+ %td.border-0
9
8
 
10
- - if classified&.published?
11
- = link_to(classified, effective_classifieds.classified_path(classified), target: '_blank')
12
- - else
13
- = classified.presence || 'Classified was deleted'
9
+ - if classified&.published?
10
+ = link_to(classified, effective_classifieds.classified_path(classified), target: '_blank')
11
+ - else
12
+ = classified.presence || 'Posting was deleted'
14
13
 
15
- - if request.path.start_with?('/admin')
16
- %tr
17
- %th Owner
18
- %td
19
- - url = (polymorphic_admin_path(classified_wizard.owner) rescue "/admin/users/#{classified_wizard.owner.to_param}/edit")
20
- = link_to(classified_wizard.owner, url)
21
- - else
22
- %tr
23
- %th Owner
24
- %td= classified_wizard.owner
14
+ - if request.path.start_with?('/admin')
15
+ %tr
16
+ %th Owner
17
+ %td
18
+ - url = (polymorphic_admin_path(classified_wizard.owner) rescue "/admin/users/#{classified_wizard.owner.to_param}/edit")
19
+ = link_to(classified_wizard.owner, url)
20
+ - else
21
+ %tr
22
+ %th Owner
23
+ %td= classified_wizard.owner
25
24
 
26
- - if classified&.was_submitted?
27
- %tr
28
- %th Status
29
- %td
30
- %span.badge.badge-secondary= classified.status
25
+ - if classified&.was_submitted?
26
+ %tr
27
+ %th Status
28
+ %td
29
+ %span.badge.badge-secondary= classified.status
@@ -0,0 +1,15 @@
1
+ = render 'layout' do
2
+ = render 'effective/classified_wizards/content', resource: resource
3
+
4
+ - raise('expected owner to respond to billing_address') unless resource.owner.respond_to?(:billing_address)
5
+
6
+ = card do
7
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
8
+ = f.hidden_field :id
9
+
10
+ = f.fields_for(:owner, f.object.owner) do |fo|
11
+ = effective_address_fields(fo, :billing)
12
+
13
+ %p.text-muted * Not all postings require a fee and we ask for a billing address for future use.
14
+
15
+ = f.save 'Save and Continue'
@@ -0,0 +1,5 @@
1
+ = render 'layout' do
2
+ = render 'effective/classified_wizards/content', resource: resource
3
+
4
+ = card do
5
+ = render_checkout_step2(resource.submit_order, purchased_url: wizard_path(:submitted), deferred_url: wizard_path(:checkout), declined_url: wizard_path(:checkout))
@@ -6,7 +6,7 @@
6
6
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
7
  = f.hidden_field :id
8
8
 
9
- = f.fields_for :classified, (f.object.classified || f.object.build_classified) do |fc|
9
+ = f.fields_for :classifieds, (f.object.classified || f.object.build_classified) do |fc|
10
10
  = fc.hidden_field :id
11
11
 
12
12
  = fc.hidden_field :owner_id, value: f.object.owner_id
@@ -14,4 +14,6 @@
14
14
 
15
15
  = render('effective/classifieds/fields', f: fc, classified: fc.object)
16
16
 
17
+ = render('effective/classified_wizards/additional_fields', f: f, classified_wizard: f.object)
18
+
17
19
  = f.save 'Save and Continue'
@@ -3,13 +3,12 @@
3
3
 
4
4
  .card
5
5
  .card-body
6
- %p
7
- Welcome #{current_user}!
6
+ %p Welcome #{current_user}!
8
7
 
9
8
  %p
10
- You can use this wizard to post a new classified ad.
9
+ You can use this wizard to submit a new #{EffectiveClassifieds.classifieds_label} posting.
11
10
  Your progress will be saved as you move through the wizard.
12
- Once the ad published you will be able to come back and edit/change the details.
11
+ Once your posting is published you are able to come back and edit the details.
13
12
 
14
13
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
15
14
  = f.hidden_field :id
@@ -1,14 +1,29 @@
1
1
  = render 'layout' do
2
2
  = render 'effective/classified_wizards/content', resource: resource
3
3
 
4
+ - classified = resource.classified
5
+
4
6
  - raise('expected a submitted classified_wizard') unless resource.was_submitted?
7
+ - raise('expected a submitted classified') unless classified.was_submitted?
8
+
9
+ - if resource.checkout_required?
10
+ - raise('expected a purchased classified submit_order') unless resource.submit_order&.purchased?
5
11
 
6
12
  .alert.alert-warning.mb-4
7
- Successfully submitted on #{resource.submitted_at.strftime('%F')}.
13
+ This posting was submitted on #{classified.submitted_at.strftime('%F')}.
14
+
15
+ - unless classified.approved?
16
+ .alert.alert-danger.mb-4
17
+ Your posting must still be approved before it will be displayed.
8
18
 
9
19
  = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary mb-4'
10
20
 
11
21
  = render 'effective/classified_wizards/summary', classified_wizard: resource
12
22
  = render 'effective/classified_wizards/classified_wizard', classified_wizard: resource
13
23
 
24
+ - if resource.orders.present?
25
+ .mb-4
26
+ = collapse('Show orders...', card_class: 'my-2') do
27
+ = render 'effective/classified_wizards/orders', classified_wizard: resource
28
+
14
29
  = link_to "Return to Dashboard", root_path, class: 'btn btn-lg btn-primary'
@@ -5,4 +5,4 @@
5
5
 
6
6
  = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
7
7
  = f.hidden_field :id
8
- = f.submit 'Submit Classified Ad', class: 'btn btn-primary'
8
+ = f.submit "Submit #{EffectiveClassifieds.classifieds_label} Posting", class: 'btn btn-primary'
@@ -1,46 +1,49 @@
1
- .card
2
- .card-body
3
- %table.table.effective-classified-table
4
- %tbody
5
- %tr
6
- %th Category
7
- %td= classified.category
8
-
9
- %tr
10
- %th Title
11
- %td= classified.title
12
-
13
- %tr
14
- %th Available
15
- %td
16
- #{classified.start_on&.strftime('%F')}
17
- to
18
- #{classified.end_on&.strftime('%F')}
19
-
20
- - if classified.website.present?
21
- %tr
22
- %th Location
23
- %td= classified.location
24
-
25
- %tr
26
- %th Description
27
- %td= classified.body
28
-
29
- %tr
30
- %th Company
31
- %td= classified.organization
32
-
33
- - if classified.website.present?
34
- %tr
35
- %th Website
36
- %td= link_to(classified.website, classified.website, target: '_blank')
37
-
38
- - if classified.email.present?
39
- %tr
40
- %th Email
41
- %td= mail_to(classified.email)
42
-
43
- - if classified.phone.present?
44
- %tr
45
- %th Phone
46
- %td= classified.phone
1
+ %table.table.effective-classified-table
2
+ %tbody
3
+ %tr
4
+ %th Category
5
+ %td= classified.category
6
+
7
+ %tr
8
+ %th Title
9
+ %td= classified.title
10
+
11
+ %tr
12
+ %th Available
13
+ %td
14
+ #{classified.start_on&.strftime('%F')}
15
+ to
16
+ #{classified.end_on&.strftime('%F')}
17
+
18
+ - if classified.location.present?
19
+ %tr
20
+ %th Location
21
+ %td= classified.location
22
+
23
+ %tr
24
+ %th Description
25
+ %td= classified.body.to_s
26
+
27
+ - if classified.file.attached?
28
+ %tr
29
+ %th Attachment
30
+ %td= link_to(classified.file.filename, main_app.url_for(classified.file), target: '_blank')
31
+
32
+ %tr
33
+ %th Company
34
+ %td= classified.organization
35
+
36
+ - if classified.website.present?
37
+ %tr
38
+ %th Website
39
+ %td= link_to(classified.website, classified.website, target: '_blank')
40
+
41
+ - if classified.email.present?
42
+ %tr
43
+ %th Email
44
+ %td= mail_to(classified.email)
45
+
46
+ - if classified.phone.present?
47
+ %tr
48
+ %th Phone
49
+ %td= classified.phone
@@ -1,4 +1,4 @@
1
- %h2 Classifieds
1
+ %h2= EffectiveClassifieds.classifieds_label
2
2
 
3
3
  - published = Effective::Classified.classifieds(user: current_user).count
4
4
 
@@ -6,6 +6,6 @@
6
6
  - datatable = EffectiveClassifiedsDatatable.new(self, namespace: :effective)
7
7
  = render_datatable(datatable, simple: true)
8
8
  - else
9
- %p There are no active classified ads. When there are, we'll show them here.
9
+ %p There are no active postings. When there are, we'll show them here.
10
10
 
11
- %p= link_to 'View All Classifieds', effective_classifieds.classifieds_path, class: 'btn btn-primary'
11
+ %p= link_to 'View All', effective_classifieds.classifieds_path, class: 'btn btn-primary'
@@ -1,5 +1,5 @@
1
1
  = f.select :category, EffectiveClassifieds.categories, required: true
2
- = f.text_field :title
2
+ = f.text_field :title, label: "#{EffectiveClassifieds.classifieds_label} Posting Title"
3
3
  = f.text_field :location
4
4
 
5
5
  - if f.object.persisted? || f.object.errors.include?(:slug)
@@ -11,20 +11,22 @@
11
11
  .row
12
12
  .col-lg-6
13
13
  = f.date_field :start_on, label: "Start",
14
- hint: 'The classified ad will be displayed starting after this date.',
14
+ hint: 'The posting will be displayed starting after this date.',
15
15
  input_js: { minDate: minDate.strftime('%F') }
16
16
 
17
17
  .col-lg-6
18
18
  = f.date_field :end_on, label: "Expire",
19
- hint: 'The classified ad will no longer be displayed after this date.'
19
+ hint: 'The posting will no longer be displayed after this date.'
20
20
 
21
21
  - if f.object.persisted? && !f.object.draft?
22
- = f.check_box :archived, label: 'Yes, this classified is archived and will not be displayed'
22
+ = f.check_box :archived, label: 'Yes, this posting is archived. It will not be displayed.'
23
23
 
24
24
  - if defined?(EffectiveArticleEditor)
25
- = f.article_editor :body, label: 'Body content', hint: 'The main body content of your classified ad. Be sure to include all relevant information!'
25
+ = f.article_editor :body, label: 'Description', hint: 'The content of your posting. Be sure to include all relevant information!'
26
26
  - else
27
- = f.rich_text_area :body, label: 'Body content', hint: 'The main body content of your classified ad. Be sure to include all relevant information!'
27
+ = f.rich_text_area :body, label: 'Description', hint: 'The content of your posting. Be sure to include all relevant information!'
28
+
29
+ = f.file_field :file, label: 'Attach PDF'
28
30
 
29
31
  %h2.mt-5.mb-0 Contact Information
30
32
  %p
@@ -0,0 +1,2 @@
1
+ .effective-classifieds
2
+ = yield
@@ -0,0 +1,49 @@
1
+ %table.table.effective-classified-table
2
+ %tbody
3
+ %tr
4
+ %th Category
5
+ %td= classified.category
6
+
7
+ %tr
8
+ %th Title
9
+ %td= classified.title
10
+
11
+ %tr
12
+ %th Available
13
+ %td
14
+ #{classified.start_on&.strftime('%F')}
15
+ to
16
+ #{classified.end_on&.strftime('%F')}
17
+
18
+ - if classified.location.present?
19
+ %tr
20
+ %th Location
21
+ %td= classified.location
22
+
23
+ %tr
24
+ %th Description
25
+ %td= classified.body.to_s
26
+
27
+ - if classified.file.attached?
28
+ %tr
29
+ %th Attachment
30
+ %td= link_to(classified.file.filename, main_app.url_for(classified.file), target: '_blank')
31
+
32
+ %tr
33
+ %th Company
34
+ %td= classified.organization
35
+
36
+ - if classified.website.present?
37
+ %tr
38
+ %th Website
39
+ %td= link_to(classified.website, classified.website, target: '_blank')
40
+
41
+ - if classified.email.present?
42
+ %tr
43
+ %th Email
44
+ %td= mail_to(classified.email)
45
+
46
+ - if classified.phone.present?
47
+ %tr
48
+ %th Phone
49
+ %td= classified.phone
@@ -1,8 +1,9 @@
1
- .resource-buttons
2
- = link_to 'Submit New Classified Ad', effective_classifieds.new_classified_wizard_path, class: 'btn btn-primary'
1
+ = render 'layout' do
2
+ .resource-buttons
3
+ = link_to "Submit New #{EffectiveClassifieds.classifieds_label} Posting", effective_classifieds.new_classified_wizard_path, class: 'btn btn-primary'
3
4
 
4
- = card do
5
- - if @datatable.present?(self)
6
- = render_datatable(@datatable, simple: true)
7
- - else
8
- %p There are no active classified ads. When there are, we'll show them here.
5
+ = card do
6
+ - if @datatable.present?(self)
7
+ = render_datatable(@datatable, simple: true)
8
+ - else
9
+ %p There are no active postings. When there are, we'll show them here.
@@ -1,8 +1,8 @@
1
1
  .effective-classified
2
2
  - unless @classified.published?
3
- .alert.alert-warning.mb-4 This classified is currently unavailable.
3
+ .alert.alert-warning.mb-4 This posting is currently unavailable.
4
4
 
5
5
  = render 'effective/classifieds/classified', classified: @classified
6
6
 
7
7
  .resource-buttons.text-left
8
- = link_to 'View All Classifieds', effective_classifieds.classifieds_path, class: 'btn btn-primary'
8
+ = link_to 'View All', effective_classifieds.classifieds_path, class: 'btn btn-primary'
@@ -1,9 +1,9 @@
1
1
  %p Hello Admin!
2
2
 
3
3
  - if @classified.published?
4
- %p The following classified ad has been submitted and is published online:
4
+ %p The following posting has been submitted and is published online:
5
5
  - else
6
- %p The following classified ad has been submitted and is awaiting your approval:
6
+ %p The following posting has been submitted and is awaiting your approval:
7
7
 
8
8
  %hr
9
9
 
@@ -13,8 +13,8 @@
13
13
  %hr
14
14
 
15
15
  - unless @classified.approved?
16
- %p= link_to('Approve Classified Ad', effective_classifieds.edit_admin_classified_path(@classified))
16
+ %p= link_to('Approve Posting', effective_classifieds.edit_admin_classified_path(@classified))
17
17
 
18
- %p= link_to('View Classified Ad', effective_classifieds.classified_path(@classified))
18
+ %p= link_to('View Posting', effective_classifieds.classified_path(@classified))
19
19
 
20
20
  %p Have a great day!
@@ -12,6 +12,9 @@ EffectiveClassifieds.setup do |config|
12
12
  # Classified Settings
13
13
  # config.classified_wizard_class_name = 'Effective::ClassifiedWizard'
14
14
 
15
+ # Page title like Classifieds or Job Board
16
+ config.classifieds_label = 'Classifieds'
17
+
15
18
  # Pagination length on the Classified#index page
16
19
  config.per_page = :all
17
20
 
@@ -30,6 +30,12 @@ class CreateEffectiveClassifieds < ActiveRecord::Migration[6.1]
30
30
 
31
31
  t.boolean :archived, default: false
32
32
 
33
+ # Acts as purchasable
34
+ t.integer :purchased_order_id
35
+ t.integer :price
36
+ t.boolean :tax_exempt, default: false
37
+ t.string :qb_item_name
38
+
33
39
  t.timestamps
34
40
  end
35
41
 
@@ -52,6 +58,9 @@ class CreateEffectiveClassifieds < ActiveRecord::Migration[6.1]
52
58
  # Dates
53
59
  t.datetime :submitted_at
54
60
 
61
+ # Pricing
62
+ t.string :price_category
63
+
55
64
  t.datetime :updated_at
56
65
  t.datetime :created_at
57
66
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveClassifieds
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.4.1'.freeze
3
3
  end
@@ -10,7 +10,7 @@ module EffectiveClassifieds
10
10
  :classifieds_table_name, :classified_wizards_table_name,
11
11
  :mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject,
12
12
  :layout, :categories, :per_page, :use_effective_roles, :max_duration, :auto_approve,
13
- :classified_wizard_class_name
13
+ :classified_wizard_class_name, :classifieds_label
14
14
  ]
15
15
  end
16
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_classifieds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
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-08-24 00:00:00.000000000 Z
11
+ date: 2022-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: effective_orders
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: effective_resources
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -195,12 +209,16 @@ files:
195
209
  - app/views/admin/classifieds/_form.html.haml
196
210
  - app/views/admin/classifieds/_form_access.html.haml
197
211
  - app/views/admin/classifieds/_form_classified.html.haml
212
+ - app/views/effective/classified_wizards/_additional_fields.html.haml
198
213
  - app/views/effective/classified_wizards/_classified.html.haml
199
214
  - app/views/effective/classified_wizards/_classified_wizard.html.haml
200
215
  - app/views/effective/classified_wizards/_content.html.haml
201
216
  - app/views/effective/classified_wizards/_dashboard.html.haml
202
217
  - app/views/effective/classified_wizards/_layout.html.haml
218
+ - app/views/effective/classified_wizards/_orders.html.haml
203
219
  - app/views/effective/classified_wizards/_summary.html.haml
220
+ - app/views/effective/classified_wizards/billing.html.haml
221
+ - app/views/effective/classified_wizards/checkout.html.haml
204
222
  - app/views/effective/classified_wizards/classified.html.haml
205
223
  - app/views/effective/classified_wizards/start.html.haml
206
224
  - app/views/effective/classified_wizards/submitted.html.haml
@@ -209,6 +227,8 @@ files:
209
227
  - app/views/effective/classifieds/_dashboard.html.haml
210
228
  - app/views/effective/classifieds/_fields.html.haml
211
229
  - app/views/effective/classifieds/_form.html.haml
230
+ - app/views/effective/classifieds/_layout.html.haml
231
+ - app/views/effective/classifieds/_summary.html.haml
212
232
  - app/views/effective/classifieds/edit.html.haml
213
233
  - app/views/effective/classifieds/index.html.haml
214
234
  - app/views/effective/classifieds/show.html.haml
@@ -242,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
262
  - !ruby/object:Gem::Version
243
263
  version: '0'
244
264
  requirements: []
245
- rubygems_version: 3.1.2
265
+ rubygems_version: 3.3.7
246
266
  signing_key:
247
267
  specification_version: 4
248
268
  summary: Users submit classified ads for job openings and equipment sales