decidim-blogs 0.20.0 → 0.23.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/blogs/icon.svg +1 -3
  3. data/app/cells/decidim/blogs/post_m/footer.erb +1 -1
  4. data/app/cells/decidim/blogs/post_m_cell.rb +6 -0
  5. data/app/controllers/decidim/blogs/posts_controller.rb +2 -0
  6. data/app/helpers/decidim/blogs/application_helper.rb +2 -0
  7. data/app/models/decidim/blogs/post.rb +13 -0
  8. data/app/types/decidim/blogs/blogs_type.rb +30 -0
  9. data/app/types/decidim/blogs/post_input_filter.rb +29 -0
  10. data/app/types/decidim/blogs/post_input_sort.rb +15 -0
  11. data/app/types/decidim/blogs/post_type.rb +24 -0
  12. data/app/views/decidim/blogs/posts/_posts.html.erb +4 -4
  13. data/app/views/decidim/blogs/posts/_sidebar_blog.html.erb +2 -2
  14. data/app/views/decidim/blogs/posts/show.html.erb +34 -9
  15. data/config/locales/am-ET.yml +1 -0
  16. data/config/locales/bg-BG.yml +13 -0
  17. data/config/locales/bg.yml +13 -0
  18. data/config/locales/ca.yml +5 -0
  19. data/config/locales/cs.yml +17 -12
  20. data/config/locales/da-DK.yml +1 -0
  21. data/config/locales/da.yml +1 -0
  22. data/config/locales/de.yml +5 -0
  23. data/config/locales/el-GR.yml +1 -0
  24. data/config/locales/el.yml +84 -0
  25. data/config/locales/en.yml +5 -0
  26. data/config/locales/eo.yml +1 -0
  27. data/config/locales/es-MX.yml +5 -0
  28. data/config/locales/es-PY.yml +5 -0
  29. data/config/locales/es.yml +5 -0
  30. data/config/locales/et-EE.yml +1 -0
  31. data/config/locales/et.yml +1 -0
  32. data/config/locales/fi-plain.yml +5 -0
  33. data/config/locales/fi.yml +9 -4
  34. data/config/locales/fr-CA.yml +84 -0
  35. data/config/locales/fr.yml +5 -0
  36. data/config/locales/ga-IE.yml +1 -0
  37. data/config/locales/hr-HR.yml +1 -0
  38. data/config/locales/hr.yml +1 -0
  39. data/config/locales/hu.yml +4 -0
  40. data/config/locales/is-IS.yml +56 -0
  41. data/config/locales/is.yml +56 -0
  42. data/config/locales/it.yml +5 -0
  43. data/config/locales/ja-JP.yml +83 -0
  44. data/config/locales/ja.yml +83 -0
  45. data/config/locales/ko-KR.yml +1 -0
  46. data/config/locales/ko.yml +1 -0
  47. data/config/locales/lt-LT.yml +1 -0
  48. data/config/locales/lt.yml +1 -0
  49. data/config/locales/lv.yml +84 -0
  50. data/config/locales/mt-MT.yml +1 -0
  51. data/config/locales/mt.yml +1 -0
  52. data/config/locales/nl.yml +5 -0
  53. data/config/locales/no.yml +58 -0
  54. data/config/locales/om-ET.yml +1 -0
  55. data/config/locales/pl.yml +34 -29
  56. data/config/locales/pt-BR.yml +1 -1
  57. data/config/locales/pt.yml +29 -24
  58. data/config/locales/ro-RO.yml +85 -0
  59. data/config/locales/sk-SK.yml +85 -0
  60. data/config/locales/sk.yml +85 -0
  61. data/config/locales/sl.yml +5 -0
  62. data/config/locales/so-SO.yml +1 -0
  63. data/config/locales/sr-CS.yml +13 -0
  64. data/config/locales/sv.yml +5 -0
  65. data/config/locales/ti-ER.yml +1 -0
  66. data/config/locales/vi-VN.yml +1 -0
  67. data/config/locales/vi.yml +1 -0
  68. data/config/locales/zh-CN.yml +83 -0
  69. data/config/locales/zh-TW.yml +1 -0
  70. data/db/migrate/20191212162606_add_user_group_author_to_blogs.rb +7 -0
  71. data/db/migrate/20200128094730_add_endorsements_counter_cache_to_blogs.rb +7 -0
  72. data/db/migrate/20200320105910_index_foreign_keys_in_decidim_blogs_posts.rb +7 -0
  73. data/db/migrate/20200827153709_add_commentable_counter_cache_to_posts.rb +9 -0
  74. data/lib/decidim/blogs/component.rb +8 -0
  75. data/lib/decidim/blogs/test/factories.rb +8 -0
  76. data/lib/decidim/blogs/version.rb +1 -1
  77. metadata +72 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73e3339541c096ebf9970ac323bb5321eeb5a2182904552f2773a2850661d37c
