effective_classifieds 0.6.6 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 297af439da45de0c6884b20e1eae1ab6840a88487c81501783deae61dcaa7c83
4
- data.tar.gz: b56b713ddfd6688807492661448bcca2afd6397b41dff3a52584cda4705d3065
3
+ metadata.gz: e96a880538ec95e1745ec13e6ac7520f9de680e824068182247bde290794b6e4
4
+ data.tar.gz: 18b832496e4a994383c2dced4291c60b7563b4f772b00dbb401e1a9a2f97e673
5
5
  SHA512:
6
- metadata.gz: 5ef6644f2ed49177c7c1ed8b9f91c5e7e19fe1ae98c9fdad51e0139fba2cbe2e235b9b5f6633827fef22c089ef62339115c634f6ea558551b655cf5f128465fa
7
- data.tar.gz: 2047fc9dcd098292c4516692c35ea11ad6bd89039fb5ebc55222ebe92476e066324e692b525faab02203bfb4a41911995691fc3b14fab8a82360fef515145774
6
+ metadata.gz: cff4f5bd000f79a03f1342f0e030ca4459a5ed825d512e014547d8aa4cd8744f5aa577bca1c4ba430fa57795017db9d2f20469118e57ab8fd3141e2439f1a5ec
7
+ data.tar.gz: 0ba27c2ed0d734c3bedf9e034c0f43e63c2f9d5619c071878e158b52510fd8079969ddcb0e3675cb1623ba6e698e48d10d2ce2b86efd6c0c2929df7718594ce5
@@ -37,7 +37,6 @@ module Effective
37
37
  render(json: @classified.for_json.merge(url: url).to_json)
38
38
  }
39
39
  end
40
-
41
40
  end
42
41
 
43
42
  private
@@ -46,6 +46,7 @@ module Admin
46
46
  col :archived
47
47
 
48
48
  col :status
49
+ col :tracks_count, label: 'Views'
49
50
 
50
51
  col :purchased_order, visible: false
51
52
 
@@ -12,6 +12,10 @@ class EffectiveClassifiedWizardsDatatable < Effective::Datatable
12
12
 
13
13
  col :classifieds, search: :string, label: 'Title'
14
14
 
15
+ col :tracks_count, label: 'Views' do |wizard|
16
+ wizard.classified&.tracks_count
17
+ end
18
+
15
19
  col :owner, visible: false, search: :string
16
20
 
17
21
  col :status, visible: false do |wizard|
@@ -10,6 +10,7 @@ module Effective
10
10
  acts_as_slugged
11
11
  acts_as_purchasable
12
12
  log_changes if respond_to?(:log_changes)
13
+ acts_as_trackable if respond_to?(:acts_as_trackable)
13
14
  acts_as_role_restricted if respond_to?(:acts_as_role_restricted)
14
15
 
15
16
  # This will be the owner of the classified ad submission
@@ -135,10 +136,14 @@ module Effective
135
136
  self.errors.add(:end_on, 'must be after start date') if end_on < start_on
136
137
  end
137
138
 
139
+ def end_on_distance
140
+ date = Time.zone.now
141
+ ApplicationController.helpers.distance_of_time_in_words(date + EffectiveClassifieds.max_duration, date).gsub('about', '').strip
142
+ end
143
+
138
144
  validate(if: -> { start_on.present? && end_on.present? && EffectiveClassifieds.max_duration.present? && !importing }) do
139
145
  if (end_on - start_on) > EffectiveClassifieds.max_duration
140
- distance = ApplicationController.helpers.distance_of_time_in_words(end_on + EffectiveClassifieds.max_duration, end_on).gsub('about', '').strip
141
- self.errors.add(:end_on, "must be within #{distance} of start date")
146
+ self.errors.add(:end_on, "must be within #{end_on_distance} of start date")
142
147
  end
143
148
  end
144
149
 
@@ -13,6 +13,11 @@
13
13
  - datatable = Admin::EffectiveOrdersDatatable.new(parent: classified.classified_wizard, owner: classified.owner, user: classified.owner, total: false)
14
14
  = render_datatable(datatable, simple: true)
15
15
 
16
+ - if classified.class.respond_to?(:acts_as_trackable?)
17
+ = tab 'Tracks' do
18
+ - datatable = Admin::EffectiveTracksDatatable.new(owner: classified)
19
+ = render_datatable(datatable, inline: true, namespace: :admin)
20
+
16
21
  - if classified.respond_to?(:log_changes_datatable)
17
22
  = tab 'Logs' do
18
23
  = render_inline_datatable(classified.log_changes_datatable)
@@ -17,7 +17,7 @@
17
17
  = f.date_field :start_on, label: "Start", hint: 'The posting will be displayed starting after this date.'
18
18
 
19
19
  .col-lg-6
20
- = f.date_field :end_on, label: "Expire", hint: 'The posting will no longer be displayed after this date.'
20
+ = f.date_field :end_on, label: "Expire", hint: "The posting will no longer be displayed after this date. Please enter a date within #{f.object.end_on_distance} of start date"
21
21
 
22
22
  - if f.object.persisted? && !f.object.draft?
23
23
  = f.check_box :archived, label: 'Yes, this posting is archived. It will not be displayed.'
@@ -22,7 +22,7 @@ EffectiveClassifieds.setup do |config|
22
22
  config.auto_approve = false
23
23
 
24
24
  # Can checkout with phone or cheque 'deferred' payment providers
25
- config.skip_deferred = false
25
+ config.skip_deferred = true
26
26
 
27
27
  # Mailer Settings
28
28
  # Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
@@ -37,6 +37,9 @@ class CreateEffectiveClassifieds < ActiveRecord::Migration[6.0]
37
37
  t.boolean :tax_exempt, default: false
38
38
  t.string :qb_item_name
39
39
 
40
+ # Acts as trackable
41
+ t.integer :tracks_count, default: 0
42
+
40
43
  t.timestamps
41
44
  end
42
45
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveClassifieds
2
- VERSION = '0.6.6'.freeze
2
+ VERSION = '0.7.0'.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.6.6
4
+ version: 0.7.0
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: 2024-01-22 00:00:00.000000000 Z
11
+ date: 2024-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: effective_email_templates
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: effective_test_bot
155
169
  requirement: !ruby/object:Gem::Requirement