decidim-blogs 0.28.6 → 0.29.0.rc1
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_g_cell.rb +5 -1
- data/app/cells/decidim/blogs/post_l_cell.rb +5 -1
- data/app/commands/decidim/blogs/admin/create_post.rb +7 -37
- data/app/commands/decidim/blogs/admin/update_post.rb +4 -40
- data/app/controllers/decidim/blogs/admin/posts_controller.rb +7 -8
- data/app/forms/decidim/blogs/admin/post_form.rb +1 -1
- data/app/helpers/decidim/blogs/admin/posts_helper.rb +1 -1
- data/app/models/decidim/blogs/post.rb +5 -0
- data/app/views/decidim/blogs/admin/posts/_form.html.erb +0 -2
- data/app/views/decidim/blogs/admin/posts/index.html.erb +2 -2
- data/app/views/decidim/blogs/posts/index.html.erb +1 -9
- data/config/locales/ar.yml +1 -3
- data/config/locales/bg.yml +1 -0
- data/config/locales/ca.yml +1 -1
- data/config/locales/cs.yml +1 -1
- data/config/locales/el.yml +1 -0
- data/config/locales/es-MX.yml +1 -1
- data/config/locales/es-PY.yml +1 -1
- data/config/locales/es.yml +1 -1
- data/config/locales/eu.yml +7 -7
- data/config/locales/fr-CA.yml +1 -1
- data/config/locales/fr.yml +1 -1
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +1 -0
- data/config/locales/hu.yml +1 -0
- data/config/locales/id-ID.yml +2 -0
- data/config/locales/is-IS.yml +2 -0
- data/config/locales/it.yml +2 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +2 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +2 -0
- data/config/locales/nl.yml +2 -1
- data/config/locales/no.yml +1 -0
- data/config/locales/pl.yml +1 -0
- data/config/locales/pt-BR.yml +1 -0
- data/config/locales/pt.yml +1 -36
- data/config/locales/ro-RO.yml +25 -37
- data/config/locales/ru.yml +1 -0
- data/config/locales/sk.yml +2 -0
- data/config/locales/sl.yml +5 -0
- data/config/locales/sq-AL.yml +1 -0
- data/config/locales/sv.yml +7 -28
- data/config/locales/tr-TR.yml +2 -0
- data/config/locales/uk.yml +2 -0
- data/config/locales/zh-CN.yml +2 -0
- data/config/locales/zh-TW.yml +1 -0
- data/decidim-blogs.gemspec +2 -2
- data/lib/decidim/api/blogs_type.rb +3 -1
- data/lib/decidim/api/post_type.rb +0 -13
- data/lib/decidim/blogs/test/factories.rb +1 -23
- data/lib/decidim/blogs/version.rb +1 -1
- metadata +21 -24
- data/config/locales/bn-BD.yml +0 -1
- data/config/locales/bs-BA.yml +0 -9
- data/config/locales/ca-IT.yml +0 -98
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d3e05fbe48097df47ffc82f4b2ebbde3fc54a955c8d2b2df9b56b38f75d1014
|
4
|
+
data.tar.gz: 0f053312ab155c859de24f3f0249876f301bedb5339eaa8ce5e82a49a9397d84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a46ed37e62404b0a957b8d4ac280233e34643f03d28f7248274539570a5dab1e43e459ee77ce2102f656b37fc9eb10c3f3a410b61b4f0cf56af58480aa7525f
|
7
|
+
data.tar.gz: b4fa8aea088a2ad4d7b68dd92e03028cfb88bc9ea97cb3ed845b7600b0df575116e2b9ad0d57d33c9cc3f1e9c263996b9311db0058c594252ec330641c91e836
|
@@ -9,6 +9,10 @@ module Decidim
|
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
+
def has_image?
|
13
|
+
resource_image_path.present?
|
14
|
+
end
|
15
|
+
|
12
16
|
def show_description?
|
13
17
|
true
|
14
18
|
end
|
@@ -17,7 +21,7 @@ module Decidim
|
|
17
21
|
"decidim/blogs/post_metadata_g"
|
18
22
|
end
|
19
23
|
|
20
|
-
def
|
24
|
+
def resource_image_path
|
21
25
|
return if photo.blank?
|
22
26
|
|
23
27
|
photo.url
|
@@ -9,6 +9,10 @@ module Decidim
|
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
+
def has_image?
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
12
16
|
def has_description?
|
13
17
|
true
|
14
18
|
end
|
@@ -21,7 +25,7 @@ module Decidim
|
|
21
25
|
"decidim/blogs/post_metadata"
|
22
26
|
end
|
23
27
|
|
24
|
-
def
|
28
|
+
def resource_image_path
|
25
29
|
return if photo.blank?
|
26
30
|
|
27
31
|
photo.url
|
@@ -5,51 +5,21 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# This command is executed when the user creates a Post from the admin
|
7
7
|
# panel.
|
8
|
-
class CreatePost < Decidim::
|
9
|
-
|
10
|
-
@form = form
|
11
|
-
@current_user = current_user
|
12
|
-
end
|
13
|
-
|
14
|
-
# Creates the post if valid.
|
15
|
-
#
|
16
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
17
|
-
def call
|
18
|
-
return broadcast(:invalid) if @form.invalid?
|
19
|
-
|
20
|
-
transaction do
|
21
|
-
create_post!
|
22
|
-
send_notification
|
23
|
-
end
|
24
|
-
|
25
|
-
broadcast(:ok, @post)
|
26
|
-
end
|
8
|
+
class CreatePost < Decidim::Commands::CreateResource
|
9
|
+
fetch_form_attributes :title, :body, :published_at, :author, :component
|
27
10
|
|
28
11
|
private
|
29
12
|
|
30
|
-
def
|
31
|
-
attributes = {
|
32
|
-
title: @form.title,
|
33
|
-
body: @form.body,
|
34
|
-
published_at: @form.published_at,
|
35
|
-
component: @form.current_component,
|
36
|
-
author: @form.author
|
37
|
-
}
|
13
|
+
def resource_class = Decidim::Blogs::Post
|
38
14
|
|
39
|
-
|
40
|
-
Post,
|
41
|
-
@current_user,
|
42
|
-
attributes,
|
43
|
-
visibility: "all"
|
44
|
-
)
|
45
|
-
end
|
15
|
+
def extra_params = { visibility: "all" }
|
46
16
|
|
47
|
-
def
|
17
|
+
def run_after_hooks
|
48
18
|
Decidim::EventsManager.publish(
|
49
19
|
event: "decidim.events.blogs.post_created",
|
50
20
|
event_class: Decidim::Blogs::CreatePostEvent,
|
51
|
-
resource
|
52
|
-
followers:
|
21
|
+
resource:,
|
22
|
+
followers: resource.participatory_space.followers
|
53
23
|
)
|
54
24
|
end
|
55
25
|
end
|
@@ -3,51 +3,15 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Blogs
|
5
5
|
module Admin
|
6
|
-
# This command is executed when the user changes a
|
6
|
+
# This command is executed when the user changes a Post from the admin
|
7
7
|
# panel.
|
8
|
-
class UpdatePost < Decidim::
|
9
|
-
|
10
|
-
#
|
11
|
-
# form - The form from which to get the data.
|
12
|
-
# blog - The current instance of the page to be updated.
|
13
|
-
def initialize(form, post, user)
|
14
|
-
@form = form
|
15
|
-
@post = post
|
16
|
-
@user = user
|
17
|
-
end
|
18
|
-
|
19
|
-
# Updates the blog if valid.
|
20
|
-
#
|
21
|
-
# Broadcasts :ok if successful, :invalid otherwise.
|
22
|
-
def call
|
23
|
-
return broadcast(:invalid) if form.invalid?
|
24
|
-
|
25
|
-
transaction do
|
26
|
-
update_post!
|
27
|
-
end
|
28
|
-
|
29
|
-
broadcast(:ok, post)
|
30
|
-
end
|
8
|
+
class UpdatePost < Decidim::Commands::UpdateResource
|
9
|
+
fetch_form_attributes :title, :body, :author
|
31
10
|
|
32
11
|
private
|
33
12
|
|
34
|
-
attr_reader :form, :post
|
35
|
-
|
36
|
-
def update_post!
|
37
|
-
Decidim.traceability.update!(
|
38
|
-
post,
|
39
|
-
@user,
|
40
|
-
attributes
|
41
|
-
)
|
42
|
-
end
|
43
|
-
|
44
13
|
def attributes
|
45
|
-
|
46
|
-
title: form.title,
|
47
|
-
body: form.body,
|
48
|
-
published_at: form.published_at,
|
49
|
-
author: form.author
|
50
|
-
}.reject do |attribute, value|
|
14
|
+
super.merge(published_at: form.published_at).reject do |attribute, value|
|
51
15
|
value.blank? && attribute == :published_at
|
52
16
|
end
|
53
17
|
end
|
@@ -17,7 +17,7 @@ module Decidim
|
|
17
17
|
enforce_permission_to :create, :blogpost
|
18
18
|
@form = form(PostForm).from_params(params, current_component:)
|
19
19
|
|
20
|
-
CreatePost.call(@form
|
20
|
+
CreatePost.call(@form) do
|
21
21
|
on(:ok) do
|
22
22
|
flash[:notice] = I18n.t("posts.create.success", scope: "decidim.blogs.admin")
|
23
23
|
redirect_to posts_path
|
@@ -39,7 +39,7 @@ module Decidim
|
|
39
39
|
enforce_permission_to :update, :blogpost, blogpost: post
|
40
40
|
@form = form(PostForm).from_params(params, current_component:)
|
41
41
|
|
42
|
-
UpdatePost.call(@form, post
|
42
|
+
UpdatePost.call(@form, post) do
|
43
43
|
on(:ok) do
|
44
44
|
flash[:notice] = I18n.t("posts.update.success", scope: "decidim.blogs.admin")
|
45
45
|
redirect_to posts_path
|
@@ -55,13 +55,12 @@ module Decidim
|
|
55
55
|
def destroy
|
56
56
|
enforce_permission_to :destroy, :blogpost, blogpost: post
|
57
57
|
|
58
|
-
Decidim.
|
59
|
-
|
58
|
+
Decidim::Commands::DestroyResource.call(post, current_user) do
|
59
|
+
on(:ok) do
|
60
|
+
flash[:notice] = I18n.t("posts.destroy.success", scope: "decidim.blogs.admin")
|
61
|
+
redirect_to posts_path
|
62
|
+
end
|
60
63
|
end
|
61
|
-
|
62
|
-
flash[:notice] = I18n.t("posts.destroy.success", scope: "decidim.blogs.admin")
|
63
|
-
|
64
|
-
redirect_to posts_path
|
65
64
|
end
|
66
65
|
|
67
66
|
private
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
include TranslatableAttributes
|
9
9
|
|
10
10
|
translatable_attribute :title, String
|
11
|
-
translatable_attribute :body,
|
11
|
+
translatable_attribute :body, String
|
12
12
|
|
13
13
|
attribute :decidim_author_id, Integer
|
14
14
|
attribute :published_at, Decidim::Attributes::TimeWithZone
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
|
23
23
|
def post_author_select_field(form, name, _options = {})
|
24
24
|
select_options = [
|
25
|
-
[
|
25
|
+
[current_organization_name, ""],
|
26
26
|
[current_user.name, current_user.id]
|
27
27
|
]
|
28
28
|
current_user_groups = Decidim::UserGroups::ManageableUserGroups.for(current_user).verified
|
@@ -86,6 +86,11 @@ module Decidim
|
|
86
86
|
:admin
|
87
87
|
end
|
88
88
|
|
89
|
+
# Public: Overrides the `reported_content_url` Reportable concern method.
|
90
|
+
def reported_content_url
|
91
|
+
ResourceLocatorPresenter.new(self).url
|
92
|
+
end
|
93
|
+
|
89
94
|
# Public: Overrides the `reported_attributes` Reportable concern method.
|
90
95
|
def reported_attributes
|
91
96
|
[:title, :body]
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<th><%= t("models.post.fields.body", scope: "decidim.blogs") %></th>
|
16
16
|
<th><%= t("models.post.fields.author", scope: "decidim.blogs") %></th>
|
17
17
|
<th><%= t("models.post.fields.published_at", scope: "decidim.blogs") %></th>
|
18
|
-
<th
|
18
|
+
<th><%= t("actions.title", scope: "decidim.blogs") %></th>
|
19
19
|
</tr>
|
20
20
|
</thead>
|
21
21
|
<tbody>
|
@@ -33,7 +33,7 @@
|
|
33
33
|
<%= decidim_sanitize_editor post_description_admin(post) %>
|
34
34
|
</td>
|
35
35
|
<td>
|
36
|
-
<%= post.try(:author).try(:name) %>
|
36
|
+
<%= translated_attribute(post.try(:author).try(:name)) %>
|
37
37
|
</td>
|
38
38
|
<% publish_data = publish_data(post.published_at) %>
|
39
39
|
<td>
|
@@ -1,12 +1,4 @@
|
|
1
|
-
<%
|
2
|
-
description: translated_attribute(current_component.participatory_space.try(:description)),
|
3
|
-
title: t("decidim.components.pagination.page_title",
|
4
|
-
component_name:,
|
5
|
-
current_page: paginate_posts.current_page,
|
6
|
-
total_pages: paginate_posts.total_pages ),
|
7
|
-
url: posts_url,
|
8
|
-
resource: current_component) %>
|
9
|
-
|
1
|
+
<% add_decidim_page_title component_name %>
|
10
2
|
<%= append_javascript_pack_tag "decidim_blogs" %>
|
11
3
|
<%= append_stylesheet_pack_tag "decidim_blogs" %>
|
12
4
|
|
data/config/locales/ar.yml
CHANGED
@@ -22,6 +22,7 @@ ar:
|
|
22
22
|
blogs:
|
23
23
|
actions:
|
24
24
|
author_id: إنشاء مشاركة كـ
|
25
|
+
confirm_destroy: هل أنت متأكد أنك تريد حذف هذه المشاركة؟
|
25
26
|
destroy: حذف
|
26
27
|
edit: تعديل
|
27
28
|
new: منشور جديد
|
@@ -43,9 +44,6 @@ ar:
|
|
43
44
|
create: "%{user_name} أنشأ منشور المدونة %{resource_name} في %{space_name}"
|
44
45
|
delete: "%{user_name} حذف منشور المدونة%{resource_name} من %{space_name}"
|
45
46
|
update: "%{user_name} حدث منشور المدونة %{resource_name} في %{space_name}"
|
46
|
-
content_blocks:
|
47
|
-
highlighted_posts:
|
48
|
-
name: المنشورات
|
49
47
|
last_activity:
|
50
48
|
new_post: 'منشور جديد:'
|
51
49
|
models:
|
data/config/locales/bg.yml
CHANGED
data/config/locales/ca.yml
CHANGED
data/config/locales/cs.yml
CHANGED
data/config/locales/el.yml
CHANGED
data/config/locales/es-MX.yml
CHANGED
data/config/locales/es-PY.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/eu.yml
CHANGED
@@ -18,7 +18,7 @@ eu:
|
|
18
18
|
blogs:
|
19
19
|
actions:
|
20
20
|
author_id: Sortu argitalpena hau bezala
|
21
|
-
confirm_destroy: Ziur zaude
|
21
|
+
confirm_destroy: Ziur zaude post hau argitalpen ezabatu nahi duzula?
|
22
22
|
destroy: Ezabatu
|
23
23
|
edit: Editatu
|
24
24
|
new: Beste argitalpen bat
|
@@ -44,9 +44,9 @@ eu:
|
|
44
44
|
success: Argitalpena zuzen gordea.
|
45
45
|
admin_log:
|
46
46
|
post:
|
47
|
-
create: "%{user_name}
|
48
|
-
delete: "%{user_name}
|
49
|
-
update: "%{user_name}
|
47
|
+
create: "%{user_name} k %{resource_name} blogeko argitalpena sortu du %{space_name} espazioan"
|
48
|
+
delete: "%{user_name} k %{resource_name} blogeko argitalpena ezabatu du %{space_name} espazioan"
|
49
|
+
update: "%{user_name} k %{resource_name} blogeko argitalpena eguneratu egin da %{space_name} espazioan"
|
50
50
|
content_blocks:
|
51
51
|
highlighted_posts:
|
52
52
|
last_published: Azken argitarapena
|
@@ -65,8 +65,8 @@ eu:
|
|
65
65
|
posts:
|
66
66
|
index:
|
67
67
|
count:
|
68
|
-
one: "
|
69
|
-
other: "%{count}
|
68
|
+
one: "%{count} argitalpen"
|
69
|
+
other: "%{count} edukin"
|
70
70
|
empty: Oraindik ez dago argitalpenik.
|
71
71
|
components:
|
72
72
|
blogs:
|
@@ -93,6 +93,6 @@ eu:
|
|
93
93
|
email_intro: '"%{resource_title}" argitalpena jarraitzen ari zaren "%{participatory_space_title}" espazioan argitaratu da.'
|
94
94
|
email_outro: Jakinarazpena jaso duzu "%{participatory_space_title}" jarraitzen ari zarelako. Aurreko estekan utzi ahal diozu jarraitzeari.
|
95
95
|
email_subject: Argitalpen berria %{participatory_space_title} espazioan
|
96
|
-
notification_title: <a href="%{resource_path}">%{resource_title}</a>
|
96
|
+
notification_title: <a href="%{resource_path}">%{resource_title}</a> posta %{participatory_space_title} argitaratu da
|
97
97
|
statistics:
|
98
98
|
posts_count: Argitalpenak
|
data/config/locales/fr-CA.yml
CHANGED
@@ -18,7 +18,7 @@ fr-CA:
|
|
18
18
|
blogs:
|
19
19
|
actions:
|
20
20
|
author_id: Créer un article comme
|
21
|
-
confirm_destroy: Êtes-vous
|
21
|
+
confirm_destroy: Êtes-vous certain de vouloir supprimer cet article ?
|
22
22
|
destroy: Supprimer
|
23
23
|
edit: Modifier
|
24
24
|
new: Nouvel article
|
data/config/locales/fr.yml
CHANGED
@@ -18,7 +18,7 @@ fr:
|
|
18
18
|
blogs:
|
19
19
|
actions:
|
20
20
|
author_id: Créer un article en tant que
|
21
|
-
confirm_destroy: Êtes-vous
|
21
|
+
confirm_destroy: Êtes-vous certain de vouloir supprimer cet article ?
|
22
22
|
destroy: Supprimer
|
23
23
|
edit: Modifier
|
24
24
|
new: Nouvel article
|
data/config/locales/ga-IE.yml
CHANGED
data/config/locales/gl.yml
CHANGED
data/config/locales/hu.yml
CHANGED
data/config/locales/id-ID.yml
CHANGED
data/config/locales/is-IS.yml
CHANGED
data/config/locales/it.yml
CHANGED
data/config/locales/ko.yml
CHANGED
data/config/locales/lb.yml
CHANGED
data/config/locales/lt.yml
CHANGED
data/config/locales/lv.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/config/locales/no.yml
CHANGED
data/config/locales/pl.yml
CHANGED
data/config/locales/pt-BR.yml
CHANGED
data/config/locales/pt.yml
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
---
|
2
2
|
pt:
|
3
3
|
activemodel:
|
4
|
-
attributes:
|
5
|
-
post:
|
6
|
-
body: Corpo
|
7
|
-
decidim_author_id: Autor
|
8
|
-
published_at: Hora de publicação
|
9
|
-
title: Título
|
10
4
|
models:
|
11
5
|
decidim/blogs/create_post_event: Nova publicação no blog
|
12
6
|
activerecord:
|
@@ -18,62 +12,33 @@ pt:
|
|
18
12
|
blogs:
|
19
13
|
actions:
|
20
14
|
author_id: Criar publicação como
|
21
|
-
confirm_destroy: Tem a certeza de que
|
15
|
+
confirm_destroy: Tem a certeza de que deseja eliminar esta publicação?
|
22
16
|
destroy: Eliminar
|
23
17
|
edit: Editar
|
24
18
|
new: Nova publicação
|
25
19
|
title: Ações
|
26
20
|
admin:
|
27
21
|
posts:
|
28
|
-
create:
|
29
|
-
invalid: Ocorreu um problema ao criar esta publicação.
|
30
|
-
success: Publicação criada corretamente.
|
31
22
|
edit:
|
32
23
|
save: Actualizar
|
33
24
|
title: Editar publicação
|
34
25
|
index:
|
35
|
-
not_published_yet: Ainda não publicado
|
36
26
|
title: Publicações
|
37
27
|
new:
|
38
28
|
create: Criar
|
39
29
|
title: Criar publicação
|
40
30
|
update:
|
41
31
|
invalid: Ocorreu um problema ao guardar a publicação.
|
42
|
-
success: Publicação guardada corretamente.
|
43
|
-
admin_log:
|
44
|
-
post:
|
45
|
-
create: "%{user_name} criou a publicação %{resource_name} no espaço %{space_name}"
|
46
|
-
delete: "%{user_name} eliminou a publicação %{resource_name} no espaço %{space_name}"
|
47
|
-
update: "%{user_name} atualizou a publicação %{resource_name} no espaço %{space_name}"
|
48
|
-
content_blocks:
|
49
|
-
highlighted_posts:
|
50
|
-
last_published: Última publicação
|
51
|
-
name: Publicações
|
52
|
-
see_all: Ver todas as publicações
|
53
|
-
last_activity:
|
54
|
-
new_post: 'Nova publicação:'
|
55
32
|
models:
|
56
33
|
post:
|
57
34
|
fields:
|
58
35
|
author: Autor
|
59
36
|
body: Corpo
|
60
|
-
official_blog_post: Publicação oficial
|
61
|
-
published_at: Hora de publicação
|
62
|
-
title: Título
|
63
|
-
posts:
|
64
|
-
index:
|
65
|
-
count:
|
66
|
-
one: "%{count} publicação"
|
67
|
-
other: "%{count} publicações"
|
68
|
-
empty: Ainda não há publicações.
|
69
37
|
components:
|
70
38
|
blogs:
|
71
39
|
actions:
|
72
40
|
comment: Comentar
|
73
|
-
create: Criar
|
74
|
-
destroy: Eliminar
|
75
41
|
endorse: Apoiar
|
76
|
-
update: Atualizar
|
77
42
|
name: Blog
|
78
43
|
settings:
|
79
44
|
global:
|