decidim-blogs 0.28.1 → 0.29.0.rc1

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: 2707fefef8c642b9543e50c423fe6f7df708e6a05cad9d50a527e828f06b7769
4
- data.tar.gz: 966464d795f50f2ac2a94cc06be1b9e577766fce5cd7fa665efd3f97e064e4a1
3
+ metadata.gz: 2d3e05fbe48097df47ffc82f4b2ebbde3fc54a955c8d2b2df9b56b38f75d1014
4
+ data.tar.gz: 0f053312ab155c859de24f3f0249876f301bedb5339eaa8ce5e82a49a9397d84
5
5
  SHA512:
6
- metadata.gz: edb47ec3e4e5cefe5df87777601d80782ca3727963f90dca9af1219c1991958cdcfe89813be78cdfe4c62b878bc114e9c24ea74ef53e536cf44792f2b652afac
7
- data.tar.gz: e88ac53492d30eaacafbc94a22c84cbb4259ed5f04d485b1679aaa181cb2aba4b5408dcbae5bd7dc48821b163b1de046d6154e14f6b07bdb2ff38dcfc235ad35
6
+ metadata.gz: 0a46ed37e62404b0a957b8d4ac280233e34643f03d28f7248274539570a5dab1e43e459ee77ce2102f656b37fc9eb10c3f3a410b61b4f0cf56af58480aa7525f
7
+ data.tar.gz: b4fa8aea088a2ad4d7b68dd92e03028cfb88bc9ea97cb3ed845b7600b0df575116e2b9ad0d57d33c9cc3f1e9c263996b9311db0058c594252ec330641c91e836
@@ -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::Command
9
- def initialize(form, current_user)
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 create_post!
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
- @post = Decidim.traceability.create!(
40
- Post,
41
- @current_user,
42
- attributes,
43
- visibility: "all"
44
- )
45
- end
15
+ def extra_params = { visibility: "all" }
46
16
 
47
- def send_notification
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: @post,
52
- followers: @post.participatory_space.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 Blog from the admin
6
+ # This command is executed when the user changes a Post from the admin
7
7
  # panel.
8
- class UpdatePost < Decidim::Command
9
- # Initializes a UpdateBlog Command.
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, current_user) do
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, current_user) do
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.traceability.perform_action!("delete", post, current_user) do
59
- post.destroy!
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
@@ -22,7 +22,7 @@ module Decidim
22
22
 
23
23
  def post_author_select_field(form, name, _options = {})
24
24
  select_options = [
25
- [current_organization.name, ""],
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
@@ -2,9 +2,7 @@
2
2
  <div class="card pt-4">
3
3
  <div class="card-section">
4
4
  <div class="row column">
5
- <div class="field">
6
5
  <%= post_author_select_field form, :decidim_author_id, label: t("decidim.blogs.actions.author_id") %>
7
- </div>
8
6
  </div>
9
7
 
10
8
  <div class="row column">
@@ -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 class="actions"><%= t("actions.title", scope: "decidim.blogs") %></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,6 +1,12 @@
1
1
  ---
2
2
  bg:
3
3
  activemodel:
4
+ attributes:
5
+ post:
6
+ body: Основен текст
7
+ decidim_author_id: Автор
8
+ published_at: Час на публикуване
9
+ title: Заглавие
4
10
  models:
5
11
  decidim/blogs/create_post_event: Нова блог публикация
6
12
  activerecord:
@@ -11,4 +17,82 @@ bg:
11
17
  decidim:
12
18
  blogs:
13
19
  actions:
20
+ author_id: Създаване на публикация като
14
21
  confirm_destroy: Сигурни ли сте, че желаете да изтриете тази публикация?
22
+ destroy: Изтрий
23
+ edit: Редактирай
24
+ new: Нова публикация
25
+ title: Активности
26
+ admin:
27
+ posts:
28
+ create:
29
+ invalid: Възникна проблем при създаването на тази публикация.
30
+ success: Публикацията беше създадена успешно.
31
+ destroy:
32
+ success: Публикацията беше изтрита успешно.
33
+ edit:
34
+ save: Актуализация
35
+ title: Редактиране на поста
36
+ index:
37
+ not_published_yet: Не публикувано все още.
38
+ title: Публикации
39
+ new:
40
+ create: Създаване
41
+ title: Създай публикация
42
+ update:
43
+ invalid: Възникна проблем при запазването на публикацията.
44
+ success: Публикацията беше запазена успешно.
45
+ admin_log:
46
+ post:
47
+ create: "%{user_name} създаде публикацията в блога %{resource_name} в %{space_name}"
48
+ delete: "%{user_name} изтри публикацията в блога %{resource_name} от %{space_name}"
49
+ update: "%{user_name} актуализира публикацията в блога %{resource_name} в %{space_name}"
50
+ content_blocks:
51
+ highlighted_posts:
52
+ last_published: Последно публикувано
53
+ name: Публикации
54
+ see_all: Виж всички публикации
55
+ last_activity:
56
+ new_post: 'Нова публикация:'
57
+ models:
58
+ post:
59
+ fields:
60
+ author: Автор
61
+ body: Основен текст
62
+ official_blog_post: Официална публикация
63
+ published_at: Час на публикуване
64
+ title: Заглавие
65
+ posts:
66
+ index:
67
+ count:
68
+ one: "%{count} публикация"
69
+ other: "%{count} публикации"
70
+ empty: Все още няма постове.
71
+ components:
72
+ blogs:
73
+ actions:
74
+ comment: Коментар
75
+ create: Създаване
76
+ destroy: Изтрий
77
+ endorse: Подкрепете
78
+ update: Актуализация
79
+ name: Блог
80
+ settings:
81
+ global:
82
+ announcement: Обявление
83
+ comments_enabled: Коментарите са разрешени
84
+ comments_max_length: Максимална дължина на коментарите (Оставете 0 за стойност по подразбиране)
85
+ step:
86
+ announcement: Обявление
87
+ comments_blocked: Коментарите са блокирани
88
+ endorsements_blocked: Подкрепата е блокирана
89
+ endorsements_enabled: Подкрепата е активирана
90
+ events:
91
+ blogs:
92
+ post_created:
93
+ email_intro: Публикацията „%{resource_title}“ е публикувана в(ъв)%{participatory_space_title}“, което следвате.
94
+ email_outro: Получавате това известие, защото следвате "%{participatory_space_title}". Може да премахнете следването чрез предходния линк.
95
+ email_subject: Публикувана е нова публикация в(ъв) %{participatory_space_title}
96
+ notification_title: Публикацията <a href="%{resource_path}">%{resource_title}</a> е публикувана в(ъв) %{participatory_space_title}
97
+ statistics:
98
+ posts_count: Постове
@@ -51,7 +51,7 @@ es-MX:
51
51
  highlighted_posts:
52
52
  last_published: Última publicación
53
53
  name: Publicaciones
54
- see_all: Per todas las publicaciones
54
+ see_all: Ver todas las publicaciones
55
55
  last_activity:
56
56
  new_post: 'Nueva publicación:'
57
57
  models:
@@ -51,7 +51,7 @@ es-PY:
51
51
  highlighted_posts:
52
52
  last_published: Última publicación
53
53
  name: Publicaciones
54
- see_all: Per todas las publicaciones
54
+ see_all: Ver todas las publicaciones
55
55
  last_activity:
56
56
  new_post: 'Nueva publicación:'
57
57
  models:
@@ -51,7 +51,7 @@ es:
51
51
  highlighted_posts:
52
52
  last_published: Última publicación
53
53
  name: Publicaciones
54
- see_all: Per todas las publicaciones
54
+ see_all: Ver todas las publicaciones
55
55
  last_activity:
56
56
  new_post: 'Nueva publicación:'
57
57
  models:
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  "homepage_uri" => "https://decidim.org",
20
20
  "source_code_uri" => "https://github.com/decidim/decidim"
21
21
  }
