effective_classifieds 0.4.3 → 0.4.5

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
  SHA256:
3
- metadata.gz: c468d322f47a4191356c1f7bfa55c598ef3ddcb0a1770083ef53e62745d7e8c1
4
- data.tar.gz: d178bba98e606daae6faed532924a109dcd431b58edbed8817e759fc02bc7632
3
+ metadata.gz: f08a97cd9079f6baa93e5fc992db40dbeb951cbfe067614a06996770ef83d49c
4
+ data.tar.gz: 1ec2f2ca6b22fa02e6bf2ab43f008a886cd414f5b146a299278b04b57f6220b0
5
5
  SHA512:
6
- metadata.gz: 07decbc51f2546fd0e15a2e3ab64c94ce38916fb9b55999a9f38e0709eba936aad535bfdda894db24b2331bda3d84ac3e8d5d7f7698abccafcfa390be7b5b742
7
- data.tar.gz: 14e1a65cfa4322c509f6364d3adc047d3f86ae52a99005d47c31b924dc704d98cdd54041120be9449f96cb9c76dbb00cb5b521f590bcba00af42d6e4ad41983d
6
+ metadata.gz: 211355aecad1c8ce668aa4caed147d0304f695baeb531dc3951046bdf82c7027349671ff8032f364366e6a067506d82c86c24da7209a3d43a03d4726cb8c29b1
7
+ data.tar.gz: 8dd8f720c87fd1d5b17c56f700bb38c18bb0552bba6cf30195c6a5881f499e03b95a379b92a2d95e9fcee1da529919d48690fc0f68d1d7a62ef2bfad42358e40
@@ -5,6 +5,9 @@ module Admin
5
5
 
6
6
  include Effective::CrudController
7
7
 
8
+ page_title(only: :index) { EffectiveClassifieds.classifieds_label }
9
+ page_title(only: :new) { "New #{EffectiveClassifieds.classifieds_label} Posting" }
10
+
8
11
  submit :save, 'Save'
9
12
  submit :save, 'Save and View', redirect: -> { effective_classifieds.classified_path(resource) }
10
13
  submit :approve, 'Approve'
@@ -8,6 +8,7 @@ module Admin
8
8
  scope :approved
9
9
  end
10
10
 
11
+ scope :draft
11
12
  scope :published
12
13
  end
13
14
 
@@ -39,11 +40,10 @@ module Admin
39
40
  col :email
40
41
  col :phone
41
42
 
43
+ col :status
42
44
  col :archived
43
45
 
44
- unless EffectiveClassifieds.auto_approve
45
- col :status, search: ['submitted', 'approved']
46
- end
46
+ col :status
47
47
 
48
48
  col :purchased_order, visible: false
49
49
 
@@ -53,7 +53,7 @@ module Admin
53
53
  end
54
54
 
55
55
  collection do
56
- Effective::Classified.all.where.not(status: :draft)
56
+ Effective::Classified.all
57
57
  end
58
58
 
59
59
  def categories
@@ -5,6 +5,7 @@ module Effective
5
5
  self.table_name = EffectiveClassifieds.classifieds_table_name.to_s
6
6
 
7
7
  attr_accessor :current_user
8
+ attr_accessor :importing
8
9
 
9
10
  acts_as_slugged
10
11
  acts_as_purchasable
@@ -118,11 +119,13 @@ module Effective
118
119
 
119
120
  validates :start_on, presence: true
120
121
  validates :end_on, presence: true
121
- validates :location, presence: true
122
122
 
123
- validates :organization, presence: true
124
- validates :email, presence: true
125
- validates :phone, presence: true
123
+ with_options(unless: -> { importing }) do
124
+ validates :location, presence: true
125
+ validates :organization, presence: true
126
+ validates :email, presence: true
127
+ validates :phone, presence: true
128
+ end
126
129
 
127
130
  validate(if: -> { start_on.present? && end_on.present? }) do
128
131
  self.errors.add(:end_on, 'must be after start date') if end_on < start_on
@@ -147,6 +150,10 @@ module Effective
147
150
  title.presence || 'New Classified'
148
151
  end
149
152
 
153
+ def purchasable_name
154
+ "Posting - #{to_s}"
155
+ end
156
+
150
157
  def published?
151
158
  return false unless approved?
152
159
  return false if archived?
@@ -10,13 +10,13 @@
10
10
 
11
11
  .row
12
12
  .col-lg-6
13
- = f.date_field :start_on, label: "Start",
14
- hint: 'The posting will be displayed starting after this date.',
15
- input_js: { minDate: minDate.strftime('%F') }
13
+ - if f.object.new_record?
14
+ = f.date_field :start_on, label: "Start", hint: 'The posting will be displayed starting after this date.', input_js: { minDate: minDate.strftime('%F') }
15
+ - else
16
+ = f.date_field :start_on, label: "Start", hint: 'The posting will be displayed starting after this date.'
16
17
 
17
18
  .col-lg-6
18
- = f.date_field :end_on, label: "Expire",
19
- hint: 'The posting will no longer be displayed after this date.'
19
+ = f.date_field :end_on, label: "Expire", hint: 'The posting will no longer be displayed after this date.'
20
20
 
21
21
  - if f.object.persisted? && !f.object.draft?
22
22
  = f.check_box :archived, label: 'Yes, this posting is archived. It will not be displayed.'
@@ -1,3 +1,3 @@
1
1
  module EffectiveClassifieds
2
- VERSION = '0.4.3'.freeze
2
+ VERSION = '0.4.5'.freeze
3
3
  end
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.4.3
4
+ version: 0.4.5
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-11-02 00:00:00.000000000 Z
11
+ date: 2022-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails