decidim-blogs 0.23.6 → 0.24.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: 482cd491038de7f4e0be65030447d65d30c20356ba1f11ea4a67c6b78437829f
4
- data.tar.gz: 552dc05de97c4c388625cebf1aef7f0e335a9f743e5971768fbd7e00d2a30b20
3
+ metadata.gz: f70699f2b92d19dd7e5b8b196c39dc51f006640a296bdf8d7c2f1b6fc89cc532
4
+ data.tar.gz: e787f9ed756d8457e5259f4925a87bb04cdd7a780d7c16ec03e163f07d9c517a
5
5
  SHA512:
6
- metadata.gz: dd030679e1f9a4feb6dbda755102e6358f112d79b536455aa90e2c39a548336de4715228bd4985e8c8dba6c66966409b7178b5aa0d72675a783989ed76acdff4
7
- data.tar.gz: 6e58f6dd27a2e8853049e31818fad269650d89631120013076afdedb107ed453313f4fc653a950a23978f8ffeefd014675d126518479f68a0d118fb9516f8d38
6
+ metadata.gz: da8b5c2de02c607a47d6b9191bb33a4784abfd556dc199b3fc3dabe2cfa1b1bd66d05772f06190474b0a3fb2af62ccc7a0789aecbcd3503048f1a4e22bff2977
7
+ data.tar.gz: ca4124a75cc7c4843e8a108468107fd99176d9471fff20bd3026a366a392c764fd83cc128231c1e6efc97bebb863bfccca0aa089321e23a208b6260d7983a7f0
@@ -13,7 +13,7 @@ module Decidim
13
13
 
14
14
  def endorsements_count
15
15
  with_tooltip t("decidim.endorsable.endorsements") do
16
- icon("bullhorn", class: "icon--small") + " " + model.endorsements_count.to_s
16
+ "#{icon("bullhorn", class: "icon--small")} #{model.endorsements_count}"
17
17
  end
18
18
  end
19
19
  end
@@ -26,12 +26,18 @@ module Decidim
26
26
 
27
27
  scope :created_at_desc, -> { order(arel_table[:created_at].desc) }
28
28
 
29
- searchable_fields(
30
- participatory_space: { component: :participatory_space },
31
- A: :title,
32
- D: :body,
33
- datetime: :created_at
34
- )
29
+ searchable_fields({
30
+ participatory_space: { component: :participatory_space },
31
+ A: :title,
32
+ D: :body,
33
+ datetime: :created_at
34
+ },
35
+ index_on_create: true,
36
+ index_on_update: ->(post) { post.visible? })
37
+
38
+ def visible?
39
+ participatory_space.try(:visible?) && component.try(:published?)
40
+ end
35
41
 
36
42
  # Public: Overrides the `commentable?` Commentable concern method.
37
43
  def commentable?
@@ -1,5 +1,5 @@
1
1
  <%= decidim_form_for(@form, html: { class: "form edit_post" }) do |f| %>
2
- <%= render partial: "form", object: f %>
2
+ <%= render partial: "form", object: f, locals: { title: t(".title") } %>
3
3
 
4
4
  <div class="button--double form-general-submit">
5
5
  <%= f.submit t(".save") %>
@@ -29,6 +29,7 @@ ca:
29
29
  success: La publicació s'ha eliminat correctament
30
30
  edit:
31
31
  save: Actualitza
32
+ title: Editar publicació
32
33
  index:
33
34
  title: Publicacions
34
35
  new:
@@ -31,6 +31,7 @@ cs:
31
31
  success: Příspěvek byl úspěšně odstraněn
32
32
  edit:
33
33
  save: Aktualizovat
34
+ title: Upravit příspěvek
34
35
  index:
35
36
  title: Příspěvky
36
37
  new:
@@ -18,7 +18,7 @@ de:
18
18
  admin:
19
19
  models:
20
20
  components:
21
- body: Haupttext
21
+ body: Karosserie
22
22
  post:
23
23
  name: Post
24
24
  posts:
@@ -29,6 +29,7 @@ de:
29
29
  success: Beitrag wurde erfolgreich gelöscht
30
30
  edit:
31
31
  save: Aktualisieren
32
+ title: Post bearbeiten
32
33
  index:
33
34
  title: Beiträge
