effective_classifieds 0.5.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/effective/classifieds_controller.rb +7 -1
- data/app/datatables/admin/effective_classifieds_datatable.rb +4 -3
- data/app/models/effective/classified.rb +2 -1
- data/app/models/effective/classified_wizard.rb +1 -1
- data/app/views/effective/classifieds/_classified.html.haml +8 -51
- data/app/views/effective/classifieds/_fields.html.haml +7 -6
- data/app/views/effective/classifieds/index.html.haml +17 -5
- data/app/views/effective/classifieds/show.html.haml +41 -45
- data/config/effective_classifieds.rb +1 -4
- data/db/migrate/{01_create_effective_classifieds.rb.erb → 101_create_effective_classifieds.rb} +8 -7
- data/lib/effective_classifieds/version.rb +1 -1
- data/lib/generators/effective_classifieds/install_generator.rb +1 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aec287b86538a846f94eac97ae954c12dfbb40bb3f3d80ee9af2b0f2f890c018
|
4
|
+
data.tar.gz: d2c22f4f4df5e5ea9c1262b7a9b5b2d5fd66424d09c1c5e9f50ed7ac71292584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8d6202d90d61f56ae7ae6dcb8076b595768c9c48431b966fe8a865b9a322f51dcc028f4efbd3b3d5646b201f353bcba7b2e472a311235530e7a49c540e5c755
|
7
|
+
data.tar.gz: 396ed75c112d6ce31564005a65c989ce6f1332c84372a9ac440ffdad9bba7add8186f1d6d0b334f6b504be87b5b621483345bda58f8fcd7040be5dd921f3a2fa
|
@@ -2,7 +2,13 @@ module Effective
|
|
2
2
|
class ClassifiedsController < ApplicationController
|
3
3
|
include Effective::CrudController
|
4
4
|
|
5
|
-
|
5
|
+
def index
|
6
|
+
EffectiveResources.authorize!(self, :index, ::Effective::Classified)
|
7
|
+
|
8
|
+
@page_title ||= view_context.classifieds_name_label
|
9
|
+
|
10
|
+
@classifieds = ::Effective::Classified.classifieds(user: current_user).sorted
|
11
|
+
end
|
6
12
|
|
7
13
|
def show
|
8
14
|
@classified = resource_scope.find(params[:id])
|
@@ -37,9 +37,10 @@ module Admin
|
|
37
37
|
col :organization
|
38
38
|
col :location
|
39
39
|
|
40
|
-
col :website
|
41
|
-
col :
|
42
|
-
col :
|
40
|
+
col :website, visible: false
|
41
|
+
col :contact_name, visible: false
|
42
|
+
col :email, visible: false
|
43
|
+
col :phone, visible: false
|
43
44
|
|
44
45
|
col :status
|
45
46
|
col :archived
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Effective
|
4
4
|
class Classified < ActiveRecord::Base
|
5
|
-
self.table_name = EffectiveClassifieds.classifieds_table_name.to_s
|
5
|
+
self.table_name = (EffectiveClassifieds.classifieds_table_name || :classifieds).to_s
|
6
6
|
|
7
7
|
attr_accessor :current_user
|
8
8
|
attr_accessor :importing
|
@@ -125,6 +125,7 @@ module Effective
|
|
125
125
|
validates :organization, presence: true
|
126
126
|
validates :email, presence: true
|
127
127
|
validates :phone, presence: true
|
128
|
+
validates :contact_name, presence: true
|
128
129
|
end
|
129
130
|
|
130
131
|
validate(if: -> { start_on.present? && end_on.present? && !importing }) do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Effective
|
2
2
|
class ClassifiedWizard < ActiveRecord::Base
|
3
|
-
self.table_name = EffectiveClassifieds.classified_wizards_table_name.to_s
|
3
|
+
self.table_name = (EffectiveClassifieds.classified_wizards_table_name || :classified_wizards).to_s
|
4
4
|
|
5
5
|
effective_classifieds_classified_wizard
|
6
6
|
end
|
@@ -1,51 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
%
|
4
|
-
%
|
5
|
-
%
|
6
|
-
|
7
|
-
|
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.location.present?
|
21
|
-
%tr
|
22
|
-
%th Location
|
23
|
-
%td= classified.location
|
24
|
-
|
25
|
-
%tr
|
26
|
-
%th Description
|
27
|
-
%td= classified.body.to_s
|
28
|
-
|
29
|
-
- if classified.file.attached?
|
30
|
-
%tr
|
31
|
-
%th Attachment
|
32
|
-
%td= link_to(classified.file.filename, main_app.url_for(classified.file), target: '_blank')
|
33
|
-
|
34
|
-
%tr
|
35
|
-
%th Company
|
36
|
-
%td= classified.organization
|
37
|
-
|
38
|
-
- if classified.website.present?
|
39
|
-
%tr
|
40
|
-
%th Website
|
41
|
-
%td= link_to(classified.website, classified.website, target: '_blank')
|
42
|
-
|
43
|
-
- if classified.email.present?
|
44
|
-
%tr
|
45
|
-
%th Email
|
46
|
-
%td= mail_to(classified.email)
|
47
|
-
|
48
|
-
- if classified.phone.present?
|
49
|
-
%tr
|
50
|
-
%th Phone
|
51
|
-
%td= classified.phone
|
1
|
+
%tr
|
2
|
+
%td.col-date= classified.start_on&.strftime("%b %d, %Y")
|
3
|
+
%td.col-date.d-none.d-md-table-cell= classified.end_on&.strftime("%b %d, %Y")
|
4
|
+
%td
|
5
|
+
%strong= link_to classified.title, effective_classifieds.classified_path(classified)
|
6
|
+
.text-muted= classified.organization
|
7
|
+
|
8
|
+
%td.d-none.d-md-table-cell= classified.location
|
@@ -1,5 +1,6 @@
|
|
1
|
-
= f.select :category, EffectiveClassifieds.categories, required: true
|
1
|
+
= f.select :category, EffectiveClassifieds.categories, required: true, include_blank: false
|
2
2
|
= f.text_field :title
|
3
|
+
= f.text_field :organization, hint: 'Organization or company name'
|
3
4
|
= f.text_field :location
|
4
5
|
|
5
6
|
- if f.object.persisted? || f.object.errors.include?(:slug)
|
@@ -22,17 +23,17 @@
|
|
22
23
|
= f.check_box :archived, label: 'Yes, this posting is archived. It will not be displayed.'
|
23
24
|
|
24
25
|
- if defined?(EffectiveArticleEditor)
|
25
|
-
= f.article_editor :body, label: 'Description', hint: 'The content of your posting. Be sure to include all relevant information
|
26
|
+
= f.article_editor :body, label: 'Description', hint: 'The content of your posting. Be sure to include all relevant information.'
|
26
27
|
- else
|
27
|
-
= f.rich_text_area :body, label: 'Description', hint: 'The content of your posting. Be sure to include all relevant information
|
28
|
+
= f.rich_text_area :body, label: 'Description', hint: 'The content of your posting. Be sure to include all relevant information.'
|
28
29
|
|
29
|
-
= f.file_field :file, hint: '
|
30
|
+
= f.file_field :file, hint: 'Optionally attach a PDF for this posting'
|
30
31
|
|
31
32
|
%h2.mt-5.mb-0 Contact Information
|
32
33
|
%p
|
33
|
-
%small.text-muted
|
34
|
+
%small.text-muted The following contact information is not displayed to the public and is only used by staff to provide support.
|
34
35
|
|
35
|
-
= f.text_field :
|
36
|
+
= f.text_field :contact_name
|
36
37
|
= f.url_field :website
|
37
38
|
= f.email_field :email
|
38
39
|
= f.tel_field :phone
|
@@ -2,8 +2,20 @@
|
|
2
2
|
.resource-buttons
|
3
3
|
= link_to "Submit New #{et(Effective::Classified)}", effective_classifieds.new_classified_wizard_path, class: 'btn btn-primary'
|
4
4
|
|
5
|
-
|
6
|
-
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
- if @classifieds.present?
|
6
|
+
.table-responsive
|
7
|
+
%table.table.table-striped.table-hover
|
8
|
+
%tr
|
9
|
+
%th.col-date Published
|
10
|
+
%th.col-date.d-none.d-md-table-cell Closing
|
11
|
+
%th Title
|
12
|
+
%th.d-none.d-md-table-cell Location
|
13
|
+
|
14
|
+
= render @classifieds
|
15
|
+
|
16
|
+
.resource-buttons
|
17
|
+
= link_to "Submit New #{et(Effective::Classified)}", effective_classifieds.new_classified_wizard_path, class: 'btn btn-primary'
|
18
|
+
|
19
|
+
- else
|
20
|
+
= card class: 'mt-5' do
|
21
|
+
%p.text-center There are no active #{etsd(Effective::Classified)}. When there are, we'll show them here.
|
@@ -3,48 +3,44 @@
|
|
3
3
|
- unless @classified.published?
|
4
4
|
.alert.alert-warning.mb-4 This #{etd(@classified)} is not published.
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
-
|
14
|
-
%
|
15
|
-
%
|
16
|
-
= @classified.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
= @classified.phone
|
48
|
-
|
49
|
-
.col-md-8
|
50
|
-
= @classified.body.to_s
|
6
|
+
|
7
|
+
.resource-buttons
|
8
|
+
= link_to "Return to #{classifieds_name_label}", effective_classifieds.classifieds_path, class: 'btn btn-secondary'
|
9
|
+
|
10
|
+
= card do
|
11
|
+
.row
|
12
|
+
.col-md
|
13
|
+
%table.table.table-striped.table-hover.effective-table-summary
|
14
|
+
%tr
|
15
|
+
%th Position
|
16
|
+
%td= @classified.title
|
17
|
+
|
18
|
+
%tr
|
19
|
+
%th Company
|
20
|
+
%td= @classified.organization
|
21
|
+
|
22
|
+
- if @classified.location.present?
|
23
|
+
%tr
|
24
|
+
%th Location
|
25
|
+
%td= @classified.location
|
26
|
+
|
27
|
+
.col-md
|
28
|
+
%table.table.table-striped.table-hover.effective-table-summary
|
29
|
+
%tr
|
30
|
+
%th Published
|
31
|
+
%td #{@classified.start_on&.strftime("%b %d, %Y")}
|
32
|
+
|
33
|
+
%tr
|
34
|
+
%th Closing
|
35
|
+
%td #{@classified.end_on&.strftime("%b %d, %Y")}
|
36
|
+
|
37
|
+
- if @classified.file.attached?
|
38
|
+
%tr
|
39
|
+
%th Attachment
|
40
|
+
%td= link_to(@classified.file.filename, main_app.url_for(@classified.file), target: '_blank')
|
41
|
+
|
42
|
+
.body.mt-4
|
43
|
+
= @classified.body.to_s
|
44
|
+
|
45
|
+
.resource-buttons.mt-5.mb-4
|
46
|
+
= link_to "Return to #{classifieds_name_label}", effective_classifieds.classifieds_path, class: 'btn btn-secondary'
|
@@ -1,7 +1,4 @@
|
|
1
1
|
EffectiveClassifieds.setup do |config|
|
2
|
-
config.classifieds_table_name = :classifieds
|
3
|
-
config.classified_wizards_table_name = :classified_wizards
|
4
|
-
|
5
2
|
# Every classified must have a category.
|
6
3
|
config.categories = ['Job', 'Equipment Sales', 'Other']
|
7
4
|
|
@@ -13,7 +10,7 @@ EffectiveClassifieds.setup do |config|
|
|
13
10
|
# config.classified_wizard_class_name = 'Effective::ClassifiedWizard'
|
14
11
|
|
15
12
|
# Pagination length on the Classified#index page
|
16
|
-
config.per_page =
|
13
|
+
config.per_page = 12
|
17
14
|
|
18
15
|
# Classified can be restricted by role
|
19
16
|
config.use_effective_roles = true
|
data/db/migrate/{01_create_effective_classifieds.rb.erb → 101_create_effective_classifieds.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
class CreateEffectiveClassifieds < ActiveRecord::Migration[6.
|
1
|
+
class CreateEffectiveClassifieds < ActiveRecord::Migration[6.0]
|
2
2
|
def change
|
3
|
-
create_table
|
3
|
+
create_table :classifieds do |t|
|
4
4
|
t.integer :classified_wizard_id
|
5
5
|
t.string :classified_wizard_type
|
6
6
|
|
@@ -14,6 +14,7 @@ class CreateEffectiveClassifieds < ActiveRecord::Migration[6.1]
|
|
14
14
|
t.string :location
|
15
15
|
|
16
16
|
t.string :website
|
17
|
+
t.string :contact_name
|
17
18
|
t.string :email
|
18
19
|
t.string :phone
|
19
20
|
|
@@ -39,10 +40,10 @@ class CreateEffectiveClassifieds < ActiveRecord::Migration[6.1]
|
|
39
40
|
t.timestamps
|
40
41
|
end
|
41
42
|
|
42
|
-
add_index
|
43
|
-
add_index
|
43
|
+
add_index :classifieds, [:owner_id, :owner_type]
|
44
|
+
add_index :classifieds, :slug
|
44
45
|
|
45
|
-
create_table
|
46
|
+
create_table :classified_wizards do |t|
|
46
47
|
t.string :token
|
47
48
|
|
48
49
|
t.integer :owner_id
|
@@ -65,7 +66,7 @@ class CreateEffectiveClassifieds < ActiveRecord::Migration[6.1]
|
|
65
66
|
t.datetime :created_at
|
66
67
|
end
|
67
68
|
|
68
|
-
add_index
|
69
|
-
add_index
|
69
|
+
add_index :classified_wizards, [:owner_id, :owner_type]
|
70
|
+
add_index :classified_wizards, :token
|
70
71
|
end
|
71
72
|
end
|
@@ -20,10 +20,7 @@ module EffectiveMemberships
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def create_migration_file
|
23
|
-
|
24
|
-
@classified_wizards_table_name = ':' + EffectiveClassifieds.classified_wizards_table_name.to_s
|
25
|
-
|
26
|
-
migration_template ('../' * 3) + 'db/migrate/01_create_effective_classifieds.rb.erb', 'db/migrate/create_effective_classifieds.rb'
|
23
|
+
migration_template ('../' * 3) + 'db/migrate/101_create_effective_classifieds.rb', 'db/migrate/create_effective_classifieds.rb'
|
27
24
|
end
|
28
25
|
|
29
26
|
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
|
+
version: 0.6.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: 2023-08-
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -250,7 +250,7 @@ files:
|
|
250
250
|
- config/effective_classifieds.rb
|
251
251
|
- config/locales/effective_classifieds.en.yml
|
252
252
|
- config/routes.rb
|
253
|
-
- db/migrate/
|
253
|
+
- db/migrate/101_create_effective_classifieds.rb
|
254
254
|
- db/seeds.rb
|
255
255
|
- lib/effective_classifieds.rb
|
256
256
|
- lib/effective_classifieds/engine.rb
|