4
- data.tar.gz: 1d3e77a1259e7ec6e8a60ab8219f590d958dbe7418e5c77224bc04aae09958a7
3
+ metadata.gz: f33707aec62e2bfc5594c267cf05137403d15b420458ff513945f39334da9d15
4
+ data.tar.gz: 9c465751b57fd23b22f5607f305dad1f1d53510c4f68b27658eabcac8bf7597d
5
5
  SHA512:
6
- metadata.gz: 1d692af5bb3b3d567651537702564df8c59dd7db6978bd1b0ba11dd17400c36e9b930fa35d09e2c9e5ee9293ac5fc9526a2609cac31684bbbb6e15e37e2c0c69
7
- data.tar.gz: e31bceea7d7fc3a5973ca2a4f198d0aa0059b1342a68c984f44f80ecfb8855c2cd7d1e46d08a6a271ec7fa5a3d6288a6c7eec9fefea2ca4212d1c86fe442db3d
6
+ metadata.gz: a3bd384e798fda1c6958ce686c0ea1a0d9b4ae44ce7ec5b14091fabb3f441c5f42967421bba3e21965ef4d824bcb5af5522be34620e553bbac37a8289bdea7cb
7
+ data.tar.gz: aaa253b8f325cf09163ea3e198bd50d91cf4de7c251e405ba19a7ca4f6ba08808ea9619f2bafd8557e84843f2006f64d2427416ae458895ecf3498b73a3ec29a
@@ -1,3 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36">
2
- <path d="M18 0C8.07 0 0 8.07 0 18s8.07 18 18 18 18-8.071 18-18S27.93 0 18 0zm0 2c8.85 0 16 7.152 16 16 0 8.848-7.15 16-16 16-8.848 0-16-7.152-16-16C2 9.152 9.152 2 18 2zm-7 9a1 1 0 1 0 0 2h14a1 1 0 1 0 0-2H11zm0 4a1 1 0 1 0 0 2h10a1 1 0 1 0 0-2H11zm0 4a1 1 0 1 0 0 2h14a1 1 0 1 0 0-2H11zm0 4a1 1 0 1 0 0 2h10a1 1 0 1 0 0-2H11z"/>
3
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><path d="M18 0C8.07 0 0 8.07 0 18s8.07 18 18 18 18-8.071 18-18S27.93 0 18 0zm0 2c8.85 0 16 7.152 16 16 0 8.848-7.15 16-16 16-8.848 0-16-7.152-16-16C2 9.152 9.152 2 18 2zm-7 9a1 1 0 1 0 0 2h14a1 1 0 1 0 0-2H11zm0 4a1 1 0 1 0 0 2h10a1 1 0 1 0 0-2H11zm0 4a1 1 0 1 0 0 2h14a1 1 0 1 0 0-2H11zm0 4a1 1 0 1 0 0 2h10a1 1 0 1 0 0-2H11z"/></svg>
@@ -1,5 +1,5 @@
1
1
  <div class="card__footer card__footer--spaces">
2
2
  <div class="card__support">
3
- <%= link_to t("decidim.blogs.posts.show.view"), resource_path, class: "card__button button--sc light button small secondary" %>
3
+ <%= link_to t("decidim.blogs.posts.show.view"), resource_path, class: "card__button button--sc light button small" %>
4
4
  </div>
5
5
  </div>
@@ -10,6 +10,12 @@ module Decidim
10
10
  def has_actions?
11
11
  false
12
12
  end
13
+
14
+ def endorsements_count
15
+ with_tooltip t("decidim.endorsable.endorsements") do
16
+ icon("bullhorn", class: "icon--small") + " " + model.endorsements_count.to_s
17
+ end
18
+ end
13
19
  end
14
20
  end
15
21
  end
@@ -4,6 +4,8 @@ module Decidim
4
4
  module Blogs
