effective_posts 0.6.4 → 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: f2cd2dff889cc85033be8e660ba9e5f6296f18334701d6da2c512de3271a7125
4
- data.tar.gz: 91610327601b259b5c5b96472380b93b9ef42ee84d30030cde4edcd329e03b13
3
+ metadata.gz: 5105b8f4cd7c534450c0e096d48411dae0376e38cc9a18ddd2c15a2a672ee2ab
4
+ data.tar.gz: e84688eb0d998f84a99bd04694999893326a15973f17f3bf8e75f2ca6b96ad07
5
5
  SHA512:
6
- metadata.gz: 8b2579f990e55413dab83e8de5cbdeb920c7ff95beef6021c9b490974594ca02713b5744bee52ce6b2542335eb71c23695a6ea9ef8c72801ac551aa8de0e1d3e
7
- data.tar.gz: 0276bb57efbad3f7f84c691f53ddd3f2f9d1ccd8ef804c0993a094040f4bee12fe1b9f425f7c1ef8d86807c49da5a7c5c4ff58e4e8e9838f4549239fe69fe3e2
6
+ metadata.gz: fc6d24ab9e3e7fdacb225d0fce839b3eca60c5ad5a4b7c990898e5063275e32075bf3e5d636ed58888349a38adb4b296590511dd152a97dc8b6eaf20eafdd20d
7
+ data.tar.gz: 124ae97fb1073610667bc5a35b345b46edc95c9635baa53f23dd01beff4f5693ada7be3fc2446f9de602ced9f8179d41fd5d8179739a5f716e77d4e6c58501ae
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2015 Code and Effect Inc.
1
+ Copyright 2023 Code and Effect Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts .js
2
+ //= link_directory ../stylesheets .css
@@ -1 +1 @@
1
- //= require effective_pages/additional_fields
1
+ //= require effective_posts/additional_fields
@@ -6,12 +6,7 @@ module Admin
6
6
 
7
7
  def index
8
8
  @page_title = 'Posts'
9
-
10
- if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
11
- @datatable = Effective::Datatables::Posts.new()
12
- else
13
- @datatable = EffectivePostsDatatable.new(self)
14
- end
9
+ @datatable = EffectivePostsDatatable.new(self)
15
10
 
16
11
  authorize_effective_posts!
17
12
  end
@@ -126,12 +121,12 @@ module Admin
126
121
  private
127
122
 
128
123
  def authorize_effective_posts!
129
- EffectivePosts.authorized?(self, :admin, :effective_posts)
130
- EffectivePosts.authorized?(self, action_name.to_sym, @post || Effective::Post)
124
+ EffectiveResources.authorize!(self, :admin, :effective_posts)
125
+ EffectiveResources.authorize!(self, action_name.to_sym, @post || Effective::Post)
131
126
  end
132
127
 
133
128
  def post_params
134
- params.require(:effective_post).permit(EffectivePosts.permitted_params)
129
+ params.require(:effective_post).permit!
135
130
  end
136
131
 
137
132
  end
@@ -20,7 +20,7 @@ module Effective
20
20
  @posts = @posts.where(search) if search.present?
21
21
  end
22
22
 
23
- EffectivePosts.authorized?(self, :index, Effective::Post)
23
+ EffectiveResources.authorize!(self, :index, Effective::Post)
24
24
 
25
25
  @page_title = (params[:page_title] || params[:category] || params[:defaults].try(:[], :category) || 'Posts').titleize
26
26
  end
@@ -29,11 +29,7 @@ module Effective
29
29
  @posts ||= Effective::Post.posts(user: current_user, category: params[:category], drafts: (params[:edit].to_s == 'true' || params[:preview].to_s == 'true'))
30
30
  @post = @posts.find(params[:id])
31
31
 
32
- if @post.respond_to?(:roles_permit?)
33
- raise Effective::AccessDenied unless @post.roles_permit?(current_user)
34
- end
35
-
36
- EffectivePosts.authorized?(self, :show, @post)
32
+ EffectiveResources.authorize!(self, :show, @post)
37
33
 
38
34
  @page_title = @post.title
39
35
  end
@@ -43,7 +39,7 @@ module Effective
43
39
  @post ||= Effective::Post.new(published_at: Time.zone.now)
44
40
  @page_title = 'New Post'
45
41
 
46
- EffectivePosts.authorized?(self, :new, @post)
42
+ EffectiveResources.authorize!(self, :new, @post)
47
43
  end
48
44
 
49
45
  def create
@@ -51,7 +47,7 @@ module Effective
51
47
  @post.user = current_user if defined?(current_user)
52
48
  @post.draft = (EffectivePosts.submissions_require_approval == true)
53
49
 
54
- EffectivePosts.authorized?(self, :create, @post)
50
+ EffectiveResources.authorize!(self, :create, @post)
55
51
 
56
52
  if @post.save
57
53
  @page_title ||= 'Post Submitted'
@@ -73,7 +69,7 @@ module Effective
73
69
  @post ||= Effective::Post.find(params[:id])
74
70
  @page_title ||= 'Edit Post'
75
71
 
76
- EffectivePosts.authorized?(self, :edit, @post)
72
+ EffectiveResources.authorize!(self, :edit, @post)
77
73
  end
78
74
 
79
75
  def update
@@ -81,7 +77,7 @@ module Effective
81
77
  draft_was = @post.draft
82
78
  @post.draft = (EffectivePosts.submissions_require_approval == true)
83
79
 
84
- EffectivePosts.authorized?(self, :update, @post)
80
+ EffectiveResources.authorize!(self, :update, @post)
85
81
 
86
82
  if @post.update(post_params)
87
83
  @page_title ||= 'Post Submitted'
@@ -102,7 +98,7 @@ module Effective
102
98
  def destroy
103
99
  @post ||= Effective::Post.find(params[:id])
104
100
 
105
- EffectivePosts.authorized?(self, :destroy, @post)
101
+ EffectiveResources.authorize!(self, :destroy, @post)
106
102
 
107
103
  if @post.destroy
108
104
  flash[:success] = 'Successfully deleted post'
@@ -1,35 +1,33 @@
1
- unless Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
2
- class EffectivePostsDatatable < Effective::Datatable
3
- datatable do
4
- order :published_at, :desc
1
+ class EffectivePostsDatatable < Effective::Datatable
2
+ datatable do
3
+ order :published_at, :desc
5
4
 
6
- col :published_at
7
- col :id, visible: false
5
+ col :published_at
6
+ col :id, visible: false
8
7
 
9
- col :title
10
- col :category, search: { collection: EffectivePosts.categories }
8
+ col :title
9
+ col :category, search: { collection: EffectivePosts.categories }
11
10
 
12
- if EffectivePosts.submissions_enabled
13
- col :approved, sql_column: 'NOT(draft)', as: :boolean do |post|
14
- post.draft? ? 'No' : 'Yes'
15
- end
16
-
17
- col :draft, visible: false
18
- else
19
- col :draft
11
+ if EffectivePosts.submissions_enabled
12
+ col :approved, sql_column: 'NOT(draft)', as: :boolean do |post|
13
+ post.draft? ? 'No' : 'Yes'
20
14
  end
21
15
 
22
- col :start_at
23
- col :end_at, visible: false
24
- col :location, visible: false
16
+ col :draft, visible: false
17
+ else
18
+ col :draft
19
+ end
25
20
 
26
- col :created_at, label: 'Submitted at', visible: false
21
+ col :start_at
22
+ col :end_at, visible: false
23
+ col :location, visible: false
27
24
 
28
- actions_col partial: '/admin/posts/actions', partial_as: :post
29
- end
25
+ col :created_at, label: 'Submitted at', visible: false
30
26
 
31
- collection do
32
- Effective::Post.all
33
- end
27
+ actions_col partial: '/admin/posts/actions', partial_as: :post
28
+ end
29
+
30
+ collection do
31
+ Effective::Post.all
34
32
  end
35
33
  end
@@ -1,34 +1,17 @@
1
1
  module Effective
2
- class PostsMailer < ActionMailer::Base
3
- helper EffectivePostsHelper
2
+ class PostsMailer < EffectivePosts.parent_mailer_class
3
+ include EffectiveMailer
4
4
 
5
- layout EffectivePosts.mailer[:layout].presence || 'effective_posts_mailer_layout'
5
+ helper EffectivePostsHelper
6
6
 
7
- def post_submitted_to_admin(post_param)
7
+ def post_submitted_to_admin(post_param, opts = {})
8
8
  @post = (post_param.kind_of?(Effective::Post) ? post_param : Effective::Post.find(post_param))
9
9
 
10
- mail(
11
- to: EffectivePosts.mailer[:admin_email],
12
- from: EffectivePosts.mailer[:default_from],
13
- subject: subject_for_post_submitted_to_admin(@post)
14
- )
15
- end
16
-
17
- private
10
+ subject = subject_for(__method__, 'Post Submitted', @post, opts)
11
+ headers = headers_for(resource, opts)
18
12
 
19
- def subject_for_post_submitted_to_admin(post)
20
- string_or_callable = EffectivePosts.mailer[:subject_for_post_submitted_to_admin]
21
-
22
- if string_or_callable.respond_to?(:call) # This is a Proc or a function, not a string
23
- string_or_callable = self.instance_exec(post, &string_or_callable)
24
- end
25
-
26
- prefix_subject(string_or_callable.presence || "A new post has been submitted that needs approval")
13
+ mail(to: mailer_admin, subject: subject, **headers)
27
14
  end
28
15
 
29
- def prefix_subject(text)
30
- prefix = (EffectivePosts.mailer[:subject_prefix].to_s rescue '')
31
- prefix.present? ? (prefix.chomp(' ') + ' ' + text) : text
32
- end
33
16
  end
34
17
  end
@@ -6,7 +6,7 @@ module Effective
6
6
 
7
7
  self.table_name = EffectivePosts.posts_table_name.to_s
8
8
 
9
- belongs_to :user
9
+ belongs_to :user, optional: true
10
10
 
11
11
  # Attributes
12
12
  # title :string
@@ -35,8 +35,7 @@ module Effective
35
35
  scope :published, -> { where(draft: false).where("#{EffectivePosts.posts_table_name}.published_at < ?", Time.zone.now) }
36
36
 