34
35
  new:
@@ -43,7 +44,7 @@ de:
43
44
  post:
44
45
  fields:
45
46
  author: Autor
46
- body: Haupttext
47
+ body: Karosserie
47
48
  created_at: Hergestellt in
48
49
  title: Titel
49
50
  posts:
@@ -30,6 +30,7 @@ en:
30
30
  success: Post successfully deleted
31
31
  edit:
32
32
  save: Update
33
+ title: Edit post
33
34
  index:
34
35
  title: Posts
35
36
  new:
@@ -29,6 +29,7 @@ es-MX:
29
29
  success: Publicación eliminada con éxito
30
30
  edit:
31
31
  save: Actualizar
32
+ title: Editar publicación
32
33
  index:
33
34
  title: Publicaciones
34
35
  new:
@@ -29,6 +29,7 @@ es-PY:
29
29
  success: Publicación eliminada con éxito
30
30
  edit:
31
31
  save: Actualizar
32
+ title: Editar publicación
32
33
  index:
33
34
  title: Publicaciones
34
35
  new:
@@ -29,6 +29,7 @@ es:
29
29
  success: La publicación se ha eliminado correctamente
30
30
  edit:
31
31
  save: Actualizar
32
+ title: Editar publicación
32
33
  index:
33
34
  title: Publicaciones
34
35
  new:
@@ -29,6 +29,7 @@ fi-pl:
29
29
  success: Artikkeli poistettu onnistuneesti
30
30
  edit:
31
31
  save: Päivitä
32
+ title: Muokkaa artikkelia
32
33
  index:
33
34
  title: Artikkelit
34
35
  new:
@@ -78,7 +79,7 @@ fi-pl:
78
79
  pages:
79
80
  home:
80
81
  statistics:
81
- posts_count: Artikkelit
82
+ posts_count: Artikkeleja
82
83
  participatory_processes:
83
84
  statistics:
84
- posts_count: Artikkelit
85
+ posts_count: Artikkeleja
@@ -29,6 +29,7 @@ fi:
29
29
  success: Artikkelin poisto onnistui
30
30
  edit:
31
31
  save: Päivitä
32
+ title: Muokkaa artikkelia
32
33
  index:
33
34
  title: Artikkelit
34
35
  new:
@@ -78,7 +79,7 @@ fi:
78
79
  pages:
79
80
  home:
80
81
  statistics:
81
- posts_count: Artikkelit
82
+ posts_count: Artikkeleja
82
83
  participatory_processes:
83
84
  statistics:
84
- posts_count: Artikkelit
85
+ posts_count: Artikkelia
@@ -29,6 +29,7 @@ fr-CA:
29
29
  success: Article supprimé avec succès
30
30
  edit:
31
31
  save: Mettre à jour
32
+ title: Éditer le post
32
33
  index:
33
34
  title: Articles
34
35
  new:
@@ -29,6 +29,7 @@ fr:
29
29
  success: Article supprimé avec succès
30
30
  edit:
31
31
  save: Mettre à jour
32
+ title: Éditer le post
32
33
  index:
33
34
  title: Articles
34
35
  new:
@@ -29,6 +29,7 @@ gl:
29
29
  success: Publicación eliminada con éxito
30
30
  edit:
31
31
  save: Actualizar
32
+ title: Editar publicación
32
33
  index:
33
34
  title: Publicacións
34
35
  new:
@@ -51,10 +51,6 @@ is-IS:
51
51
  email_outro: Þú hefur fengið þessa tilkynningu vegna þess að þú fylgist með "%{participatory_space_title}". Þú getur sleppt því frá fyrri tengilinn.
52
52
  email_subject: Ný staða birt í %{participatory_space_title}
53
53
  notification_title: Staða <a href="%{resource_path}">%{resource_title}</a> hefur verið birt í %{participatory_space_title}
54
- pages:
55
- home:
56
- statistics:
57
- posts_count: Innlegg
58
54
  participatory_processes:
59
55
  statistics:
60
56
  posts_count: Innlegg
@@ -28,6 +28,7 @@ ja:
28
28
  success: 投稿を削除しました
29
29
  edit:
30
30
  save: 更新
31
+ title: 投稿を編集
31
32
  index:
32
33
  title: 投稿
33
34
  new:
@@ -29,6 +29,7 @@ nl:
29
29
  success: Post succesvol verwijderd
30
30
  edit:
31
31
  save: Bijwerken
32
+ title: Bericht bewerken
32
33
  index:
33
34
  title: berichten
34
35
  new:
@@ -81,4 +82,4 @@ nl:
81
82
  posts_count: berichten
82
83
  participatory_processes:
83
84
  statistics:
84
- posts_count: berichten
85
+ posts_count: Berichten
@@ -31,6 +31,7 @@ pl:
31
31
  success: Wpis został usunięty
32
32
  edit:
33
33
  save: Aktualizuj
34
+ title: Edytuj wpis
34
35
  index:
35
36
  title: Wpisy
36
37
  new:
@@ -30,6 +30,7 @@ ro:
30
30
  success: Postare stearsa cu succes
31
31
  edit:
32
32
  save: Actualizare
33
+ title: Editează postarea
33
34
  index:
34
35
  title: Mesaje
35
36
  new:
@@ -75,7 +75,7 @@ ru:
75
75
  pages:
76
76
  home:
77
77
  statistics:
78
- posts_count: Посты
78
+ posts_count: Постов
79
79
  participatory_processes:
80
80
  statistics:
81
- posts_count: Посты
81
+ posts_count: Постов
@@ -29,6 +29,7 @@ tr:
29
29
  success: Yayın başarıyla silindi
30
30
  edit:
31
31
  save: Güncelleştirme
32
+ title: Gönderiyi düzenle
32
33
  index:
33
34
  title: Mesajlar
34
35
  new:
@@ -73,7 +73,7 @@ uk:
73
73
  pages:
74
74
  home:
75
75
  statistics:
76
- posts_count: Дописи
76
+ posts_count: Дописів
77
77
  participatory_processes:
78
78
  statistics:
79
- posts_count: Дописи
79
+ posts_count: Дописів
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Blogs
5
+ class BlogsType < Decidim::Api::Types::BaseObject
6
+ implements Decidim::Core::ComponentInterface
7
+
8
+ graphql_name "Blogs"
9
+ description "A blogs component of a participatory space."
10
+
11
+ field :posts, type: Decidim::Blogs::PostType.connection_type, description: "List all posts", connection: true, null: false do
12
+ argument :order, Decidim::Blogs::PostInputSort, "Provides several methods to order the results", required: false
13
+ argument :filter, Decidim::Blogs::PostInputFilter, "Provides several methods to filter the results", required: false
14
+ end
15
+
16
+ field :post, type: Decidim::Blogs::PostType, description: "Finds one post", null: true do
17
+ argument :id, GraphQL::Types::ID, "The ID of the post", required: true
18
+ end
19
+
20
+ def posts(filter: {}, order: {})
21
+ Decidim::Core::ComponentListBase.new(model_class: Post).call(object, { filter: filter, order: order }, context)
22
+ end
23
+
24
+ def post(id:)
25
+ Decidim::Core::ComponentFinderBase.new(model_class: Post).call(object, { id: id }, context)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -9,7 +9,7 @@ module Decidim
9
9
  graphql_name "PostSort"
10
10
  description "A type used for sorting blog posts"
11
11
 
12
- argument :id, String, "Sort by ID, valid values are ASC or DESC", required: false
12
+ argument :id, GraphQL::Types::String, "Sort by ID, valid values are ASC or DESC", required: false
13
13
  end
14
14
  end
15
15
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Blogs
5
+ # This type represents a Post.
6
+ class PostType < Decidim::Api::Types::BaseObject
7
+ implements Decidim::Comments::CommentableInterface
8
+ implements Decidim::Core::AttachableInterface
9
+ implements Decidim::Core::AuthorableInterface
10
+ implements Decidim::Core::TraceableInterface
11
+ implements Decidim::Core::EndorsableInterface
12
+ implements Decidim::Core::TimestampsInterface
13
+
14
+ description "A post"
15
+
16
+ field :id, GraphQL::Types::ID, "The internal ID of this post", null: false
17
+ field :title, Decidim::Core::TranslatedFieldType, "The title for this post", null: true
18
+ field :body, Decidim::Core::TranslatedFieldType, "The body of this post", null: true
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Blogs
5
+ autoload :PostInputSort, "decidim/api/post_input_sort"
6
+ autoload :PostInputFilter, "decidim/api/post_input_filter"
7
+ autoload :PostType, "decidim/api/post_type"
8
+ autoload :BlogsType, "decidim/api/blogs_type"
9
+ end
10
+ end
@@ -77,9 +77,9 @@ Decidim.register_component(:blogs) do |component|
77
77
 
78
78
  params = {
79
79
  component: component,
80
- title: Decidim::Faker::Localized.sentence(5),
80
+ title: Decidim::Faker::Localized.sentence(word_count: 5),
81
81
  body: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
82
- Decidim::Faker::Localized.paragraph(20)
82
+ Decidim::Faker::Localized.paragraph(sentence_count: 20)
83
83
  end,
84
84
  author: author
85
85
  }
@@ -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.23.6"
7
+ "0.24.0.rc1"
8
8
  end
9
9
  end
10
10
  end
data/lib/decidim/blogs.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "decidim/blogs/admin"
4
+ require "decidim/blogs/api"
4
5
  require "decidim/blogs/engine"
5
6
  require "decidim/blogs/admin_engine"
6
7
  require "decidim/blogs/component"
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.23.6
4
+ version: 0.24.0.rc1
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: 2021-05-10 00:00:00.000000000 Z
11
+ date: 2021-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-admin
@@ -16,56 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.23.6
19
+ version: 0.24.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.23.6
26
+ version: 0.24.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.23.6
33
+ version: 0.24.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.23.6
40
+ version: 0.24.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.23.6
47
+ version: 0.24.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.23.6
55
- - !ruby/object:Gem::Dependency
56
- name: httparty
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.17'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.17'
54
+ version: 0.24.0.rc1
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: jquery-tmpl-rails
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -106,56 +92,56 @@ dependencies:
106
92
  requirements:
107
93
  - - '='
108
94
  - !ruby/object:Gem::Version
109
- version: 0.23.6
95
+ version: 0.24.0.rc1
110
96
  type: :development
111
97
  prerelease: false
112
98
  version_requirements: !ruby/object:Gem::Requirement
113
99
  requirements:
114
100
  - - '='
115
101
  - !ruby/object:Gem::Version
116
- version: 0.23.6
102
+ version: 0.24.0.rc1
117
103
  - !ruby/object:Gem::Dependency
118
104
  name: decidim-assemblies
119
105
  requirement: !ruby/object:Gem::Requirement
120
106
  requirements:
121
107
  - - '='
122
108
  - !ruby/object:Gem::Version
123
- version: 0.23.6
109
+ version: 0.24.0.rc1
124
110
  type: :development
125
111
  prerelease: false
126
112
  version_requirements: !ruby/object:Gem::Requirement
127
113
  requirements:
128
114
  - - '='
129
115
  - !ruby/object:Gem::Version
130
- version: 0.23.6
116
+ version: 0.24.0.rc1
131
117
  - !ruby/object:Gem::Dependency
132
118
  name: decidim-dev
133
119
  requirement: !ruby/object:Gem::Requirement
134
120
  requirements:
135
121
  - - '='
136
122
  - !ruby/object:Gem::Version
137
- version: 0.23.6
123
+ version: 0.24.0.rc1
138
124
  type: :development
139
125
  prerelease: false
140
126
  version_requirements: !ruby/object:Gem::Requirement
141
127
  requirements:
142
128
  - - '='
143
129
  - !ruby/object:Gem::Version
144
- version: 0.23.6
130
+ version: 0.24.0.rc1
145
131
  - !ruby/object:Gem::Dependency
146
132
  name: decidim-participatory_processes
147
133
  requirement: !ruby/object:Gem::Requirement
148
134
  requirements:
149
135
  - - '='
150
136
  - !ruby/object:Gem::Version
151
- version: 0.23.6
137
+ version: 0.24.0.rc1
152
138
  type: :development
153
139
  prerelease: false
154
140
  version_requirements: !ruby/object:Gem::Requirement
155
141
  requirements:
156
142
  - - '='
157
143
  - !ruby/object:Gem::Version
158
- version: 0.23.6
144
+ version: 0.24.0.rc1
159
145
  description: A Blog component for decidim's participatory spaces.
