effective_classifieds 0.6.0 → 0.6.1

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: 79336bbb620e6d45dee7ef30b76c3e8d6af610355c5839e6995edc190eeead60
4
- data.tar.gz: f679373fb3056d855711d9e6668e68e06cb434f1804ca7f0052e8d86aeb5f82d
3
+ metadata.gz: aec287b86538a846f94eac97ae954c12dfbb40bb3f3d80ee9af2b0f2f890c018
4
+ data.tar.gz: d2c22f4f4df5e5ea9c1262b7a9b5b2d5fd66424d09c1c5e9f50ed7ac71292584
5
5
  SHA512:
6
- metadata.gz: 0e4add172e382d41b1f78407971a33170afd46e138c71913210e51508beddc9b7588714cd411aa9e2e7827abf31245a377cdf8d40c725317756ba0efb3fc9138
7
- data.tar.gz: 50009a6e425035cc59e58abbcf32ce6d70e73eb19a9c7be131e5c50de1ca6bd14ee37729c288709279d7492a71dc506e68ce132c430db205f36c65e15d22a228
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
- page_title(only: :index) { view_context.classifieds_name_label }
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 :email
42
- col :phone
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
@@ -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,51 +1,8 @@
1
- -# TODO turn this into a partial that is rendered on index
2
-
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.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: 'Please attach a PDF'
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 Contact information will be displayed on the #{classifieds_name_label} ad.
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 :organization, hint: 'Organization or company name'
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
- = card do
6
- - if @datatable.present?(self)
7
- = render_datatable(@datatable, simple: true)
8
- - else
9
- %p There are no active #{etsd(Effective::Classified)}. When there are, we'll show them here.
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
- .row
7
- .col-md-4
8
- %ul.list-unstyled
9
- %li
10
- %strong Company
11
- = @classified.organization
12
-
13
- - if @classified.location.present?
14
- %li
15
- %strong Location
16
- = @classified.location
17
-
18
- %li
19
- %strong Published
20
- #{@classified.start_on&.strftime("%b %d, %Y")}
21
-
22
- %li
23
- %strong Closing
24
- #{@classified.end_on&.strftime("%b %d, %Y")}
25
-
26
-
27
- - if @classified.file.attached?
28
- %li
29
- %strong Attachment
30
- = link_to(@classified.file.filename, main_app.url_for(@classified.file), target: '_blank')
31
-
32
-
33
- %ul.list-unstyled
34
- - if @classified.website.present?
35
- %li
36
- %strong Website
37
- = link_to(@classified.website, @classified.website, target: '_blank')
38
-
39
- - if @classified.email.present?
40
- %li
41
- %strong Email
42
- = mail_to(@classified.email)
43
-
44
- - if @classified.phone.present?
45
- %li
46
- %strong Phone
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'
@@ -10,7 +10,7 @@ EffectiveClassifieds.setup do |config|
10
10
  # config.classified_wizard_class_name = 'Effective::ClassifiedWizard'
11
11
 
12
12
  # Pagination length on the Classified#index page
13
- config.per_page = :all
13
+ config.per_page = 12
14
14
 
15
15
  # Classified can be restricted by role
16
16
  config.use_effective_roles = true
@@ -14,6 +14,7 @@ class CreateEffectiveClassifieds < ActiveRecord::Migration[6.0]
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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveClassifieds
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.6.1'.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.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-24 00:00:00.000000000 Z
11
+ date: 2023-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails