decidim-blogs 0.14.4 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/cells/decidim/blogs/post_activity_cell.rb +15 -0
- data/app/commands/decidim/blogs/admin/create_post.rb +9 -2
- data/app/models/decidim/blogs/post.rb +2 -0
- data/config/locales/ca.yml +2 -0
- data/config/locales/de.yml +2 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/es-PY.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/eu.yml +2 -0
- data/config/locales/fi.yml +2 -0
- data/config/locales/fr.yml +2 -0
- data/config/locales/gl.yml +2 -0
- data/config/locales/hu.yml +2 -0
- data/config/locales/it.yml +2 -0
- data/config/locales/nl.yml +2 -0
- data/config/locales/pl.yml +2 -0
- data/config/locales/pt-BR.yml +2 -0
- data/config/locales/pt.yml +2 -0
- data/config/locales/sv.yml +2 -0
- data/db/migrate/20181017084519_make_blogposts_authors_polymorphics.rb +32 -0
- data/lib/decidim/blogs/component.rb +24 -3
- data/lib/decidim/blogs/test/factories.rb +2 -2
- data/lib/decidim/blogs/version.rb +1 -1
- metadata +19 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac5af838f71ba4a699a05cc6dfe4fe947a66fa9936f72a0de01c0a92e12f5882
|
4
|
+
data.tar.gz: 435cef43067070627ed83f7a1ac852210c7b081b0f7cfcab759af827fb3964b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a761e23b486b64a352ab2780f097060b867456e63083f0c0e44636e3d23f9e59ce78ed0aff5cf3a2daf9ee3beb4d5d8ab1052bb1e6114e481fce9d1f0ca1a6
|
7
|
+
data.tar.gz: 840553d869ccfba2751dfb10561f9019eeb18f6593276463094df2e2f119191b1ebb824910768ab8cc89066d9e2e75ce3b79e5167e4633e515f3ebf53438c078
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Blogs
|
5
|
+
# A cell to display when a post has been created.
|
6
|
+
class PostActivityCell < ActivityCell
|
7
|
+
def title
|
8
|
+
I18n.t(
|
9
|
+
"decidim.blogs.last_activity.new_post_at_html",
|
10
|
+
link: participatory_space_link
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -28,11 +28,18 @@ module Decidim
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def create_post!
|
31
|
-
|
31
|
+
attributes = {
|
32
32
|
title: @form.title,
|
33
33
|
body: @form.body,
|
34
34
|
component: @form.current_component,
|
35
|
-
|
35
|
+
author: @current_user
|
36
|
+
}
|
37
|
+
|
38
|
+
@post = Decidim.traceability.create!(
|
39
|
+
Post,
|
40
|
+
@current_user,
|
41
|
+
attributes,
|
42
|
+
visibility: "all"
|
36
43
|
)
|
37
44
|
end
|
38
45
|
|
data/config/locales/ca.yml
CHANGED
data/config/locales/de.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/es-PY.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/eu.yml
CHANGED
data/config/locales/fi.yml
CHANGED
data/config/locales/fr.yml
CHANGED
data/config/locales/gl.yml
CHANGED
data/config/locales/hu.yml
CHANGED
data/config/locales/it.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/config/locales/pl.yml
CHANGED
data/config/locales/pt-BR.yml
CHANGED
data/config/locales/pt.yml
CHANGED
data/config/locales/sv.yml
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class MakeBlogpostsAuthorsPolymorphics < ActiveRecord::Migration[5.2]
|
4
|
+
class Post < ApplicationRecord
|
5
|
+
self.table_name = :decidim_blogs_posts
|
6
|
+
|
7
|
+
include Decidim::HasComponent
|
8
|
+
end
|
9
|
+
|
10
|
+
def change
|
11
|
+
add_column :decidim_blogs_posts, :decidim_author_type, :string
|
12
|
+
|
13
|
+
Post.reset_column_information
|
14
|
+
Post.find_each do |post|
|
15
|
+
if post.decidim_author_id.present?
|
16
|
+
post.decidim_author_type = "Decidim::UserBaseEntity"
|
17
|
+
else
|
18
|
+
post.decidim_author_id = post.organization.id
|
19
|
+
post.decidim_author_type = "Decidim::Organization"
|
20
|
+
end
|
21
|
+
post.save!
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index :decidim_blogs_posts,
|
25
|
+
[:decidim_author_id, :decidim_author_type],
|
26
|
+
name: "index_decidim_blogs_posts_on_decidim_author"
|
27
|
+
change_column_null :decidim_blogs_posts, :decidim_author_id, false
|
28
|
+
change_column_null :decidim_blogs_posts, :decidim_author_type, false
|
29
|
+
|
30
|
+
Post.reset_column_information
|
31
|
+
end
|
32
|
+
end
|
@@ -32,13 +32,18 @@ Decidim.register_component(:blogs) do |component|
|
|
32
32
|
end
|
33
33
|
|
34
34
|
component.seeds do |participatory_space|
|
35
|
+
admin_user = Decidim::User.find_by(
|
36
|
+
organization: participatory_space.organization,
|
37
|
+
email: "admin@example.org"
|
38
|
+
)
|
39
|
+
|
35
40
|
step_settings = if participatory_space.allows_steps?
|
36
41
|
{ participatory_space.active_step.id => { comments_enabled: true, comments_blocked: false } }
|
37
42
|
else
|
38
43
|
{}
|
39
44
|
end
|
40
45
|
|
41
|
-
|
46
|
+
params = {
|
42
47
|
name: Decidim::Components::Namer.new(participatory_space.organization.available_locales, :blogs).i18n_name,
|
43
48
|
manifest_name: :blogs,
|
44
49
|
published_at: Time.current,
|
@@ -47,18 +52,34 @@ Decidim.register_component(:blogs) do |component|
|
|
47
52
|
vote_limit: 0
|
48
53
|
},
|
49
54
|
step_settings: step_settings
|
50
|
-
|
55
|
+
}
|
56
|
+
|
57
|
+
component = Decidim.traceability.perform_action!(
|
58
|
+
"publish",
|
59
|
+
Decidim::Component,
|
60
|
+
admin_user,
|
61
|
+
visibility: "all"
|
62
|
+
) do
|
63
|
+
Decidim::Component.create!(params)
|
64
|
+
end
|
51
65
|
|
52
66
|
5.times do
|
53
67
|
author = Decidim::User.where(organization: component.organization).all.first
|
54
68
|
|
55
|
-
|
69
|
+
params = {
|
56
70
|
component: component,
|
57
71
|
title: Decidim::Faker::Localized.sentence(5),
|
58
72
|
body: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
59
73
|
Decidim::Faker::Localized.paragraph(20)
|
60
74
|
end,
|
61
75
|
author: author
|
76
|
+
}
|
77
|
+
|
78
|
+
post = Decidim.traceability.create!(
|
79
|
+
Decidim::Blogs::Post,
|
80
|
+
author,
|
81
|
+
params,
|
82
|
+
visibility: "all"
|
62
83
|
)
|
63
84
|
|
64
85
|
Decidim::Comments::Seed.comments_for(post)
|
@@ -12,8 +12,8 @@ FactoryBot.define do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
factory :post, class: "Decidim::Blogs::Post" do
|
15
|
-
title {
|
16
|
-
body { Decidim::Faker::Localized.wrapped("<p>", "</p>") {
|
15
|
+
title { generate_localized_title }
|
16
|
+
body { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
17
17
|
component { build(:component, manifest_name: "blogs") }
|
18
18
|
author { build(:user, :confirmed, organization: component.organization) }
|
19
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-blogs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaac Massot Gil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.15.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.15.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: decidim-comments
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.15.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.15.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: decidim-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.15.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.15.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: httparty
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,56 +100,56 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.15.0
|
104
104
|
type: :development
|
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: 0.
|
110
|
+
version: 0.15.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: decidim-assemblies
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.15.0
|
118
118
|
type: :development
|
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: 0.
|
124
|
+
version: 0.15.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: decidim-dev
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
131
|
+
version: 0.15.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
138
|
+
version: 0.15.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: decidim-participatory_processes
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: 0.15.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 0.15.0
|
153
153
|
description: A Blog component for decidim's participatory spaces.
|
154
154
|
email:
|
155
155
|
- isaac.mg@coditramuntana.com
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- README.md
|
161
161
|
- Rakefile
|
162
162
|
- app/assets/images/decidim/blogs/icon.svg
|
163
|
+
- app/cells/decidim/blogs/post_activity_cell.rb
|
163
164
|
- app/cells/decidim/blogs/post_cell.rb
|
164
165
|
- app/cells/decidim/blogs/post_m/footer.erb
|
165
166
|
- app/cells/decidim/blogs/post_m_cell.rb
|
@@ -207,6 +208,7 @@ files:
|
|
207
208
|
- config/locales/uk.yml
|
208
209
|
- db/migrate/20171129131353_create_decidim_blogs_posts.rb
|
209
210
|
- db/migrate/20171211084630_add_author_to_decidim_blogs_posts.rb
|
211
|
+
- db/migrate/20181017084519_make_blogposts_authors_polymorphics.rb
|
210
212
|
- lib/decidim/blogs.rb
|
211
213
|
- lib/decidim/blogs/admin.rb
|
212
214
|
- lib/decidim/blogs/admin_engine.rb
|
@@ -234,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
236
|
version: '0'
|
235
237
|
requirements: []
|
236
238
|
rubyforge_project:
|
237
|
-
rubygems_version: 2.7.
|
239
|
+
rubygems_version: 2.7.6
|
238
240
|
signing_key:
|
239
241
|
specification_version: 4
|
240
242
|
summary: Decidim blogs module
|