37
37
  scope :posts, -> (user: nil, category: nil, drafts: false) {
38
- scope = (Rails::VERSION::MAJOR > 3 ? all : scoped)
39
- scope = scope.includes(:regions).order(published_at: :desc)
38
+ scope = includes(:regions).order(published_at: :desc)
40
39
 
41
40
  if defined?(EffectiveAssets)
42
41
  scope = scope.includes(attachments: :asset)
@@ -87,7 +86,7 @@ module Effective
87
86
  end
88
87
 
89
88
  def send_post_submitted_to_admin!
90
- send_email(:post_submitted_to_admin, to_param)
89
+ send_email(:post_submitted_to_admin)
91
90
  end
92
91
 
93
92
  # Returns a duplicated post object, or throws an exception
@@ -110,19 +109,8 @@ module Effective
110
109
 
111
110
  private
112
111
 
113
- def send_email(email, *mailer_args)
114
- begin
115
- if EffectivePosts.mailer[:delayed_job_deliver] && EffectivePosts.mailer[:deliver_method] == :deliver_later
116
- Effective::PostsMailer.delay.public_send(email, *mailer_args)
117
- elsif EffectivePosts.mailer[:deliver_method].present?
118
- Effective::PostsMailer.public_send(email, *mailer_args).public_send(EffectivePosts.mailer[:deliver_method])
119
- else
120
- Effective::PostsMailer.public_send(email, *mailer_args).deliver_now
121
- end
122
- rescue => e
123
- raise e unless Rails.env.production?
124
- return false
125
- end
112
+ def send_email(email)
113
+ EffectivePosts.send_email(email, self)
126
114
  end
127
115
 
128
116
  end
@@ -22,30 +22,6 @@ EffectivePosts.setup do |config|
22
22
  # The author is the user that created the Effective::Post object
23
23
  config.post_meta_author = true
24
24
 
25
- # Authorization Method
26
- #
27
- # This method is called by all controller actions with the appropriate action and resource
28
- # If the method returns false, an Effective::AccessDenied Error will be raised (see README.md for complete info)
29
- #
30
- # Use via Proc (and with CanCan):
31
- # config.authorization_method = Proc.new { |controller, action, resource| can?(action, resource) }
32
- #
33
- # Use via custom method:
34
- # config.authorization_method = :my_authorization_method
35
- #
36
- # And then in your application_controller.rb:
37
- #
38
- # def my_authorization_method(action, resource)
39
- # current_user.is?(:admin)
40
- # end
41
- #
42
- # Or disable the check completely:
43
- # config.authorization_method = false
44
- config.authorization_method = Proc.new do |controller, action, resource|
45
- authorize!(action, resource)
46
- resource.respond_to?(:roles_permit?) ? resource.roles_permit?(current_user) : true
47
- end
48
-
49
25
  # Layout Settings
50
26
  # Configure the Layout per controller, or all at once
51
27
  config.layout = {
@@ -91,29 +67,18 @@ EffectivePosts.setup do |config|
91
67
  config.submissions_note = "News & Event submitted! A confirmation email has been sent to the website owner. When approved, your submission will appear on the website."
92
68
 
93
69
  # Mailer Settings
94
- # effective_posts will send the admin an email when a post is submitted
95
- # For all the emails, the same :subject_prefix will be prefixed. Leave as nil / empty string if you don't want any prefix
70
+ # Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
96
71
  #
97
- # The subject_for_post_submitted_to_admin can be one of:
98
- # - nil / empty string to use the built in defaults
99
- # - A string with the full subject line for this email
100
- # - A Proc to create the subject line based on the email
101
- # In all three of these cases, the subject_prefix will still be used.
102
-
103
- # The Procs are the same for admin & buyer receipt, the seller Proc is different
104
- # subject_for_post_submitted_to_admin: Proc.new { |post| "Post needs approval"}
105
-
106
- config.mailer = {
107
- subject_prefix: '[example]',
108
- subject_for_post_submitted_to_admin: '',
109
-
110
- layout: 'effective_posts_mailer_layout',
111
-
112
- default_from: 'info@example.com',
113
- admin_email: 'admin@example.com',
114
-
115
- deliver_method: nil, # :deliver (rails < 4.2), :deliver_now (rails >= 4.2) or :deliver_later
116
- delayed_job_deliver: false
117
- }
72
+ # Configure the class responsible to send e-mails.
73
+ # config.mailer = 'Effective::PostsMailer'
74
+ #
75
+ # Override effective_resource mailer defaults
76
+ #
77
+ # config.parent_mailer = nil # The parent class responsible for sending emails
78
+ # config.deliver_method = nil # The deliver method, deliver_later or deliver_now
79
+ # config.mailer_layout = nil # Default mailer layout
80
+ # config.mailer_sender = nil # Default From value
81
+ # config.mailer_admin = nil # Default To value for Admin correspondence
82
+ # config.mailer_subject = nil # Proc.new method used to customize Subject
118
83
 
119
84
  end
@@ -4,8 +4,10 @@ module EffectivePosts
4
4
 
5
5
  # Include Helpers to base application
6
6
  initializer 'effective_posts.action_controller' do |app|
7
- ActiveSupport.on_load :action_controller do
8
- helper EffectivePostsHelper
7
+ app.config.to_prepare do
8
+ ActiveSupport.on_load :action_controller_base do
9
+ helper EffectivePostsHelper
10
+ end
9
11
  end
10
12
  end
11
13
 
@@ -14,5 +16,6 @@ module EffectivePosts
14
16
  # Set up our defaults, as per our initializer template
15
17
  eval File.read("#{config.root}/config/effective_posts.rb")
16
18
  end
19
+
17
20
  end
18
21
  end
@@ -1,3 +1,3 @@
1
1
  module EffectivePosts
2
- VERSION = '0.6.4'.freeze
2
+ VERSION = '0.7.0'.freeze
3
3
  end
@@ -1,46 +1,32 @@
1
1
  require 'kaminari'
2
2
  require 'nokogiri'
3
+ require 'effective_resources'
3
4
  require 'effective_datatables'
4
5
  require 'effective_regions'
5
6
  require 'effective_posts/engine'
6
7
  require 'effective_posts/version'
7
8
 
8
9
  module EffectivePosts
9
- mattr_accessor :posts_table_name
10
10
 
11
- mattr_accessor :authorization_method
12
- mattr_accessor :permitted_params
11
+ def self.config_keys
12
+ [
13
+ :posts_table_name, :permitted_params,
14
+ :layout, :simple_form_options, :admin_simple_form_options,
13
15
 
14
- mattr_accessor :layout
15
- mattr_accessor :simple_form_options
16
- mattr_accessor :admin_simple_form_options
16
+ :categories, :use_category_routes,
17
+ :use_effective_roles, :use_fullscreen_editor,
17
18
 
18
- mattr_accessor :categories
19
- mattr_accessor :use_category_routes
19
+ :per_page, :post_meta_author,
20
20
 
21
- mattr_accessor :use_effective_roles
22
- mattr_accessor :use_fullscreen_editor
21
+ :submissions_enabled, :submissions_require_current_user, :submissions_require_approval, :submissions_note,
23
22
 
24
- mattr_accessor :per_page
25
- mattr_accessor :post_meta_author
26
-
27
- mattr_accessor :submissions_enabled
28
- mattr_accessor :submissions_require_current_user
29
- mattr_accessor :submissions_require_approval
30
- mattr_accessor :submissions_note
31
-
32
- # These are hashes of configs
33
- mattr_accessor :mailer
34
-
35
- def self.setup
36
- yield self
23
+ ]
37
24
  end
38
25
 
39
- def self.authorized?(controller, action, resource)
40
- if authorization_method.respond_to?(:call) || authorization_method.kind_of?(Symbol)
41
- raise Effective::AccessDenied.new() unless (controller || self).instance_exec(controller, action, resource, &authorization_method)
42
- end
43
- true
26
+ include EffectiveGem
27
+
28
+ def self.mailer_class
29
+ mailer&.constantize || Effective::PostsMailer
44
30
  end
45
31
 
46
32
  def self.permitted_params
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_posts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
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: 2022-03-31 00:00:00.000000000 Z
11
+ date: 2023-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: sass-rails
28
+ name: sassc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -86,42 +86,42 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.2.0
89
+ version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 1.2.0
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: effective_datatables
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "<"
102
102
  - !ruby/object:Gem::Version
103
- version: 2.0.0
103
+ version: '4'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "<"
109
109
  - !ruby/object:Gem::Version
110
- version: 2.0.0
110
+ version: '4'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: effective_regions
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 1.6.9
117
+ version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 1.6.9
124
+ version: '0'
125
125
  description: A blog implementation with WYSIWYG content editing, post scheduling,
126
126
  pagination and optional top level routes for each post category.
127
127
  email:
@@ -133,9 +133,9 @@ files:
133
133
  - MIT-LICENSE
134
134
  - README.md
135
135
  - Rakefile
136
- - app/assets/javascripts/effective/snippets/read_more_divider.js.coffee
137
- - app/assets/javascripts/effective_pages/additional_fields.js.coffee
136
+ - app/assets/config/effective_posts_manifest.js
138
137
  - app/assets/javascripts/effective_posts.js
138
+ - app/assets/javascripts/effective_posts/additional_fields.js.coffee
139
139
  - app/assets/stylesheets/effective_posts.scss
140
140
  - app/controllers/admin/posts_controller.rb
141
141
  - app/controllers/effective/posts_controller.rb
@@ -144,10 +144,7 @@ files:
144
144
  - app/helpers/effective_posts_helper.rb
145
145
  - app/helpers/effective_truncate_html_helper.rb
146
146
  - app/mailers/effective/posts_mailer.rb
147
- - app/models/effective/access_denied.rb
148
- - app/models/effective/datatables/posts.rb
149
147
  - app/models/effective/post.rb
150
- - app/models/effective/snippets/read_more_divider.rb
151
148
  - app/views/admin/posts/_actions.html.haml
152
149
  - app/views/admin/posts/_form.html.haml
153
150
  - app/views/admin/posts/edit.html.haml
@@ -203,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
200
  - !ruby/object:Gem::Version
204
201
  version: '0'
205
202
  requirements: []
206
- rubygems_version: 3.1.2
203
+ rubygems_version: 3.3.7
207
204
  signing_key:
208
205
  specification_version: 4
209
206
  summary: A blog implementation with WYSIWYG content editing, post scheduling, pagination
@@ -1,22 +0,0 @@
1
- CKEDITOR.dialog.add 'read_more_divider', (editor) -> # Must match the class name of the snippet
2
- title: 'Read more divider',
3
- minWidth: 200,
4
- minHeight: 100,
5
- contents: [
6
- {
7
- id: 'read_more_info', # Just an html id, doesn't really matter what is here
8
- elements: [
9
- {
10
- id: 'throwaway'
11
- type: 'html',
12
- html: 'Insert a read more divider to separate excerpt content from the full content.',
13
- setup: (widget) -> this.setValue(widget.data.throwaway)
14
- commit: (widget) -> widget.setData('throwaway', 'throwaway')
15
- },
16
- {
17
- type: 'html',
18
- html: 'Anything above the read more divider will be treated as excerpt content<br>and everything below the divider will also be included in the full content.'
19
- }
20
- ]
21
- }
22
- ]
@@ -1,17 +0,0 @@
1
- unless defined?(Effective::AccessDenied)
2
- module Effective
3
- class AccessDenied < StandardError
4
- attr_reader :action, :subject
5
-
6
- def initialize(message = nil, action = nil, subject = nil)
7
- @message = message
8
- @action = action
9
- @subject = subject
10
- end
11
-
12
- def to_s
13
- @message || I18n.t(:'unauthorized.default', :default => 'Access Denied')
14
- end
15
- end
16
- end
17
- end
@@ -1,39 +0,0 @@
1
- if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
2
- module Effective
3
- module Datatables
4
- class Posts < Effective::Datatable
5
- datatable do
6
- default_order :published_at, :desc
7
-
8
- table_column :published_at
9
- table_column :id, visible: false
10
-
11
- table_column :title
12
- table_column :category, filter: { type: :select, values: EffectivePosts.categories }
13
-
14
- if EffectivePosts.submissions_enabled
15
- table_column :approved, column: 'NOT(draft)', as: :boolean do |post|
16
- post.draft ? 'No' : 'Yes'
17
- end
18
-
19
- table_column :draft, visible: false
20
- else
21
- table_column :draft
22
- end
23
-
24
- table_column :start_at
25
- table_column :end_at, visible: false
26
- table_column :location, visible: false
27
-
28
- table_column :created_at, label: 'Submitted at', visible: false
29
-
30
- table_column :actions, sortable: false, filter: false, partial: '/admin/posts/actions'
31
- end
32
-
33
- def collection
34
- Effective::Post.all
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,12 +0,0 @@
1
- module Effective
2
- module Snippets
3
- class ReadMoreDivider < Snippet
4
- TOKEN = "<div style='display: none;'>READ_MORE_DIVIDER</div>"
5
-
6
- def snippet_attributes
7
- super + [:throwaway]
8
- end
9
-
10
- end
11
- end
12
- end