5
5
  # Exposes the blog resource so users can view them
6
6
  class PostsController < Decidim::Blogs::ApplicationController
7
+ include Flaggable
8
+
7
9
  helper_method :posts, :post, :paginate_posts, :posts_most_commented
8
10
 
9
11
  def index; end
@@ -8,6 +8,8 @@ module Decidim
8
8
  include PaginateHelper
9
9
  include SanitizeHelper
10
10
  include Decidim::Blogs::PostsHelper
11
+ include ::Decidim::EndorsableHelper
12
+ include ::Decidim::FollowableHelper
11
13
  include Decidim::Comments::CommentsHelper
12
14
  end
13
15
  end
@@ -12,11 +12,16 @@ module Decidim
12
12
  include Decidim::Authorable
13
13
  include Decidim::Comments::Commentable
14
14
  include Decidim::Searchable
15
+ include Decidim::Endorsable
16
+ include Decidim::Followable
17
+ include Decidim::TranslatableResource
15
18
  include Traceable
16
19
  include Loggable
17
20
 
18
21
  component_manifest_name "blogs"
19
22
 
23
+ translatable_fields :title, :body
24
+
20
25
  validates :title, presence: true
21
26
 
22
27
  scope :created_at_desc, -> { order(arel_table[:created_at].desc) }
@@ -56,6 +61,14 @@ module Decidim
56
61
  def user_allowed_to_comment?(user)
57
62
  can_participate_in_space?(user)
58
63
  end
64
+
65
+ def users_to_notify_on_comment_created
66
+ followers
67
+ end
68
+
69
+ def attachment_context
70
+ :admin
71
+ end
59
72
  end
60
73
  end
61
74
  end
@@ -0,0 +1,30 @@
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
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Blogs
5
+ class PostInputFilter < Decidim::Core::BaseInputFilter
6
+ include Decidim::Core::HasTimestampInputFilter
7
+
8
+ graphql_name "PostFilter"
9
+ description "A type used for filtering posts inside a participatory space.
10
+
11
+ A typical query would look like:
12
+
13
+ ```
14
+ {
15
+ participatoryProcesses {
16
+ components {
17
+ ...on Blogs {
18
+ posts(filter:{ createdBefore: \"2020-01-01\" }) {
19
+ id
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
25
+ ```
26
+ "
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Blogs
5
+ class PostInputSort < Decidim::Core::BaseInputSort
6
+ include Decidim::Core::HasTimestampInputSort
7
+ include Decidim::Core::HasEndorsableInputSort
8
+
9
+ graphql_name "PostSort"
10
+ description "A type used for sorting blog posts"
11
+
12
+ argument :id, String, "Sort by ID, valid values are ASC or DESC", required: false
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,24 @@
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
@@ -1,12 +1,12 @@
1
1
  <div class="row small-12">
2
2
  <% paginate_posts.each do |post| %>
3
- <article class="card card--post">
3
+ <div class="card card--post">
4
4
  <div class="card__content">
5
5
  <div class="card__header">
6
6
  <%= link_to post, class: "card__link" do %>
7
- <h5 class="card__title">
7
+ <h3 class="card__title">
8
8
  <%= translated_attribute post.title %>
9
- </h5>
9
+ </h3>
10
10
  <% end %>
11
11
  <div class="card__author">
12
12
  <%= cell "decidim/author", present(post.author), from: post %>
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
  <%= decidim_sanitize post_description(post) %>
16
16
  </div>
17
- </article>
17
+ </div>
18
18
  <% end %>
19
19
  </div>
20
20
  <%= decidim_paginate paginate_posts %>
@@ -9,8 +9,8 @@
9
9
  <div class="author-data author-data--nopadding">
10
10
  <%= render partial: "datetime", locals: { post: post } %>&nbsp;&nbsp;·&nbsp;&nbsp;
11
11
  <%= link_to "#{post_path(post)}#comments", title: t(".comments") do %>
12
- <%= icon "comment-square", class: "icon--small", aria_label: "#{t(".comments")}", role: "img" %>
13
- <%= post.comments.count %>
12
+ <%= icon "comment-square", class: "icon--small", aria_label: t(".comments"), role: "img" %>
13
+ <%= post.comments_count %>
14
14
  <%= t(".comments") %>
15
15
  <% end %>
16
16
  <a href="#comments" title="<%= t(".comments") %>"></a>
@@ -14,18 +14,43 @@
14
14
  blogpost: post
15
15
  )
16
16
  %>
17
+
18
+ <div class="row column view-header">
19
+ <%= link_to :posts, class: "small hollow" do %>
20
+ <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
21
+ <%= t(".back") %>
22
+ <% end %>
23
+ <h2 class="heading2"><%= translated_attribute post.title %></h2>
24
+ <%= cell "decidim/author", present(post.author), from: post %>
25
+ </div>
17
26
  <div class="row">
18
- <div class="columns medium-7 mediumlarge-8">
19
- <div class="row column view-header">
20
- <h2 class="heading2"><%= translated_attribute post.title %></h2>
21
- <%= cell "decidim/author", present(post.author), from: post %>
22
- </div>
27
+ <% if show_endorsements_card? %>
28
+ <div class="columns section view-side mediumlarge-4 mediumlarge-push-8 large-3 large-push-9">
29
+ <div class="card">
30
+ <div class="card__content">
31
+ <div class="row collapse buttons__row">
32
+ <% if endorsements_enabled? %>
33
+ <div class="column small-9 collapse">
34
+ <%= endorsement_buttons_cell(post) %>
35
+ </div>
36
+ <% end %>
37
+ <div class="column collapse <%= endorsements_enabled? ? "small-3" : "" %>">
38
+ <%= link_to "#comments", class: "button small compact hollow button--nomargin expanded" do %>
39
+ <%= icon "comment-square", class: "icon--small", aria_label: t(".comments"), role: "img" %> <%= post.comments_count %>
40
+ <% end %>
41
+ </div>
42
+ </div>
43
+ <br>
44
+ <%= follow_button_for(post) %>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ <% end %>
49
+ <div class="columns mediumlarge-8 mediumlarge-pull-4">
23
50
  <div class="section">
24
- <p><%= decidim_sanitize translated_attribute post.body %></p>
51
+ <%= decidim_sanitize translated_attribute post.body %>
25
52
  </div>
26
- </div>
27
- <div id="most-commented" class="columns medium-5 mediumlarge-4 large-4">
28
- <%= render partial: "sidebar_blog", locals: { posts: posts_most_commented } %>
53
+ <%= cell "decidim/endorsers_list", post %>
29
54
  </div>
30
55
  </div>
31
56
  <%= attachments_for post %>
@@ -0,0 +1 @@
1
+ am:
@@ -0,0 +1,13 @@
1
+ bg:
2
+ activemodel:
3
+ models:
4
+ decidim/blogs/create_post_event: Нова блог публикация
5
+ activerecord:
6
+ models:
7
+ decidim/blogs/post:
8
+ one: Публикация
9
+ other: Публикации
10
+ decidim:
11
+ blogs:
12
+ actions:
13
+ confirm_destroy: Сигурни ли сте, че желаете да изтриете тази публикация?
@@ -0,0 +1,13 @@
1
+ bg:
2
+ activemodel:
3
+ models:
4
+ decidim/blogs/create_post_event: Нова блог публикация
5
+ activerecord:
6
+ models:
7
+ decidim/blogs/post:
8
+ one: Публикация
9
+ other: Публикации
10
+ decidim:
11
+ blogs:
12
+ actions:
13
+ confirm_destroy: Сигурни ли сте, че желаете да изтриете тази публикация?
@@ -48,6 +48,8 @@ ca:
48
48
  title: títol
49
49
  posts:
50
50
  show:
51
+ back: Tornar al llistat
52
+ comments: Comentaris
51
53
  view: Veure
52
54
  sidebar_blog:
53
55
  comments: comentaris
@@ -60,9 +62,12 @@ ca:
60
62
  global:
61
63
  announcement: Avís
62
64
  comments_enabled: Comentaris habilitats
65
+ comments_max_length: Longitud màxima dels comentaris (deixa 0 si vols mantenir la configuració per defecte)
63
66
  step:
64
67
  announcement: Avís
65
68
  comments_blocked: Comentaris bloquejats
69
+ endorsements_blocked: Adhesions bloquejades
70
+ endorsements_enabled: Adhesions habilitades
66
71
  events:
67
72
  blogs:
68
73
  post_created:
@@ -13,7 +13,7 @@ cs:
13
13
  blogs:
14
14
  actions:
15
15
  confirm_destroy: Opravdu chcete tento příspěvek smazat?
