effective_posts 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/{effective_pages → effective_posts}/additional_fields.js.coffee +0 -0
- data/app/assets/javascripts/effective_posts.js +1 -1
- data/app/datatables/effective_posts_datatable.rb +1 -0
- data/app/models/effective/datatables/posts.rb +1 -0
- data/app/models/effective/post.rb +8 -5
- data/app/views/admin/posts/_form.html.haml +3 -0
- data/db/migrate/01_create_effective_posts.rb.erb +3 -2
- data/lib/effective_posts/version.rb +1 -1
- data/lib/effective_posts.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d8ad99d213f6946178f6ee95f35d5e457cfb2adce548ae2e33d513087e72c34
|
4
|
+
data.tar.gz: c2be01f6e4b03b42a45203f90c5f796e61dc25587bb9fe98647e27a64c0b2031
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bbe96be0a51878183fa877150b83067da2ffad8bdbb7830807f80a7176e0deb91e35587f1ca24cd6a551b141d449acc13f7a68186ab57b0bd5811d4e67de8ba
|
7
|
+
data.tar.gz: 58cff47c9439c69cd2105465a37bd9c26951f31374fcb84c19ffe89ef9f3fc3d47d2db53e6bd91afe8cad20abce9f568e73290f242789687847fe64d61a2a458
|
data/README.md
CHANGED
File without changes
|
@@ -1 +1 @@
|
|
1
|
-
//= require
|
1
|
+
//= require effective_posts/additional_fields
|
@@ -9,6 +9,7 @@ if Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
|
|
9
9
|
table_column :id, visible: false
|
10
10
|
|
11
11
|
table_column :title
|
12
|
+
table_column :slug
|
12
13
|
table_column :category, filter: { type: :select, values: EffectivePosts.categories }
|
13
14
|
|
14
15
|
if EffectivePosts.submissions_enabled
|
@@ -2,6 +2,7 @@ module Effective
|
|
2
2
|
class Post < ActiveRecord::Base
|
3
3
|
acts_as_role_restricted if defined?(EffectiveRoles) && EffectivePosts.use_effective_roles
|
4
4
|
acts_as_regionable
|
5
|
+
acts_as_slugged
|
5
6
|
|
6
7
|
self.table_name = EffectivePosts.posts_table_name.to_s
|
7
8
|
|
@@ -11,12 +12,14 @@ module Effective
|
|
11
12
|
# title :string
|
12
13
|
# description :string
|
13
14
|
|
15
|
+
# slug :string
|
16
|
+
|
14
17
|
# category :string
|
15
18
|
|
16
19
|
# draft :boolean
|
17
20
|
# published_at :datetime
|
18
21
|
# tags :text
|
19
|
-
|
22
|
+
|
20
23
|
# roles_mask :integer
|
21
24
|
|
22
25
|
# Event Fields
|
@@ -67,6 +70,10 @@ module Effective
|
|
67
70
|
scope
|
68
71
|
}
|
69
72
|
|
73
|
+
def to_param
|
74
|
+
slug.presence || "#{id}-#{title.parameterize}"
|
75
|
+
end
|
76
|
+
|
70
77
|
def to_s
|
71
78
|
title.presence || 'New Post'
|
72
79
|
end
|
@@ -91,10 +98,6 @@ module Effective
|
|
91
98
|
region(:body).content = input
|
92
99
|
end
|
93
100
|
|
94
|
-
def to_param
|
95
|
-
"#{id}-#{title.parameterize}"
|
96
|
-
end
|
97
|
-
|
98
101
|
# 3.333 words/second is the default reading speed.
|
99
102
|
def time_to_read_in_seconds(reading_speed = 3.333)
|
100
103
|
(regions.to_a.sum { |region| (region.content || '').scan(/\w+/).size } / reading_speed).seconds
|
@@ -1,5 +1,8 @@
|
|
1
1
|
= effective_form_with(model: post, url: post.persisted? ? effective_posts.admin_post_path(post.id) : effective_posts.admin_posts_path) do |f|
|
2
2
|
= f.text_field :title, hint: 'The title of your post.'
|
3
|
+
- if f.object.persisted? || f.object.errors.include?(:slug)
|
4
|
+
- current_url = (effective_posts.post_url(f.object) rescue nil)
|
5
|
+
= f.text_field :slug, hint: "The slug controls this post's internet address. Be careful, changing the slug will break links that other websites may have to the old address.<br>#{('This post is currently reachable via ' + link_to(current_url.gsub(f.object.slug, '<strong>' + f.object.slug + '</strong>').html_safe, current_url)) if current_url }".html_safe
|
3
6
|
|
4
7
|
- if Array(EffectivePosts.categories).length > 1
|
5
8
|
= f.select :category, EffectivePosts.categories
|
data/lib/effective_posts.rb
CHANGED
@@ -55,7 +55,7 @@ module EffectivePosts
|
|
55
55
|
|
56
56
|
def self.permitted_params
|
57
57
|
@@permitted_params ||= [
|
58
|
-
:title, :excerpt, :description, :draft, :category, :published_at, :body, :tags, :extra,
|
58
|
+
:title, :excerpt, :description, :draft, :category, :slug, :published_at, :body, :tags, :extra,
|
59
59
|
:start_at, :end_at, :location, :website_name, :website_href, roles: []
|
60
60
|
].compact
|
61
61
|
end
|
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: 1.1.
|
4
|
+
version: 1.1.3
|
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: 2019-06-
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: effective_resources
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: A blog implementation with WYSIWYG content editing, post scheduling,
|
112
126
|
pagination and optional top level routes for each post category.
|
113
127
|
email:
|
@@ -119,8 +133,8 @@ files:
|
|
119
133
|
- MIT-LICENSE
|
120
134
|
- README.md
|
121
135
|
- app/assets/javascripts/effective/snippets/read_more_divider.js.coffee
|
122
|
-
- app/assets/javascripts/effective_pages/additional_fields.js.coffee
|
123
136
|
- app/assets/javascripts/effective_posts.js
|
137
|
+
- app/assets/javascripts/effective_posts/additional_fields.js.coffee
|
124
138
|
- app/assets/stylesheets/effective_posts.scss
|
125
139
|
- app/controllers/admin/posts_controller.rb
|
126
140
|
- app/controllers/effective/posts_controller.rb
|