160
146
  email:
161
147
  - isaac.mg@coditramuntana.com
@@ -187,10 +173,6 @@ files:
187
173
  - app/models/decidim/blogs/post.rb
188
174
  - app/permissions/decidim/blog/permissions.rb
189
175
  - app/presenters/decidim/blogs/post_presenter.rb
190
- - app/types/decidim/blogs/blogs_type.rb
191
- - app/types/decidim/blogs/post_input_filter.rb
192
- - app/types/decidim/blogs/post_input_sort.rb
193
- - app/types/decidim/blogs/post_type.rb
194
176
  - app/views/decidim/blogs/admin/posts/_form.html.erb
195
177
  - app/views/decidim/blogs/admin/posts/edit.html.erb
196
178
  - app/views/decidim/blogs/admin/posts/index.html.erb
@@ -275,9 +257,14 @@ files:
275
257
  - db/migrate/20200128094730_add_endorsements_counter_cache_to_blogs.rb
276
258
  - db/migrate/20200320105910_index_foreign_keys_in_decidim_blogs_posts.rb
277
259
  - db/migrate/20200827153709_add_commentable_counter_cache_to_posts.rb
260
+ - lib/decidim/api/blogs_type.rb
261
+ - lib/decidim/api/post_input_filter.rb
262
+ - lib/decidim/api/post_input_sort.rb
263
+ - lib/decidim/api/post_type.rb
278
264
  - lib/decidim/blogs.rb
279
265
  - lib/decidim/blogs/admin.rb
280
266
  - lib/decidim/blogs/admin_engine.rb
267
+ - lib/decidim/blogs/api.rb
281
268
  - lib/decidim/blogs/component.rb
282
269
  - lib/decidim/blogs/engine.rb
283
270
  - lib/decidim/blogs/test/factories.rb
@@ -294,14 +281,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
281
  requirements:
295
282
  - - ">="
296
283
  - !ruby/object:Gem::Version
297
- version: '2.6'
284
+ version: '2.7'
298
285
  required_rubygems_version: !ruby/object:Gem::Requirement
299
286
  requirements:
300
- - - ">="
287
+ - - ">"
301
288
  - !ruby/object:Gem::Version
302
- version: '0'
289
+ version: 1.3.1
303
290
  requirements: []
304
- rubygems_version: 3.0.3
291
+ rubygems_version: 3.1.2
305
292
  signing_key:
306
293
  specification_version: 4
307
294
  summary: Decidim blogs module
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Blogs
5
- BlogsType = GraphQL::ObjectType.define do
6
- interfaces [-> { Decidim::Core::ComponentInterface }]
7
-
8
- name "Blogs"
9
- description "A blogs component of a participatory space."
10
-
11
- connection :posts,
12
- type: PostType.connection_type,
13
- description: "List all posts",
14
- function: PostListHelper.new(model_class: Post)
15
- field :post,
16
- type: PostType,
17
- description: "Finds one post",
18
- function: PostFinderHelper.new(model_class: Post)
19
- end
20
-
21
- class PostListHelper < Decidim::Core::ComponentListBase
22
- argument :order, PostInputSort, "Provides several methods to order the results"
23
- argument :filter, PostInputFilter, "Provides several methods to filter the results"
24
- end
25
-
26
- class PostFinderHelper < Decidim::Core::ComponentFinderBase
27
- argument :id, !types.ID, "The ID of the post"
28
- end
29
- end
30
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Blogs
5
- # This type represents a Post.
6
- PostType = GraphQL::ObjectType.define do
7
- interfaces [
8
- -> { Decidim::Comments::CommentableInterface },
9
- -> { Decidim::Core::AttachableInterface },
10
- -> { Decidim::Core::AuthorableInterface },
11
- -> { Decidim::Core::TraceableInterface },
12
- -> { Decidim::Core::EndorsableInterface },
13
- -> { Decidim::Core::TimestampsInterface }
14
- ]
15
-
16
- name "Post"
17
- description "A post"
18
-
19
- field :id, !types.ID, "The internal ID of this post"
20
- field :title, Decidim::Core::TranslatedFieldType, "The title for this post"
21
- field :body, Decidim::Core::TranslatedFieldType, "The body of this post"
22
- end
23
- end
24
- end