decidim-blogs 0.14.4 → 0.15.0

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: 9f7cb0bc5a3825f3c2d59a74da50b9211eef7029288256714d69b26ddcf2c312
4
- data.tar.gz: d0099007952813c0d07638a00487d10ed9f64d905e6ec4f07b93dbd224b03e97
3
+ metadata.gz: ac5af838f71ba4a699a05cc6dfe4fe947a66fa9936f72a0de01c0a92e12f5882
4
+ data.tar.gz: 435cef43067070627ed83f7a1ac852210c7b081b0f7cfcab759af827fb3964b6
5
5
  SHA512:
6
- metadata.gz: f2c2c986870e07124e856ff24d72c8aa58facf8d82eb6498ecf9bca9fc95fc6e637f6aaede694aee2538329175c31fbcac69d5704ace2dafd2138eb52fbb591a
7
- data.tar.gz: b679de19a84eca7777c21a2451f3d2e478bba7cb8b831ab17210e8df3eba6645746f85ac26ad9ef18291dbce94c111ca435880c85597386b5c1143de371d2f5d
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
- @post = Post.create!(
31
+ attributes = {
32
32
  title: @form.title,
33
33
  body: @form.body,
34
34
  component: @form.current_component,
35
- decidim_author_id: @current_user.id
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
 
@@ -9,6 +9,8 @@ module Decidim
9
9
  include Decidim::HasComponent
10
10
  include Decidim::Authorable
11
11
  include Decidim::Comments::Commentable
12
+ include Traceable
13
+ include Loggable
12
14
 
13
15
  component_manifest_name "blogs"
14
16
 
@@ -37,6 +37,8 @@ ca:
37
37
  update:
38
38
  invalid: Hi ha hagut errors en desar la publicació.
39
39
  success: La publicació s'ha desat correctament
40
+ last_activity:
41
+ new_post_at_html: "<span>Nova publicació a %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ de:
37
37
  update:
38
38
  invalid: Beim Speichern des Posts sind Fehler aufgetreten.
39
39
  success: Beitrag wurde erfolgreich gespeichert
40
+ last_activity:
41
+ new_post_at_html: "<span>Neuer Beitrag bei %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -38,6 +38,8 @@ en:
38
38
  update:
39
39
  invalid: There's been errors when saving the post.
40
40
  success: Post saved successfully
41
+ last_activity:
42
+ new_post_at_html: "<span>New post at %{link}</span>"
41
43
  models:
42
44
  post:
43
45
  fields:
@@ -37,6 +37,8 @@ es-PY:
37
37
  update:
38
38
  invalid: Ha habido errores al guardar la publicación.
39
39
  success: Publicación guardada con éxito
40
+ last_activity:
41
+ new_post_at_html: "<span>Nueva publicación en %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ es:
37
37
  update:
38
38
  invalid: Ha habido errores al guardar la publicación.
39
39
  success: Publicación guardada con éxito
40
+ last_activity:
41
+ new_post_at_html: "<span>Nueva publicación en %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ eu:
37
37
  update:
38
38
  invalid: Erroreak gertatu dira mezua gordetzean.
39
39
  success: Mezua ondo gorde da
40
+ last_activity:
41
+ new_post_at_html: "<span>Post berria %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ fi:
37
37
  update:
38
38
  invalid: Artikkelin tallennuksessa tapahtui virheitä.
39
39
  success: Artikkeli tallennettu onnistuneesti
40
+ last_activity:
41
+ new_post_at_html: "<span>Uusi artikkeli osoitteessa %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ fr:
37
37
  update:
38
38
  invalid: Il y a eu des erreurs lors de l'enregistrement de l'article.
39
39
  success: Article enregistré avec succès
40
+ last_activity:
41
+ new_post_at_html: "<span>Nouveau post à %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ gl:
37
37
  update:
38
38
  invalid: Produciuse un erro ao gardar a publicación.
39
39
  success: Publicouse o envío con éxito
40
+ last_activity:
41
+ new_post_at_html: "<span>Nova publicación en %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ hu:
37
37
  update:
38
38
  invalid: Hiba történt a bejegyzés mentése során.
39
39
  success: Bejegyzés mentése sikeres
40
+ last_activity:
41
+ new_post_at_html: "<span>Új hozzászólás %{link}</span>kor"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ it:
37
37
  update:
38
38
  invalid: Si sono verificati errori durante il salvataggio del post.
39
39
  success: Post salvato correttamente
40
+ last_activity:
41
+ new_post_at_html: "<span>Nuovo post a %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ nl:
37
37
  update:
38
38
  invalid: Er zijn fouten opgetreden bij het opslaan van het bericht.
39
39
  success: Bericht succesvol opgeslagen
40
+ last_activity:
41
+ new_post_at_html: "<span>Nieuw bericht op %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -39,6 +39,8 @@ pl:
39
39
  update:
40
40
  invalid: Podczas zapisywania posta wystąpiły błędy.
41
41
  success: Zapis został pomyślnie zapisany
42
+ last_activity:
43
+ new_post_at_html: "<span>Nowy post na %{link}</span>"
42
44
  models:
43
45
  post:
44
46
  fields:
@@ -37,6 +37,8 @@ pt-BR:
37
37
  update:
38
38
  invalid: Falha ao salvar o post.
39
39
  success: Post salvo com sucesso
40
+ last_activity:
41
+ new_post_at_html: "<span>Nova postagem em %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ pt:
37
37
  update:
38
38
  invalid: Houve erros ao salvar a postagem.
39
39
  success: Post salvo com sucesso
40
+ last_activity:
41
+ new_post_at_html: "<span>Novo post em %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -37,6 +37,8 @@ sv:
37
37
  update:
38
38
  invalid: Det har blivit fel när du sparar inlägget.
39
39
  success: Inlägget sparades framgångsrikt
40
+ last_activity:
41
+ new_post_at_html: "<span>Ny inlägg på %{link}</span>"
40
42
  models:
41
43
  post:
42
44
  fields:
@@ -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
- component = Decidim::Component.create!(
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
- post = Decidim::Blogs::Post.create!(
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 { Decidim::Faker::Localized.sentence(3) }
16
- body { Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(4) } }
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
@@ -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.14.4"
7
+ "0.15.0"
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.14.4
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-10-24 00:00:00.000000000 Z
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.14.4
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.7
239
+ rubygems_version: 2.7.6
238
240
  signing_key:
239
241
  specification_version: 4
240
242
  summary: Decidim blogs module