16
- destroy: Odstranit
16
+ destroy: Smazat
17
17
  edit: Upravit
18
18
  new: Nový příspěvek
19
19
  title: Akce
@@ -22,23 +22,23 @@ cs:
22
22
  components:
23
23
  body: Tělo
24
24
  post:
25
- name: Pošta
25
+ name: Příspěvek
26
26
  posts:
27
27
  create:
28
28
  invalid: Při vytváření tohoto příspěvku došlo k potížím
29
- success: Pošta byla úspěšně vytvořena
29
+ success: Příspěvek byl úspěšně vytvořen
30
30
  destroy:
31
- success: Pošta byla úspěšně smazána
31
+ success: Příspěvek byl úspěšně odstraněn
32
32
  edit:
33
- save: Aktualizace
33
+ save: Aktualizovat
34
34
  index:
35
35
  title: Příspěvky
36
36
  new:
37
37
  create: Vytvořit
38
- title: Vytvořte příspěvek
38
+ title: Vytvořit příspěvek
39
39
  update:
40
40
  invalid: Při ukládání příspěvku došlo k chybám.
41
- success: Úspěšně uložen příspěvek
41
+ success: Příspěvek byl úspěšně uložen
42
42
  last_activity:
43
43
  new_post_at_html: "<span>Nový příspěvek v %{link}</span>"
44
44
  models:
@@ -46,11 +46,13 @@ cs:
46
46
  fields:
47
47
  author: Autor
48
48
  body: Tělo
49
- created_at: Vytvořeno u
50
- title: titul
49
+ created_at: Vytvořeno v
50
+ title: titulek
51
51
  posts:
52
52
  show:
53
- view: Pohled
53
+ back: Zpět na seznam
54
+ comments: Komentáře
55
+ view: Zobrazit
54
56
  sidebar_blog:
55
57
  comments: komentáře
56
58
  most_commented_posts: Nejvíce komentované příspěvky
@@ -62,14 +64,17 @@ cs:
62
64
  global:
63
65
  announcement: Oznámení
64
66
  comments_enabled: Komentáře povoleny
67
+ comments_max_length: Maximální délka komentáře (ponechte 0 pro výchozí hodnotu)
65
68
  step:
66
69
  announcement: Oznámení
67
70
  comments_blocked: Komentáře byly blokovány
71
+ endorsements_blocked: Schvalování blokováno
72
+ endorsements_enabled: Schvalování povoleno
68
73
  events:
69
74
  blogs:
70
75
  post_created:
71
- email_intro: Písmeno "%{resource_title}" bylo zveřejněno v "%{participatory_space_title}", které sledujete.
72
- email_outro: Toto oznámení jste obdrželi, protože jste sledovali "%{participatory_space_title}". Můžete jej odhlásit od předchozího odkazu.
76
+ email_intro: Příspěvek "%{resource_title}" byl zveřejněn v "%{participatory_space_title}", který sledujete.
77
+ email_outro: Obdrželi jste toto oznámení, protože sledujete "%{participatory_space_title}". Můžete ho zrušit z předchozího odkazu.
73
78
  email_subject: Nový příspěvek publikován v %{participatory_space_title}
74
79
  notification_title: Příspěvek <a href="%{resource_path}">%{resource_title}</a> byl zveřejněn ve %{participatory_space_title}
75
80
  pages:
@@ -0,0 +1 @@
1
+ da:
@@ -0,0 +1 @@
1
+ da:
@@ -48,6 +48,8 @@ de:
48
48
  title: Titel
49
49
  posts:
50
50
  show:
51
+ back: Zurück zur Liste
52
+ comments: Kommentare
51
53
  view: Aussicht
52
54
  sidebar_blog:
53
55
  comments: Bemerkungen
@@ -60,9 +62,12 @@ de:
60
62
  global:
61
63
  announcement: Ankündigung
62
64
  comments_enabled: Kommentare aktiviert
65
+ comments_max_length: Maximale Länge der Kommentare (0 für Standardwert)
63
66
  step:
64
67
  announcement: Ankündigung
65
68
  comments_blocked: Kommentare blockiert
69
+ endorsements_blocked: Unterstützung deaktiviert
70
+ endorsements_enabled: Unterstützung aktiviert
66
71
  events:
67
72
  blogs:
68
73
  post_created:
@@ -0,0 +1 @@
1
+ el: