decidim-blogs 0.30.2 → 0.31.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_metadata_cell.rb +1 -1
- data/app/commands/decidim/blogs/admin/create_post.rb +1 -1
- data/app/commands/decidim/blogs/admin/update_post.rb +1 -1
- data/app/commands/decidim/blogs/create_post.rb +26 -3
- data/app/commands/decidim/blogs/update_post.rb +26 -1
- data/app/controllers/decidim/blogs/admin/posts_controller.rb +2 -3
- data/app/controllers/decidim/blogs/posts_controller.rb +2 -3
- data/app/forms/decidim/blogs/admin/post_form.rb +5 -3
- data/app/forms/decidim/blogs/post_form.rb +10 -3
- data/app/helpers/decidim/blogs/admin/posts_helper.rb +2 -4
- data/app/helpers/decidim/blogs/application_helper.rb +1 -1
- data/app/helpers/decidim/blogs/posts_select_helper.rb +0 -9
- data/app/models/decidim/blogs/post.rb +9 -6
- data/app/packs/stylesheets/blogs.scss +1 -1
- data/app/permissions/decidim/blog/permissions.rb +1 -3
- data/app/presenters/decidim/blogs/post_presenter.rb +10 -6
- data/app/views/decidim/blogs/admin/posts/_actions.html.erb +84 -21
- data/app/views/decidim/blogs/admin/posts/_form.html.erb +7 -0
- data/app/views/decidim/blogs/admin/posts/_post-tr.html.erb +11 -8
- data/app/views/decidim/blogs/admin/posts/_posts-thead.html.erb +1 -0
- data/app/views/decidim/blogs/admin/posts/index.html.erb +2 -2
- data/app/views/decidim/blogs/admin/posts/manage_trash.html.erb +2 -1
- data/app/views/decidim/blogs/posts/_actions.html.erb +2 -2
- data/app/views/decidim/blogs/posts/_form.html.erb +23 -2
- data/app/views/decidim/blogs/posts/_menu_actions.html.erb +4 -4
- data/config/assets.rb +2 -2
- data/config/locales/ar.yml +0 -3
- data/config/locales/bg.yml +0 -3
- data/config/locales/bs-BA.yml +0 -8
- data/config/locales/ca-IT.yml +16 -5
- data/config/locales/ca.yml +16 -5
- data/config/locales/cs.yml +16 -5
- data/config/locales/de.yml +16 -5
- data/config/locales/el.yml +0 -3
- data/config/locales/en.yml +16 -5
- data/config/locales/es-MX.yml +16 -5
- data/config/locales/es-PY.yml +16 -5
- data/config/locales/es.yml +16 -5
- data/config/locales/eu.yml +16 -5
- data/config/locales/fi-plain.yml +16 -5
- data/config/locales/fi.yml +16 -5
- data/config/locales/fr-CA.yml +12 -4
- data/config/locales/fr.yml +12 -4
- data/config/locales/ga-IE.yml +0 -5
- data/config/locales/gl.yml +0 -2
- data/config/locales/hu.yml +0 -3
- data/config/locales/it.yml +0 -3
- data/config/locales/ja.yml +16 -5
- data/config/locales/lb.yml +0 -3
- data/config/locales/lt.yml +0 -3
- data/config/locales/lv.yml +0 -2
- data/config/locales/nl.yml +0 -2
- data/config/locales/no.yml +0 -2
- data/config/locales/pl.yml +0 -3
- data/config/locales/pt-BR.yml +0 -3
- data/config/locales/pt.yml +0 -4
- data/config/locales/ro-RO.yml +10 -5
- data/config/locales/ru.yml +0 -3
- data/config/locales/sk.yml +0 -2
- data/config/locales/sq-AL.yml +0 -3
- data/config/locales/sr-CS.yml +0 -8
- data/config/locales/sv.yml +16 -5
- data/config/locales/tr-TR.yml +0 -2
- data/config/locales/zh-CN.yml +0 -2
- data/config/locales/zh-TW.yml +0 -3
- data/db/migrate/20250515133229_rename_blog_posts_endorsements_count_to_likes.rb +7 -0
- data/lib/decidim/api/post_input_sort.rb +1 -1
- data/lib/decidim/api/post_type.rb +7 -1
- data/lib/decidim/blogs/component.rb +19 -5
- data/lib/decidim/blogs/engine.rb +1 -1
- data/lib/decidim/blogs/post_serializer.rb +2 -2
- data/lib/decidim/blogs/schema_org_blog_posting_post_serializer.rb +0 -10
- data/lib/decidim/blogs/seeds.rb +2 -4
- data/lib/decidim/blogs/test/factories.rb +15 -6
- data/lib/decidim/blogs/version.rb +1 -1
- metadata +17 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c986e37bda0dace89dd1a56dc426d9149aefe3b19f3c7e767a77e115e5b75185
|
4
|
+
data.tar.gz: 9a78f9ac1c9e85f47df9a2e8ff49c06641d2973dce644c1f19a4e4e4fedf1804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a3b6d0079d7ccf256b782dc3498421afa07f7e81d0721a635ebecce4e3d675fc8d5799936f07b3a1a208b702e68ad7d3569e0bc8a207cf93594d22cb761ba2
|
7
|
+
data.tar.gz: e048d6740c1505e98754ea007a59fa91088a4d6710e8dfdc7a0528707c2c8ebb59986d8c1e551fed877609e84772de9aa642bea7e2ec783650fce40db38acd63
|
@@ -6,7 +6,7 @@ module Decidim
|
|
6
6
|
# This command is executed when the user creates a Post from the admin
|
7
7
|
# panel.
|
8
8
|
class CreatePost < Decidim::Commands::CreateResource
|
9
|
-
fetch_form_attributes :title, :body, :published_at, :author, :component
|
9
|
+
fetch_form_attributes :title, :body, :published_at, :author, :component, :taxonomizations
|
10
10
|
|
11
11
|
private
|
12
12
|
|
@@ -6,7 +6,7 @@ module Decidim
|
|
6
6
|
# This command is executed when the user changes a Post from the admin
|
7
7
|
# panel.
|
8
8
|
class UpdatePost < Decidim::Commands::UpdateResource
|
9
|
-
fetch_form_attributes :title, :body, :author
|
9
|
+
fetch_form_attributes :title, :body, :author, :taxonomizations
|
10
10
|
|
11
11
|
private
|
12
12
|
|
@@ -4,16 +4,39 @@ module Decidim
|
|
4
4
|
module Blogs
|
5
5
|
# This command is executed when the user creates a Post from the frontend
|
6
6
|
class CreatePost < Decidim::Commands::CreateResource
|
7
|
-
|
7
|
+
include ::Decidim::MultipleAttachmentsMethods
|
8
8
|
|
9
|
-
|
9
|
+
fetch_form_attributes :author, :taxonomizations
|
10
10
|
|
11
|
-
def
|
11
|
+
def call
|
12
|
+
return broadcast(:invalid) if invalid?
|
13
|
+
|
14
|
+
if process_attachments?
|
15
|
+
build_attachments
|
16
|
+
return broadcast(:invalid) if attachments_invalid?
|
17
|
+
end
|
18
|
+
|
19
|
+
perform!
|
20
|
+
broadcast(:ok, resource)
|
21
|
+
rescue ActiveRecord::RecordInvalid
|
22
|
+
add_file_attribute_errors!
|
23
|
+
broadcast(:invalid)
|
24
|
+
rescue Decidim::Commands::HookError
|
25
|
+
broadcast(:invalid)
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
12
29
|
|
13
30
|
def run_after_hooks
|
31
|
+
@attached_to = resource
|
32
|
+
create_attachments(first_weight: 1) if process_attachments?
|
14
33
|
send_notification
|
15
34
|
end
|
16
35
|
|
36
|
+
def resource_class = Decidim::Blogs::Post
|
37
|
+
|
38
|
+
def extra_params = { visibility: "all" }
|
39
|
+
|
17
40
|
def attributes
|
18
41
|
super.merge(
|
19
42
|
title: { I18n.locale => form.title },
|
@@ -4,7 +4,26 @@ module Decidim
|
|
4
4
|
module Blogs
|
5
5
|
# This command is executed when the user updates a Post from the frontend
|
6
6
|
class UpdatePost < Decidim::Commands::UpdateResource
|
7
|
-
|
7
|
+
include ::Decidim::MultipleAttachmentsMethods
|
8
|
+
|
9
|
+
fetch_form_attributes :title, :body, :taxonomizations
|
10
|
+
|
11
|
+
def call
|
12
|
+
return broadcast(:invalid) if invalid?
|
13
|
+
|
14
|
+
if process_attachments?
|
15
|
+
build_attachments
|
16
|
+
return broadcast(:invalid) if attachments_invalid?
|
17
|
+
end
|
18
|
+
|
19
|
+
perform!
|
20
|
+
broadcast(:ok, resource)
|
21
|
+
rescue ActiveRecord::RecordInvalid
|
22
|
+
add_file_attribute_errors!
|
23
|
+
broadcast(:invalid)
|
24
|
+
rescue Decidim::Commands::HookError
|
25
|
+
broadcast(:invalid)
|
26
|
+
end
|
8
27
|
|
9
28
|
private
|
10
29
|
|
@@ -16,6 +35,12 @@ module Decidim
|
|
16
35
|
body: { I18n.locale => form.body }
|
17
36
|
)
|
18
37
|
end
|
38
|
+
|
39
|
+
def run_after_hooks
|
40
|
+
@attached_to = resource
|
41
|
+
document_cleanup!(include_all_attachments: true)
|
42
|
+
create_attachments(first_weight: 1) if process_attachments?
|
43
|
+
end
|
19
44
|
end
|
20
45
|
end
|
21
46
|
end
|
@@ -7,7 +7,6 @@ module Decidim
|
|
7
7
|
class PostsController < Admin::ApplicationController
|
8
8
|
include Decidim::Admin::HasTrashableResources
|
9
9
|
|
10
|
-
helper UserGroupHelper
|
11
10
|
helper PostsHelper
|
12
11
|
|
13
12
|
def new
|
@@ -27,7 +26,7 @@ module Decidim
|
|
27
26
|
|
28
27
|
on(:invalid) do
|
29
28
|
flash.now[:alert] = I18n.t("posts.create.invalid", scope: "decidim.blogs.admin")
|
30
|
-
render action: "new"
|
29
|
+
render action: "new", status: :unprocessable_entity
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
@@ -49,7 +48,7 @@ module Decidim
|
|
49
48
|
|
50
49
|
on(:invalid) do
|
51
50
|
flash.now[:alert] = I18n.t("posts.update.invalid", scope: "decidim.blogs.admin")
|
52
|
-
render action: "edit"
|
51
|
+
render action: "edit", status: :unprocessable_entity
|
53
52
|
end
|
54
53
|
end
|
55
54
|
end
|
@@ -8,7 +8,6 @@ module Decidim
|
|
8
8
|
include Paginable
|
9
9
|
include Decidim::IconHelper
|
10
10
|
|
11
|
-
helper Decidim::UserGroupHelper
|
12
11
|
helper Decidim::Blogs::PostsSelectHelper
|
13
12
|
include Decidim::FormFactory
|
14
13
|
|
@@ -37,7 +36,7 @@ module Decidim
|
|
37
36
|
|
38
37
|
on(:invalid) do
|
39
38
|
flash.now[:alert] = I18n.t("posts.create.invalid", scope: "decidim.blogs.admin")
|
40
|
-
render action: "new"
|
39
|
+
render action: "new", status: :unprocessable_entity
|
41
40
|
end
|
42
41
|
end
|
43
42
|
end
|
@@ -59,7 +58,7 @@ module Decidim
|
|
59
58
|
|
60
59
|
on(:invalid) do
|
61
60
|
flash.now[:alert] = I18n.t("posts.update.invalid", scope: "decidim.blogs.admin")
|
62
|
-
render action: "edit"
|
61
|
+
render action: "edit", status: :unprocessable_entity
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
@@ -6,6 +6,7 @@ module Decidim
|
|
6
6
|
# This class holds a Form to update pages from Decidim's admin panel.
|
7
7
|
class PostForm < Decidim::Form
|
8
8
|
include TranslatableAttributes
|
9
|
+
include Decidim::HasTaxonomyFormAttributes
|
9
10
|
|
10
11
|
translatable_attribute :title, String
|
11
12
|
translatable_attribute :body, Decidim::Attributes::RichText
|
@@ -17,6 +18,8 @@ module Decidim
|
|
17
18
|
validates :body, translatable_presence: true
|
18
19
|
validate :can_set_author
|
19
20
|
|
21
|
+
alias component current_component
|
22
|
+
|
20
23
|
def map_model(model)
|
21
24
|
self.decidim_author_id = nil if model.author.is_a? Decidim::Organization
|
22
25
|
end
|
@@ -37,7 +40,6 @@ module Decidim
|
|
37
40
|
def can_set_author
|
38
41
|
return if author == current_user.organization
|
39
42
|
return if author == current_user
|
40
|
-
return if user_groups.include? author
|
41
43
|
return if author == post&.author
|
42
44
|
|
43
45
|
errors.add(:decidim_author_id, :invalid)
|
@@ -47,8 +49,8 @@ module Decidim
|
|
47
49
|
@post ||= Post.find_by(id:)
|
48
50
|
end
|
49
51
|
|
50
|
-
def
|
51
|
-
@
|
52
|
+
def participatory_space_manifest
|
53
|
+
@participatory_space_manifest ||= current_component.participatory_space.manifest.name
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|
@@ -5,22 +5,30 @@ module Decidim
|
|
5
5
|
# This class holds a Form to update pages from Decidim's admin panel.
|
6
6
|
class PostForm < Decidim::Form
|
7
7
|
include TranslatableAttributes
|
8
|
+
include Decidim::HasTaxonomyFormAttributes
|
9
|
+
include Decidim::AttachmentAttributes
|
10
|
+
include Decidim::HasUploadValidations
|
8
11
|
|
9
12
|
translatable_attribute :title, String
|
10
13
|
translatable_attribute :body, Decidim::Attributes::RichText
|
11
14
|
|
12
15
|
attribute :decidim_author_id, Integer
|
13
16
|
|
17
|
+
attachments_attribute :documents
|
18
|
+
|
14
19
|
validates :body, translatable_presence: true
|
15
20
|
validates :title, translatable_presence: true
|
16
21
|
|
17
22
|
validate :can_set_author
|
18
23
|
|
24
|
+
alias component current_component
|
25
|
+
|
19
26
|
def map_model(model)
|
20
27
|
presenter = PostPresenter.new(model)
|
21
28
|
|
22
29
|
self.title = presenter.title
|
23
30
|
self.body = presenter.body
|
31
|
+
self.documents = model.attachments
|
24
32
|
end
|
25
33
|
|
26
34
|
def author
|
@@ -34,7 +42,6 @@ module Decidim
|
|
34
42
|
|
35
43
|
def can_set_author
|
36
44
|
return if author == current_user
|
37
|
-
return if user_groups.include? author
|
38
45
|
return if author == post&.author
|
39
46
|
|
40
47
|
errors.add(:decidim_author_id, :invalid)
|
@@ -44,8 +51,8 @@ module Decidim
|
|
44
51
|
@post ||= Post.find_by(id: id)
|
45
52
|
end
|
46
53
|
|
47
|
-
def
|
48
|
-
@
|
54
|
+
def participatory_space_manifest
|
55
|
+
@participatory_space_manifest ||= current_component.participatory_space.manifest.name
|
49
56
|
end
|
50
57
|
end
|
51
58
|
end
|
@@ -22,12 +22,10 @@ module Decidim
|
|
22
22
|
|
23
23
|
def post_author_select_field(form, name, _options = {})
|
24
24
|
select_options = [
|
25
|
-
[current_organization_name, ""]
|
26
|
-
[current_user.name, current_user.id]
|
25
|
+
[current_organization_name, ""]
|
27
26
|
]
|
28
|
-
|
27
|
+
select_options << [current_user.name, current_user.id]
|
29
28
|
|
30
|
-
select_options += current_user_groups.map { |g| [g.name, g.id] } if current_organization.user_groups_enabled? && current_user_groups.any?
|
31
29
|
unless form.object.author.is_a?(Organization) || select_options.pluck(1).include?(form.object.author.id)
|
32
30
|
select_options << [form.object.author.name, form.object.author.id]
|
33
31
|
end
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
include PaginateHelper
|
9
9
|
include SanitizeHelper
|
10
10
|
include Decidim::Blogs::PostsHelper
|
11
|
-
include ::Decidim::
|
11
|
+
include ::Decidim::LikeableHelper
|
12
12
|
include ::Decidim::FollowableHelper
|
13
13
|
include Decidim::Comments::CommentsHelper
|
14
14
|
|
@@ -12,21 +12,12 @@ module Decidim
|
|
12
12
|
[current_user.name, current_user.id]
|
13
13
|
]
|
14
14
|
|
15
|
-
select_options += user_groups
|
16
15
|
select_options << [form.object.author.name, form.object.author.id] unless !form.object.author || select_options.pluck(1).include?(form.object.author.id)
|
17
16
|
|
18
17
|
return form.select(name, select_options) if select_options.size > 1
|
19
18
|
|
20
19
|
form.hidden_field(name, value: select_options.first[1])
|
21
20
|
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def user_groups
|
26
|
-
return [] unless current_organization.user_groups_enabled?
|
27
|
-
|
28
|
-
Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.map { |user_g| [user_g.name, user_g.id] }
|
29
|
-
end
|
30
21
|
end
|
31
22
|
end
|
32
23
|
end
|
@@ -9,10 +9,11 @@ module Decidim
|
|
9
9
|
include Decidim::HasAttachments
|
10
10
|
include Decidim::HasAttachmentCollections
|
11
11
|
include Decidim::HasComponent
|
12
|
+
include Decidim::Taxonomizable
|
12
13
|
include Decidim::Authorable
|
13
14
|
include Decidim::Comments::CommentableWithComponent
|
14
15
|
include Decidim::Searchable
|
15
|
-
include Decidim::
|
16
|
+
include Decidim::Likeable
|
16
17
|
include Decidim::Followable
|
17
18
|
include Decidim::Reportable
|
18
19
|
include Decidim::Publicable
|
@@ -49,6 +50,12 @@ module Decidim
|
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
53
|
+
# Returns the presenter for this BlogPost, to be used in the views.
|
54
|
+
# Required by ResourceRenderer.
|
55
|
+
def presenter
|
56
|
+
Decidim::Blogs::PostPresenter.new(self)
|
57
|
+
end
|
58
|
+
|
52
59
|
def visible?
|
53
60
|
participatory_space.try(:visible?) && component.try(:published?) && published?
|
54
61
|
end
|
@@ -76,10 +83,6 @@ module Decidim
|
|
76
83
|
author.is_a?(Decidim::Organization)
|
77
84
|
end
|
78
85
|
|
79
|
-
def user_group?
|
80
|
-
author.is_a?(Decidim::UserGroup)
|
81
|
-
end
|
82
|
-
|
83
86
|
def users_to_notify_on_comment_created
|
84
87
|
followers
|
85
88
|
end
|
@@ -95,7 +98,7 @@ module Decidim
|
|
95
98
|
|
96
99
|
# Public: Overrides the `reported_searchable_content_extras` Reportable concern method.
|
97
100
|
def reported_searchable_content_extras
|
98
|
-
[
|
101
|
+
[author.name]
|
99
102
|
end
|
100
103
|
end
|
101
104
|
end
|
@@ -49,7 +49,7 @@ module Decidim
|
|
49
49
|
def can_manage_post
|
50
50
|
return false unless post&.author
|
51
51
|
|
52
|
-
can_create_post &&
|
52
|
+
can_create_post && admin_can_manage_post
|
53
53
|
end
|
54
54
|
|
55
55
|
def admin_can_manage_post
|
@@ -58,8 +58,6 @@ module Decidim
|
|
58
58
|
case post.author
|
59
59
|
when Decidim::User
|
60
60
|
post.author == user
|
61
|
-
when Decidim::UserGroup
|
62
|
-
post.author.users.include?(user)
|
63
61
|
when Decidim::Organization
|
64
62
|
space_admin?
|
65
63
|
else
|
@@ -13,8 +13,6 @@ module Decidim
|
|
13
13
|
def author
|
14
14
|
@author ||= if official?
|
15
15
|
Decidim::Blogs::OfficialAuthorPresenter.new
|
16
|
-
elsif user_group?
|
17
|
-
Decidim::UserGroupPresenter.new(super)
|
18
16
|
else
|
19
17
|
Decidim::UserPresenter.new(super)
|
20
18
|
end
|
@@ -28,16 +26,22 @@ module Decidim
|
|
28
26
|
Decidim::ResourceLocatorPresenter.new(post).path
|
29
27
|
end
|
30
28
|
|
31
|
-
def title(
|
29
|
+
def title(html_escape: false, all_locales: false)
|
32
30
|
return unless post
|
33
31
|
|
34
|
-
super(post.title,
|
32
|
+
super(post.title, html_escape, all_locales)
|
35
33
|
end
|
36
34
|
|
37
|
-
def body(links: false,
|
35
|
+
def body(links: false, strip_tags: false, all_locales: false)
|
38
36
|
return unless post
|
39
37
|
|
40
|
-
content_handle_locale(post.body, all_locales,
|
38
|
+
content_handle_locale(post.body, all_locales, links, strip_tags)
|
39
|
+
end
|
40
|
+
|
41
|
+
def taxonomy_names(html_escape: false, all_locales: false)
|
42
|
+
post.taxonomies.map do |taxonomy|
|
43
|
+
taxonomy.presenter.title(html_escape:, all_locales:)
|
44
|
+
end
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
@@ -1,21 +1,84 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
<button type="button" data-controller="dropdown" data-target="actions-post-<%= post.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: post.title) %>">
|
2
|
+
<%= icon "more-fill", class: "text-secondary" %>
|
3
|
+
</button>
|
4
|
+
|
5
|
+
<div class="inline-block relative">
|
6
|
+
<ul id="actions-post-<%= post.id %>" class="dropdown dropdown__action" aria-hidden="true">
|
7
|
+
<% if view == :deleted %>
|
8
|
+
<% if allowed_to? :restore, :blogpost, trashable_deleted_resource: post %>
|
9
|
+
<li class="dropdown__item">
|
10
|
+
<%= link_to url_for(action: :restore, id: post, controller: "posts"), method: :patch, class: "dropdown__button" do %>
|
11
|
+
<%= icon "refresh-line" %>
|
12
|
+
<%= t("decidim.admin.actions.restore") %>
|
13
|
+
<% end %>
|
14
|
+
</li>
|
15
|
+
<% end %>
|
16
|
+
<% else %>
|
17
|
+
<% if allowed_to? :update, :blogpost, blogpost: post %>
|
18
|
+
<li class="dropdown__item">
|
19
|
+
<%= link_to edit_post_path(post), class: "dropdown__button" do %>
|
20
|
+
<%= icon "pencil-line" %>
|
21
|
+
<%= t("actions.edit", scope: "decidim.blogs") %>
|
22
|
+
<% end %>
|
23
|
+
</li>
|
24
|
+
|
25
|
+
<hr>
|
26
|
+
|
27
|
+
<% if component_settings.attachments_allowed? %>
|
28
|
+
<li class="dropdown__item">
|
29
|
+
<%= link_to post_attachments_path(post), class: "dropdown__button" do %>
|
30
|
+
<%= icon "attachment-line" %>
|
31
|
+
<%= t("actions.attachments", scope: "decidim.admin") %>
|
32
|
+
<% end %>
|
33
|
+
</li>
|
34
|
+
|
35
|
+
<li class="dropdown__item">
|
36
|
+
<%= link_to post_attachment_collections_path(post), class: "dropdown__button" do %>
|
37
|
+
<%= icon "folder-line" %>
|
38
|
+
<%= t("actions.attachment_collections", scope: "decidim.admin") %>
|
39
|
+
<% end %>
|
40
|
+
</li>
|
41
|
+
|
42
|
+
<hr>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
<li class="dropdown__item">
|
47
|
+
<%= link_to resource_locator(post).path, target: :blank, data: { "external-link": false }, class: "dropdown__button" do %>
|
48
|
+
<%= icon "eye-line" %>
|
49
|
+
<%= t("actions.preview", scope: "decidim.admin") %>
|
50
|
+
<% end %>
|
51
|
+
</li>
|
52
|
+
|
53
|
+
<hr>
|
54
|
+
|
55
|
+
<li class="dropdown__item">
|
56
|
+
<%= dropdown_resource_permissions_link(post) %>
|
57
|
+
</li>
|
58
|
+
|
59
|
+
<% if allowed_to? :soft_delete, :blogpost, trashable_deleted_resource: post %>
|
60
|
+
<hr>
|
61
|
+
|
62
|
+
<li class="dropdown__item">
|
63
|
+
<%= link_to soft_delete_post_path(post), method: :patch, data: { confirm: t("actions.confirm_delete_post", scope: "decidim.blogs") }, class: "dropdown__button" do %>
|
64
|
+
<%= icon "delete-bin-line" %>
|
65
|
+
<%= t("actions.soft_delete", scope: "decidim.admin") %>
|
66
|
+
<% end %>
|
67
|
+
</li>
|
68
|
+
<% else %>
|
69
|
+
<hr>
|
70
|
+
|
71
|
+
<li class="dropdown__item">
|
72
|
+
<div class="dropdown__button-disabled">
|
73
|
+
<%= with_tooltip t("tooltips.deleted_posts_info", scope: "decidim.admin") do %>
|
74
|
+
<%= icon "delete-bin-line", class: "text-gray" %>
|
75
|
+
<span>
|
76
|
+
<%= t("actions.soft_delete", scope: "decidim.admin") %>
|
77
|
+
</span>
|
78
|
+
<% end %>
|
79
|
+
</div>
|
80
|
+
</li>
|
81
|
+
<% end %>
|
82
|
+
<% end %>
|
83
|
+
</ul>
|
84
|
+
</div>
|
@@ -16,6 +16,13 @@
|
|
16
16
|
<%= form.datetime_field :published_at %>
|
17
17
|
</div>
|
18
18
|
</div>
|
19
|
+
<% if @form.taxonomy_filters&.any? %>
|
20
|
+
<% @form.taxonomy_filters.each do |filter| %>
|
21
|
+
<div class="row column">
|
22
|
+
<%= filter_taxonomy_items_select_field form, :taxonomies, filter %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
19
26
|
</div>
|
20
27
|
</div>
|
21
28
|
|
@@ -1,25 +1,28 @@
|
|
1
1
|
<tr data-id="<%= post.id %>">
|
2
|
-
<td>
|
2
|
+
<td data-label="<%= t("models.post.fields.title", scope: "decidim.blogs") %>">
|
3
3
|
<% if allowed_to? :update, :blogpost, blogpost: post %>
|
4
4
|
<%= link_to translated_attribute(post.title), edit_post_path(post) %><br>
|
5
5
|
<% else %>
|
6
6
|
<%= translated_attribute(post.title) %><br>
|
7
7
|
<% end %>
|
8
8
|
</td>
|
9
|
-
<td>
|
9
|
+
<td data-label="<%= t("models.post.fields.body", scope: "decidim.blogs") %>">
|
10
10
|
<%= decidim_sanitize_editor post_description_admin(post) %>
|
11
11
|
</td>
|
12
|
-
<td>
|
12
|
+
<td data-label="<%= t("models.post.fields.author", scope: "decidim.blogs") %>">
|
13
13
|
<%= translated_attribute(post.try(:author).try(:name)) %>
|
14
14
|
</td>
|
15
|
+
<td data-label="<%= t("models.post.fields.taxonomies", scope: "decidim.blogs") %>">
|
16
|
+
<%= present(post).taxonomy_names.join(", ") %>
|
17
|
+
</td>
|
15
18
|
<% publish_data = publish_data(post.published_at) %>
|
16
|
-
<td>
|
17
|
-
|
18
|
-
publish_data[:icon]
|
19
|
-
end %>
|
19
|
+
<td data-label="<%= t("models.post.fields.published_at", scope: "decidim.blogs") %>">
|
20
|
+
<% if publish_data[:icon] .present? %>
|
21
|
+
<%= with_tooltip(publish_data[:popup], title: publish_data[:popup], class: "left") { publish_data[:icon] } %>
|
22
|
+
<% end %>
|
20
23
|
<%= l post.published_at, format: :decidim_short %>
|
21
24
|
</td>
|
22
|
-
<td class="table-list__actions">
|
25
|
+
<td class="table-list__actions" data-label="<%= t("actions.title", scope: "decidim.blogs") %>">
|
23
26
|
<%= render partial: "decidim/blogs/admin/posts/actions", locals: { post:, view: } %>
|
24
27
|
</td>
|
25
28
|
</tr>
|
@@ -3,6 +3,7 @@
|
|
3
3
|
<th><%= t("models.post.fields.title", scope: "decidim.blogs") %></th>
|
4
4
|
<th><%= t("models.post.fields.body", scope: "decidim.blogs") %></th>
|
5
5
|
<th><%= t("models.post.fields.author", scope: "decidim.blogs") %></th>
|
6
|
+
<th><%= t("models.post.fields.taxonomies", scope: "decidim.blogs") %></th>
|
6
7
|
<th><%= t("models.post.fields.published_at", scope: "decidim.blogs") %></th>
|
7
8
|
<th><%= t("actions.title", scope: "decidim.blogs") %></th>
|
8
9
|
</tr>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<%= render partial: "decidim/admin/components/resource_action" %>
|
8
8
|
</h1>
|
9
9
|
</div>
|
10
|
-
<div class="table-
|
10
|
+
<div class="table-stacked">
|
11
11
|
<table class="table-list">
|
12
12
|
<%= render partial: "posts-thead" %>
|
13
13
|
<tbody>
|
@@ -20,7 +20,7 @@
|
|
20
20
|
</div>
|
21
21
|
<% if allowed_to? :manage_trash, :post, participatory_space: current_participatory_space %>
|
22
22
|
<div class="card mt-4">
|
23
|
-
<%= link_to manage_trash_posts_path, class: "flex items-center
|
23
|
+
<%= link_to manage_trash_posts_path, class: "flex items-center text-secondary" do %>
|
24
24
|
<%= icon "delete-bin-2-line", class: "mr-2 fill-current text-secondary", role: "img" %>
|
25
25
|
<%= t("actions.view_deleted_posts", scope: "decidim.blogs") %>
|
26
26
|
<span class="ml-2">
|
@@ -1,11 +1,12 @@
|
|
1
1
|
<% add_decidim_page_title(t(".title")) %>
|
2
|
+
|
2
3
|
<div class="card">
|
3
4
|
<div class="item_show__header">
|
4
5
|
<h1 class="item_show__header-title">
|
5
6
|
<%= t(".title") %>
|
6
7
|
</h1>
|
7
8
|
</div>
|
8
|
-
<div class="table-
|
9
|
+
<div class="table-stacked">
|
9
10
|
<table class="table-list">
|
10
11
|
<%= render partial: "posts-thead" %>
|
11
12
|
<tbody>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<section class="layout-main__section layout-main__buttons pt-10" data-buttons>
|
2
|
-
<%= cell("decidim/
|
2
|
+
<%= cell("decidim/like_block", post) %>
|
3
3
|
|
4
4
|
<%= cell "decidim/comments_button", nil %>
|
5
5
|
|
@@ -8,4 +8,4 @@
|
|
8
8
|
</div>
|
9
9
|
</section>
|
10
10
|
|
11
|
-
<%= cell "decidim/
|
11
|
+
<%= cell "decidim/likers_list", post %>
|