22
- s.required_ruby_version = "~> 3.1.0"
22
+ s.required_ruby_version = "~> 3.2.0"
23
23
 
24
24
  s.name = "decidim-blogs"
25
25
  s.summary = "Decidim blogs module"
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-pages version.
5
5
  module Blogs
6
6
  def self.version
7
- "0.28.1"
7
+ "0.29.0.rc1"
8
8
  end
9
9
  end
10
10
  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.28.1
4
+ version: 0.29.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaac Massot Gil
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-30 00:00:00.000000000 Z
11
+ date: 2024-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-admin
@@ -16,98 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.28.1
19
+ version: 0.29.0.rc1
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.28.1
26
+ version: 0.29.0.rc1
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.28.1
33
+ version: 0.29.0.rc1
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.28.1
40
+ version: 0.29.0.rc1
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.28.1
47
+ version: 0.29.0.rc1
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.28.1
54
+ version: 0.29.0.rc1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: decidim-admin
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.28.1
61
+ version: 0.29.0.rc1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.28.1
68
+ version: 0.29.0.rc1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: decidim-assemblies
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.28.1
75
+ version: 0.29.0.rc1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.28.1
82
+ version: 0.29.0.rc1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: decidim-dev
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 0.28.1
89
+ version: 0.29.0.rc1
90
90
  type: :development
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: 0.28.1
96
+ version: 0.29.0.rc1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: decidim-participatory_processes
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 0.28.1
103
+ version: 0.29.0.rc1
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.28.1
110
+ version: 0.29.0.rc1
111
111
  description: A Blog component for decidim's participatory spaces.
112
112
  email:
113
113
  - isaac.mg@coditramuntana.com
@@ -268,7 +268,7 @@ metadata:
268
268
  funding_uri: https://opencollective.com/decidim
269
269
  homepage_uri: https://decidim.org
270
270
  source_code_uri: https://github.com/decidim/decidim
271
- post_install_message:
271
+ post_install_message:
272
272
  rdoc_options: []
273
273
  require_paths:
274
274
  - lib
@@ -276,15 +276,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
276
276
  requirements:
277
277
  - - "~>"
278
278
  - !ruby/object:Gem::Version
279
- version: 3.1.0
279
+ version: 3.2.0
280
280
  required_rubygems_version: !ruby/object:Gem::Requirement
281
281
  requirements:
282
- - - ">="
282
+ - - ">"
283
283
  - !ruby/object:Gem::Version
284
- version: '0'
284
+ version: 1.3.1
285
285
  requirements: []
286
- rubygems_version: 3.5.9
287
- signing_key:
286
+ rubygems_version: 3.4.10
287
+ signing_key:
288
288
  specification_version: 4
289
289
  summary: Decidim blogs module
290
290
  test_files: []