decidim-debates 0.11.2 → 0.12.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/debates/debate_cell.rb +22 -0
  3. data/app/cells/decidim/debates/debate_m/footer.erb +5 -0
  4. data/app/cells/decidim/debates/debate_m_cell.rb +42 -0
  5. data/app/controllers/decidim/debates/admin/debates_controller.rb +15 -4
  6. data/app/controllers/decidim/debates/debates_controller.rb +3 -2
  7. data/app/helpers/decidim/debates/debate_cells_helper.rb +12 -0
  8. data/app/permissions/decidim/debates/admin/permissions.rb +30 -0
  9. data/app/permissions/decidim/debates/permissions.rb +31 -0
  10. data/app/views/decidim/debates/admin/debates/index.html.erb +3 -3
  11. data/app/views/decidim/debates/debates/_debate.html.erb +1 -42
  12. data/app/views/decidim/debates/debates/show.html.erb +3 -16
  13. data/config/locales/ca.yml +9 -6
  14. data/config/locales/en.yml +9 -6
  15. data/config/locales/es.yml +9 -6
  16. data/config/locales/eu.yml +9 -6
  17. data/config/locales/fi.yml +9 -6
  18. data/config/locales/fr.yml +9 -6
  19. data/config/locales/gl.yml +9 -6
  20. data/config/locales/it.yml +9 -6
  21. data/config/locales/nl.yml +10 -7
  22. data/config/locales/pl.yml +11 -3
  23. data/config/locales/pt-BR.yml +9 -6
  24. data/config/locales/pt.yml +9 -6
  25. data/config/locales/ru.yml +61 -0
  26. data/config/locales/sv.yml +9 -6
  27. data/config/locales/uk.yml +14 -11
  28. data/lib/decidim/debates/admin_engine.rb +0 -10
  29. data/lib/decidim/debates/component.rb +3 -1
  30. data/lib/decidim/debates/engine.rb +5 -6
  31. data/lib/decidim/debates/version.rb +1 -1
  32. metadata +18 -16
  33. data/app/models/decidim/debates/abilities/admin/admin_ability.rb +0 -21
  34. data/app/models/decidim/debates/abilities/admin/participatory_process_admin_ability.rb +0 -23
  35. data/app/models/decidim/debates/abilities/admin/participatory_process_moderator_ability.rb +0 -21
  36. data/app/models/decidim/debates/abilities/current_user_ability.rb +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90ea5c9a6374ff7afaea5c66e2c5d35b302cabe84d1b981aeb94b2114ec7d8ec
4
- data.tar.gz: 77577372b38ac48b22ff1087a91d0580e1640bba2e14bc0ddcc420b353deed75
3
+ metadata.gz: 17b015a50338b364f276f4b8bc4a43e2d10acc39f4584ca70950876729d11a3a
4
+ data.tar.gz: 64d37f3b5772ddb123d2c1ccd6e92255ab14d86bae5a586e3852a71403acd058
5
5
  SHA512:
6
- metadata.gz: 2352dc5bacfb501f178c2b3b09cd32a5e2f72369f36350a14b32699d0249ddaa4ddf859e6ecf11e0f20c4647302bcf783995793ad2e13b12cee8ae435191bad7
7
- data.tar.gz: 2abd2557969f14d07d678eefc50d960757775930a85bfa6977709ac0daa9f42b023be183e567aef2ab4691ffb7f688cc4b5c4ac8ab892c4c1c7a925215984743
6
+ metadata.gz: 1d7164cf538628de8a26642638dd8066b1a73fa351235ce09215e66c3e6ee1cccd90ad269fc6c2f0fb29ae3af7b6f451d3511780ff480dff10a5cbc8f944abb1
7
+ data.tar.gz: b68f8c35afab244a77df435b996d707cb2b335e9c208242d151a8eddf9aea7fde63aabbfb26ba4f64a50ec3ecb1ae3ef36b041bcf2e39baf54665781a4a091ea
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ # This cell renders the debate card for an instance of a Debate
6
+ # the default size is the Medium Card (:m)
7
+ class DebateCell < Decidim::ViewModel
8
+ include DebateCellsHelper
9
+ include Cell::ViewModel::Partial
10
+
11
+ def show
12
+ cell card_size, model
13
+ end
14
+
15
+ private
16
+
17
+ def card_size
18
+ "decidim/debates/debate_m"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ <div class="card__footer">
2
+ <div class="card__support">
3
+ <%= link_to t("participate", scope: "decidim.debates.debates.debate"), resource_path, class: "card__button button secondary button--sc small light" %>
4
+ </div>
5
+ </div>
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ # This cell renders the Medium (:m) debate card
6
+ # for an given instance of a Debate
7
+ class DebateMCell < Decidim::CardMCell
8
+ include DebateCellsHelper
9
+
10
+ private
11
+
12
+ def resource_icon
13
+ icon "debates", class: "icon--big"
14
+ end
15
+
16
+ def spans_multiple_dates?
17
+ start_date != end_date
18
+ end
19
+
20
+ def debate_date
21
+ return render(:multiple_dates) if spans_multiple_dates?
22
+ render(:single_date)
23
+ end
24
+
25
+ def formatted_start_time
26
+ model.start_time.strftime("%H:%M")
27
+ end
28
+
29
+ def formatted_end_time
30
+ model.end_time.strftime("%H:%M")
31
+ end
32
+
33
+ def start_date
34
+ model.start_time.to_date
35
+ end
36
+
37
+ def end_date
38
+ model.end_time.to_date
39
+ end
40
+ end
41
+ end
42
+ end
@@ -4,14 +4,22 @@ module Decidim
4
4
  module Debates
5
5
  module Admin
6
6
  # This controller allows an admin to manage debates from a Participatory Space
7
- class DebatesController < Admin::ApplicationController
7
+ class DebatesController < Decidim::Debates::Admin::ApplicationController
8
8
  helper_method :debates
9
9
 
10
+ def index
11
+ enforce_permission_to :read, :debate
12
+ end
13
+
10
14
  def new
15
+ enforce_permission_to :create, :debate
16
+
11
17
  @form = form(Decidim::Debates::Admin::DebateForm).instance
12
18
  end
13
19
 
14
20
  def create
21
+ enforce_permission_to :create, :debate
22
+
15
23
  @form = form(Decidim::Debates::Admin::DebateForm).from_params(params, current_component: current_component)
16
24
 
17
25
  CreateDebate.call(@form) do
@@ -28,12 +36,14 @@ module Decidim
28
36
  end
29
37
 
30
38
  def edit
31
- authorize! :edit, debate
39
+ enforce_permission_to :update, :debate, debate: debate
40
+
32
41
  @form = form(DebateForm).from_model(debate)
33
42
  end
34
43
 
35
44
  def update
36
- authorize! :edit, debate
45
+ enforce_permission_to :update, :debate, debate: debate
46
+
37
47
  @form = form(DebateForm).from_params(params, current_component: current_component)
38
48
 
39
49
  UpdateDebate.call(@form, debate) do
@@ -50,7 +60,8 @@ module Decidim
50
60
  end
51
61
 
52
62
  def destroy
53
- authorize! :destroy, debate
63
+ enforce_permission_to :delete, :debate, debate: debate
64
+
54
65
  debate.destroy!
55
66
 
56
67
  flash[:notice] = I18n.t("debates.destroy.success", scope: "decidim.debates.admin")
@@ -13,13 +13,14 @@ module Decidim
13
13
  helper_method :debates, :debate, :paginated_debates, :report_form
14
14
 
15
15
  def new
16
- authorize! :create, Debate
16
+ enforce_permission_to :create, :debate
17
17
 
18
18
  @form = form(DebateForm).instance
19
19
  end
20
20
 
21
21
  def create
22
- authorize! :create, Debate
22
+ enforce_permission_to :create, :debate
23
+
23
24
  @form = form(DebateForm).from_params(params, current_component: current_component)
24
25
 
25
26
  CreateDebate.call(@form) do
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ # Custom helpers for debates cells.
6
+ #
7
+ module DebateCellsHelper
8
+ include PaginateHelper
9
+ include Decidim::Comments::CommentsHelper
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ module Admin
6
+ class Permissions < Decidim::DefaultPermissions
7
+ def permissions
8
+ # The public part needs to be implemented yet
9
+ return permission_action if permission_action.scope != :admin
10
+ return permission_action if permission_action.subject != :debate
11
+
12
+ case permission_action.action
13
+ when :create, :read
14
+ allow!
15
+ when :update, :delete
16
+ toggle_allow(debate && debate.official?)
17
+ end
18
+
19
+ permission_action
20
+ end
21
+
22
+ private
23
+
24
+ def debate
25
+ @debate ||= context.fetch(:debate, nil)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ class Permissions < Decidim::DefaultPermissions
6
+ def permissions
7
+ # Delegate the admin permission checks to the admin permissions class
8
+ return Decidim::Debates::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin
9
+ return permission_action if permission_action.scope != :public
10
+
11
+ return permission_action if permission_action.subject != :debate
12
+
13
+ case permission_action.action
14
+ when :create
15
+ toggle_allow(can_create_debate?)
16
+ when :report
17
+ allow!
18
+ end
19
+
20
+ permission_action
21
+ end
22
+
23
+ private
24
+
25
+ def can_create_debate?
26
+ authorized?(:create) &&
27
+ current_settings&.creation_enabled?
28
+ end
29
+ end
30
+ end
31
+ end
@@ -3,7 +3,7 @@
3
3
  <h2 class="card-title">
4
4
  <%= t(".title") %>
5
5
 
6
- <%= link_to t("actions.new", scope: "decidim.debates", name: t("models.debate.name", scope: "decidim.debates.admin")), new_debate_path, class: "button tiny button--title" if can? :manage, current_component %>
6
+ <%= link_to t("actions.new", scope: "decidim.debates", name: t("models.debate.name", scope: "decidim.debates.admin")), new_debate_path, class: "button tiny button--title" if allowed_to? :create, :debate %>
7
7
  </h2>
8
8
  </div>
9
9
 
@@ -35,11 +35,11 @@
35
35
  <% end %>
36
36
  </td>
37
37
  <td class="table-list__actions">
38
- <% if can? :update, debate %>
38
+ <% if allowed_to? :update, :debate, debate: debate %>
39
39
  <%= icon_link_to "pencil", edit_debate_path(debate), t("actions.edit", scope: "decidim.debates"), class: "action-icon--edit" %>
40
40
  <% end %>
41
41
 
42
- <% if can? :destroy, debate %>
42
+ <% if allowed_to? :delete, :debate, debate: debate %>
43
43
  <%= icon_link_to "circle-x", debate_path(debate), t("actions.destroy", scope: "decidim.debates"), method: :delete, class: "action-icon--remove", data: { confirm: t("actions.confirm_destroy", scope: "decidim.debates") } %>
44
44
  <% end %>
45
45
  </td>
@@ -1,42 +1 @@
1
- <div class="column">
2
- <article class="card card--debate">
3
- <div class="card__content">
4
- <div class="card__header">
5
- <%= link_to debate_path(debate), class: "card__link" do %>
6
- <h5 class="card__title"><%= translated_attribute debate.title %></h5>
7
- <% end %>
8
- </div>
9
- <% if debate.start_time.present? && debate.end_time.present? %>
10
- <div class="card__datetime">
11
- <div class="card__datetime__date">
12
- <%= l debate.start_time, format: "%d" %> <span class="card__datetime__month"><%= l debate.start_time, format: "%B" %></span>
13
- </div>
14
- <div class="card__datetime__time">
15
- <%= l debate.start_time, format: "%H:%M" %> - <%= l debate.end_time, format: "%H:%M" %>
16
- </div>
17
- </div>
18
- <% end %>
19
- <p class="card__desc">
20
- <%== html_truncate(translated_attribute(debate.description), length: 630, separator: "...") %>
21
- </p>
22
- <% if debate.category.present? %>
23
- <ul class="tags tags--debate">
24
- <li><%= link_to translated_attribute(debate.category.name), debates_path(filter: { category_id: debate.category.id }) %></li>
25
- </ul>
26
- <% end %>
27
- </div>
28
- <div class="card__footer">
29
- <div class="card__support">
30
- <div id="debate-<%= debate.id %>-votes-count" class="card__support__data">
31
- <span class="card__support__number">
32
- <%= debate.comments.count %>
33
- </span>
34
- <span>
35
- <%= t(".comments", count: debate.comments.count) %>
36
- </span>
37
- </div>
38
- <%= link_to t(".participate"), debate_path(debate), class: "button small secondary card__button" %>
39
- </div>
40
- </div>
41
- </article>
42
- </div>
1
+ <%= card_for debate, from: debate, context: { current_user: current_user } %>
@@ -8,22 +8,9 @@
8
8
  <h2 class="heading2">
9
9
  <%== translated_attribute debate.title %>
10
10
  </h2>
11
- <div class="author-data">
12
- <%= render partial: "decidim/shared/author_reference", locals: { author: Decidim::Debates::DebatePresenter.new(debate).author } %>
13
- <div class="author-data__extra">
14
- <button type="button" data-open="<%= current_user.present? ? "flagModal" : "loginModal" %>" title="<%= t(".report") %>" aria-controls="<%= current_user.present? ? "flagModal" : "loginModal" %>" aria-haspopup="true" tabindex="0">
15
- <%= icon "flag", aria_label: t(".report"), class: "icon--small" %>
16
- </button>
17
- <% unless debate.official? %>
18
- <%= link_to_current_or_new_conversation_with(debate.author) %>
19
- <% end %>
20
- </div>
21
- <% if debate.commentable? %>
22
- <a href="#comments" title="<%= t(".comments") %>">
23
- <%= icon "comment-square", aria_label: t(".comments"), role: "img" %> <%= debate.comments.count %>
24
- </a>
25
- <% end %>
26
- </div>
11
+
12
+ <%= cell "decidim/author", Decidim::Debates::DebatePresenter.new(debate).author, context: {extra_classes: ["author-data--small"]} %>
13
+
27
14
  </div>
28
15
  <div class="row">
29
16
  <div class="columns section view-side mediumlarge-4 mediumlarge-push-8
@@ -11,6 +11,15 @@ ca:
11
11
  start_time: Data d'inici
12
12
  title: Títol
13
13
  user_group_id: Crea un debat com
14
+ models:
15
+ decidim/debates/create_debate_event: Debat
16
+ decidim/debates/creation_disabled_event: Debats desactivats
17
+ decidim/debates/creation_enabled_event: Debats habilitats
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Debat
22
+ other: Debats
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ ca:
66
75
  invalid: Hi ha hagut un problema en crear el debat.
67
76
  success: Debat creat correctament.
68
77
  debate:
69
- comments:
70
- one: Comentari
71
- other: Comentaris
72
78
  participate: Participa
73
79
  filters:
74
80
  all: Tots
@@ -94,9 +100,6 @@ ca:
94
100
  close_window: Tanca la finestra
95
101
  share: Compartir
96
102
  share_link: Comparteix l'enllaç
97
- show:
98
- comments: Comentaris
99
- report: Denuncia
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -12,6 +12,15 @@ en:
12
12
  start_time: Starts at
13
13
  title: Title
14
14
  user_group_id: Create debate as
15
+ models:
16
+ decidim/debates/create_debate_event: Debate
17
+ decidim/debates/creation_disabled_event: Debates disabled
18
+ decidim/debates/creation_enabled_event: Debates enabled
19
+ activerecord:
20
+ models:
21
+ decidim/debates/debate:
22
+ one: Debate
23
+ other: Debates
15
24
  decidim:
16
25
  components:
17
26
  debates:
@@ -67,9 +76,6 @@ en:
67
76
  invalid: There has been a problem while creating the debate.
68
77
  success: Debate created successfully.
69
78
  debate:
70
- comments:
71
- one: Comment
72
- other: Comments
73
79
  participate: Participate
74
80
  filters:
75
81
  all: All
@@ -95,9 +101,6 @@ en:
95
101
  close_window: Close window
96
102
  share: Share
97
103
  share_link: Share link
98
- show:
99
- comments: Comments
100
- report: Report
101
104
  models:
102
105
  debate:
103
106
  fields:
@@ -11,6 +11,15 @@ es:
11
11
  start_time: Fecha de inicio
12
12
  title: Título
13
13
  user_group_id: Crear debate como
14
+ models:
15
+ decidim/debates/create_debate_event: Debate
16
+ decidim/debates/creation_disabled_event: Debates deshabilitados
17
+ decidim/debates/creation_enabled_event: Debates habilitados
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Debate
22
+ other: Debates
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ es:
66
75
  invalid: Ha habido un problema al crear el debate.
67
76
  success: Debate creado con éxito.
68
77
  debate:
69
- comments:
70
- one: Comentario
71
- other: Comentarios
72
78
  participate: Participar
73
79
  filters:
74
80
  all: Todos
@@ -94,9 +100,6 @@ es:
94
100
  close_window: Cerrar ventana
95
101
  share: Compartir
96
102
  share_link: Compartir enlace
97
- show:
98
- comments: Comentarios
99
- report: Informe
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -11,6 +11,15 @@ eu:
11
11
  start_time: Hasi da
12
12
  title: Izenburua
13
13
  user_group_id: Sortu eztabaida gisa
14
+ models:
15
+ decidim/debates/create_debate_event: Debate
16
+ decidim/debates/creation_disabled_event: Debateak desgaituta daude
17
+ decidim/debates/creation_enabled_event: Debateak gaituta
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Debate
22
+ other: eztabaidak
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ eu:
66
75
  invalid: Arazo bat izan da eztabaida sortzen ari den bitartean.
67
76
  success: Debate sortu da behar bezala.
68
77
  debate:
69
- comments:
70
- one: Iruzkina
71
- other: Oharrak
72
78
  participate: Parte hartu
73
79
  filters:
74
80
  all: guztiak
@@ -94,9 +100,6 @@ eu:
94
100
  close_window: Itxi leihoa
95
101
  share: Share
96
102
  share_link: Partekatu esteka
97
- show:
98
- comments: Oharrak
99
- report: txostena
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -11,6 +11,15 @@ fi:
11
11
  start_time: Alkamisaika
12
12
  title: Otsikko
13
13
  user_group_id: Luo keskustelu käyttäjänä
14
+ models:
15
+ decidim/debates/create_debate_event: Keskustelu
16
+ decidim/debates/creation_disabled_event: Keskustelut poistettu käytöstä
17
+ decidim/debates/creation_enabled_event: Keskustelut käytössä
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Keskustelu
22
+ other: keskustelut
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ fi:
66
75
  invalid: Luotaessa keskustelua tapahtui virhe.
67
76
  success: Keskustelu luotu onnistuneesti.
68
77
  debate:
69
- comments:
70
- one: Kommentti
71
- other: Kommenttia
72
78
  participate: Osallistu
73
79
  filters:
74
80
  all: Kaikki
@@ -94,9 +100,6 @@ fi:
94
100
  close_window: Sulje ikkuna
95
101
  share: Jaa
96
102
  share_link: Jaa linkki
97
- show:
98
- comments: Kommentit
99
- report: Raportti
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -11,6 +11,15 @@ fr:
11
11
  start_time: Commence à
12
12
  title: Titre
13
13
  user_group_id: Créer un débat en tant que
14
+ models:
15
+ decidim/debates/create_debate_event: Débat
16
+ decidim/debates/creation_disabled_event: Débats désactivés
17
+ decidim/debates/creation_enabled_event: Débats activés
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Débat
22
+ other: Débats
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ fr:
66
75
  invalid: Il y a eu un problème lors de la création du débat.
67
76
  success: Débat créé avec succès.
68
77
  debate:
69
- comments:
70
- one: Commentaire
71
- other: Commentaires
72
78
  participate: Participer
73
79
  filters:
74
80
  all: Tout
@@ -94,9 +100,6 @@ fr:
94
100
  close_window: Fermer la fenêtre
95
101
  share: Partager
96
102
  share_link: Lien de partage
97
- show:
98
- comments: Commentaires
99
- report: Rapport
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -11,6 +11,15 @@ gl:
11
11
  start_time: Comeza en
12
12
  title: Título
13
13
  user_group_id: Crear debate como
14
+ models:
15
+ decidim/debates/create_debate_event: Debate
16
+ decidim/debates/creation_disabled_event: Debates desactivados
17
+ decidim/debates/creation_enabled_event: Debates habilitados
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Debate
22
+ other: Debates
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ gl:
66
75
  invalid: Produciuse un problema ao crear o debate.
67
76
  success: Debate creouse con éxito.
68
77
  debate:
69
- comments:
70
- one: Comentario
71
- other: Comentarios
72
78
  participate: Participar
73
79
  filters:
74
80
  all: Todo
@@ -94,9 +100,6 @@ gl:
94
100
  close_window: Pechar ventá
95
101
  share: Comparte
96
102
  share_link: Compartir a ligazón
97
- show:
98
- comments: Comentarios
99
- report: Informe
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -11,6 +11,15 @@ it:
11
11
  start_time: Inizia a
12
12
  title: Titolo
13
13
  user_group_id: Crea dibattito come
14
+ models:
15
+ decidim/debates/create_debate_event: Discussione
16
+ decidim/debates/creation_disabled_event: Discussioni disabilitate
17
+ decidim/debates/creation_enabled_event: Discussioni abilitate
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Discussione
22
+ other: dibattiti
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ it:
66
75
  invalid: C'è stato un problema durante la creazione del dibattito.
67
76
  success: Dibattito creato con successo.
68
77
  debate:
69
- comments:
70
- one: Commento
71
- other: Commenti
72
78
  participate: Partecipare
73
79
  filters:
74
80
  all: Tutti
@@ -94,9 +100,6 @@ it:
94
100
  close_window: Chiudi la finestra
95
101
  share: Condividere
96
102
  share_link: Condividi il link
97
- show:
98
- comments: Commenti
99
- report: rapporto
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -11,6 +11,15 @@ nl:
11
11
  start_time: Begint om
12
12
  title: Titel
13
13
  user_group_id: Maak een debat als
14
+ models:
15
+ decidim/debates/create_debate_event: Debat
16
+ decidim/debates/creation_disabled_event: Debatten uitgeschakeld
17
+ decidim/debates/creation_enabled_event: Debatten ingeschakeld
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Debat
22
+ other: debatten
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -20,7 +29,7 @@ nl:
20
29
  settings:
21
30
  global:
22
31
  announcement: Aankondiging
23
- comments_enabled: Reacties geactiveerd
32
+ comments_enabled: Reacties ingeschakeld
24
33
  step:
25
34
  announcement: Aankondiging
26
35
  comments_blocked: Reacties geblokkeerd
@@ -66,9 +75,6 @@ nl:
66
75
  invalid: Er is een probleem opgetreden tijdens het aanmaken van het debat.
67
76
  success: Debat succesvol aangemaakt.
68
77
  debate:
69
- comments:
70
- one: Reactie
71
- other: Reacties
72
78
  participate: Deelnemen
73
79
  filters:
74
80
  all: Alle
@@ -94,9 +100,6 @@ nl:
94
100
  close_window: Sluit venster
95
101
  share: Delen
96
102
  share_link: Link delen
97
- show:
98
- comments: Reacties
99
- report: Rapporteren
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -11,6 +11,17 @@ pl:
11
11
  start_time: Zaczyna się o
12
12
  title: Tytuł
13
13
  user_group_id: Utwórz debatę jako
14
+ models:
15
+ decidim/debates/create_debate_event: Debata
16
+ decidim/debates/creation_disabled_event: Debaty wyłączone
17
+ decidim/debates/creation_enabled_event: Debaty włączone
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Debata
22
+ few: Debaty
23
+ many: Debaty
24
+ other: Debaty
14
25
  decidim:
15
26
  components:
16
27
  debates:
@@ -93,9 +104,6 @@ pl:
93
104
  close_window: Zamknij okno
94
105
  share: Dzielić
95
106
  share_link: Udostępnij link
96
- show:
97
- comments: Komentarze
98
- report: Raport
99
107
  models:
100
108
  debate:
101
109
  fields:
@@ -11,6 +11,15 @@ pt-BR:
11
11
  start_time: Começa em
12
12
  title: Título
13
13
  user_group_id: Criar debate como
14
+ models:
15
+ decidim/debates/create_debate_event: Debate
16
+ decidim/debates/creation_disabled_event: Debates desativados
17
+ decidim/debates/creation_enabled_event: Debates ativados
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Debate
22
+ other: Debates
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ pt-BR:
66
75
  invalid: Houve um problema ao criar o debate.
67
76
  success: Debate criado com sucesso.
68
77
  debate:
69
- comments:
70
- one: Comente
71
- other: Comentários
72
78
  participate: Participar
73
79
  filters:
74
80
  all: Todos
@@ -94,9 +100,6 @@ pt-BR:
94
100
  close_window: Janela fechada
95
101
  share: Compartilhar
96
102
  share_link: Compartilhar link
97
- show:
98
- comments: Comentários
99
- report: Relatório
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -11,6 +11,15 @@ pt:
11
11
  start_time: Começa em
12
12
  title: Título
13
13
  user_group_id: Criar debate como
14
+ models:
15
+ decidim/debates/create_debate_event: Debate
16
+ decidim/debates/creation_disabled_event: Debates desativados
17
+ decidim/debates/creation_enabled_event: Debates habilitados
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Debate
22
+ other: Debates
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ pt:
66
75
  invalid: Houve um problema ao criar o debate.
67
76
  success: Debate criado com sucesso.
68
77
  debate:
69
- comments:
70
- one: Comente
71
- other: Comentários
72
78
  participate: Participar
73
79
  filters:
74
80
  all: Todos
@@ -94,9 +100,6 @@ pt:
94
100
  close_window: Janela fechada
95
101
  share: Compartilhar
96
102
  share_link: Compartilhar link
97
- show:
98
- comments: Comentários
99
- report: Relatório
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -4,25 +4,86 @@ ru:
4
4
  debate:
5
5
  category_id: Разряд
6
6
  decidim_category_id: Разряд
7
+ description: Описание
8
+ end_time: 'Заканчивается:'
9
+ information_updates: Обновления сведений
10
+ instructions: Указания для участия
11
+ start_time: 'Начинается:'
7
12
  title: Название
13
+ user_group_id: Начать обсуждение в качестве
14
+ models:
15
+ decidim/debates/create_debate_event: Обсуждение
16
+ decidim/debates/creation_disabled_event: Обсуждения отключены
17
+ decidim/debates/creation_enabled_event: Обсуждения включены
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Обсуждение
22
+ few: Обсуждения
23
+ many: Обсуждений
24
+ other: Обсуждений
8
25
  decidim:
9
26
  components:
10
27
  debates:
28
+ actions:
29
+ create: Добавить
11
30
  name: Обсуждения
12
31
  debates:
13
32
  actions:
33
+ confirm_destroy: Вы уверены?
34
+ destroy: Удалить
35
+ edit: Редактировать
14
36
  new: Добавить %{name}
37
+ title: Действия
15
38
  admin:
16
39
  debates:
40
+ create:
41
+ invalid: При попытке создать это обсуждение произошла ошибка.
42
+ success: Обсуждение успешно создано.
43
+ destroy:
44
+ success: Обсуждение успешно удалено.
45
+ edit:
46
+ title: Редактировать обсуждение
47
+ update: Обновить обсуждение
17
48
  index:
18
49
  title: Обсуждения
19
50
  new:
51
+ create: Начать обсуждение
20
52
  title: Начать новое обсуждение
53
+ update:
54
+ invalid: При попытке обновить это обсуждение произошла ошибка.
55
+ success: Обсуждение успешно обновлено.
56
+ models:
57
+ debate:
58
+ name: Обсуждение
59
+ admin_log:
60
+ debate:
61
+ create: "%{user_name} создал обсуждение %{resource_name} в пространстве %{space_name}"
62
+ update: "%{user_name} обновил обсуждение %{resource_name} в пространстве %{space_name}"
21
63
  debates:
64
+ count:
65
+ debates_count:
66
+ one: "%{count} обсуждение"
67
+ few: "%{count} обсуждения"
68
+ many: "%{count} обсуждений"
69
+ other: "%{count} обсуждений"
70
+ create:
71
+ invalid: При попытке создать это обсуждение произошла ошибка.
72
+ success: Обсуждение успешно создано.
73
+ debate:
74
+ participate: Принять участие
22
75
  filters:
76
+ all: Все
23
77
  category: Разряд
24
78
  category_prompt: Выберите разряд
79
+ citizens: Граждане
25
80
  official: Служебные
81
+ origin: Источник
82
+ search: Поиск
83
+ filters_small_view:
84
+ close_modal: Закрыть окошко
85
+ filter: Отобрать
86
+ filter_by: 'Отобрать по признаку:'
26
87
  index:
27
88
  new_debate: Начать новое обсуждение
28
89
  new:
@@ -11,6 +11,15 @@ sv:
11
11
  start_time: Börjar vid
12
12
  title: Titel
13
13
  user_group_id: Skapa debatt som
14
+ models:
15
+ decidim/debates/create_debate_event: Debatt
16
+ decidim/debates/creation_disabled_event: Debatter inaktiverade
17
+ decidim/debates/creation_enabled_event: Debatter aktiverade
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Debatt
22
+ other: debatter
14
23
  decidim:
15
24
  components:
16
25
  debates:
@@ -66,9 +75,6 @@ sv:
66
75
  invalid: Det har varit ett problem under debatten.
67
76
  success: Debatt skapades framgångsrikt.
68
77
  debate:
69
- comments:
70
- one: Kommentar
71
- other: Kommentarer
72
78
  participate: Delta
73
79
  filters:
74
80
  all: Alla
@@ -94,9 +100,6 @@ sv:
94
100
  close_window: Stäng fönstret
95
101
  share: Dela
96
102
  share_link: Dela länk
97
- show:
98
- comments: Kommentarer
99
- report: Rapportera
100
103
  models:
101
104
  debate:
102
105
  fields:
@@ -5,12 +5,23 @@ uk:
5
5
  category_id: Розряд
6
6
  decidim_category_id: Розряд
7
7
  description: Опис
8
- end_time: 'Завершується:'
8
+ end_time: 'Закінчується:'
9
9
  information_updates: Оновлення відомостей
10
10
  instructions: Вказівки до участі
11
- start_time: 'Розпочато: '
11
+ start_time: 'Починається:'
12
12
  title: Назва
13
13
  user_group_id: Започаткувати обговорення як
14
+ models:
15
+ decidim/debates/create_debate_event: Обговорення
16
+ decidim/debates/creation_disabled_event: Обговорення вимкнене
17
+ decidim/debates/creation_enabled_event: Обговорення увімкнене
18
+ activerecord:
19
+ models:
20
+ decidim/debates/debate:
21
+ one: Обговорення
22
+ few: Обговорення
23
+ many: Обговорень
24
+ other: Обговорень
14
25
  decidim:
15
26
  components:
16
27
  debates:
@@ -68,11 +79,6 @@ uk:
68
79
  invalid: При спробі започаткувати обговорення сталася помилка.
69
80
  success: Обговорення успішно започатковано.
70
81
  debate:
71
- comments:
72
- one: Коментар
73
- few: Коментарі
74
- many: Коментарів
75
- other: Коментарів
76
82
  participate: Взяти участь
77
83
  filters:
78
84
  all: Усі
@@ -98,9 +104,6 @@ uk:
98
104
  close_window: Закрити вікно
99
105
  share: Поділитися
100
106
  share_link: Поділитись посиланням
101
- show:
102
- comments: Коментарі
103
- report: Поскаржитись
104
107
  models:
105
108
  debate:
106
109
  fields:
@@ -120,7 +123,7 @@ uk:
120
123
  notification_title: <a href="%{space_path}">%{space_title} </a> розпочав обговорення у <a href="%{resource_path}">%{resource_title}</a>.
121
124
  user_followers:
122
125
  email_intro: |-
123
- Доброго дня!
126
+ Доброго дня!
124
127
  %{author_name} %{author_nickname}, за яким ви стежите, розпочав нове обговорення. Прочитайте його та зробіть свій внесок:
125
128
  email_outro: Ви отримали це сповіщення, тому що ви стежите за %{author_nickname}. Ви можете відписатися від цих сповіщень, перейшовши за наведеним вище посиланням.
126
129
  email_subject: Нове обговорення, започатковане %{author_nickname}
@@ -18,16 +18,6 @@ module Decidim
18
18
  def load_seed
19
19
  nil
20
20
  end
21
-
22
- initializer "decidim_debates.inject_admin_abilities_to_user" do |_app|
23
- Decidim.configure do |config|
24
- config.admin_abilities += [
25
- "Decidim::Debates::Abilities::Admin::AdminAbility",
26
- "Decidim::Debates::Abilities::Admin::ParticipatoryProcessAdminAbility",
27
- "Decidim::Debates::Abilities::Admin::ParticipatoryProcessModeratorAbility"
28
- ]
29
- end
30
- end
31
21
  end
32
22
  end
33
23
  end
@@ -6,6 +6,7 @@ Decidim.register_component(:debates) do |component|
6
6
  component.engine = Decidim::Debates::Engine
7
7
  component.admin_engine = Decidim::Debates::AdminEngine
8
8
  component.icon = "decidim/debates/icon.svg"
9
+ component.permissions_class_name = "Decidim::Debates::Permissions"
9
10
 
10
11
  component.on(:before_destroy) do |instance|
11
12
  raise StandardError, "Can't remove this component" if Decidim::Debates::Debate.where(component: instance).any?
@@ -26,8 +27,9 @@ Decidim.register_component(:debates) do |component|
26
27
  Decidim::Debates::Debate.where(component: components).count
27
28
  end
28
29
 
29
- component.register_resource do |resource|
30
+ component.register_resource(:debate) do |resource|
30
31
  resource.model_class_name = "Decidim::Debates::Debate"
32
+ resource.card = "decidim/debates/debate"
31
33
  end
32
34
 
33
35
  component.actions = %w(create)
@@ -16,12 +16,6 @@ module Decidim
16
16
  root to: "debates#index"
17
17
  end
18
18
 
19
- initializer "decidim_debates.inject_abilities_to_user" do |_app|
20
- Decidim.configure do |config|
21
- config.abilities += ["Decidim::Debates::Abilities::CurrentUserAbility"]
22
- end
23
- end
24
-
25
19
  initializer "decidim_changes" do
26
20
  Decidim::SettingsChange.subscribe "debates" do |changes|
27
21
  Decidim::Debates::SettingsChangeJob.perform_later(
@@ -31,6 +25,11 @@ module Decidim
31
25
  )
32
26
  end
33
27
  end
28
+
29
+ initializer "decidim_meetings.add_cells_view_paths" do
30
+ Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Debates::Engine.root}/app/cells")
31
+ Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Debates::Engine.root}/app/views") # for partials
32
+ end
34
33
  end
35
34
  end
36
35
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-debates version.
5
5
  module Debates
6
6
  def self.version
7
- "0.11.2"
7
+ "0.12.0.pre"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-debates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.12.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-06-13 00:00:00.000000000 Z
14
+ date: 2018-06-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: decidim-comments
@@ -19,28 +19,28 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.11.2
22
+ version: 0.12.0.pre
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.11.2
29
+ version: 0.12.0.pre
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: decidim-core
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 0.11.2
36
+ version: 0.12.0.pre
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '='
42
42
  - !ruby/object:Gem::Version
43
- version: 0.11.2
43
+ version: 0.12.0.pre
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: kaminari
46
46
  requirement: !ruby/object:Gem::Requirement
@@ -75,28 +75,28 @@ dependencies:
75
75
  requirements:
76
76
  - - '='
77
77
  - !ruby/object:Gem::Version
78
- version: 0.11.2
78
+ version: 0.12.0.pre
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - '='
84
84
  - !ruby/object:Gem::Version
85
- version: 0.11.2
85
+ version: 0.12.0.pre
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: decidim-dev
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - '='
91
91
  - !ruby/object:Gem::Version
92
- version: 0.11.2
92
+ version: 0.12.0.pre
93
93
  type: :development
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - '='
98
98
  - !ruby/object:Gem::Version
99
- version: 0.11.2
99
+ version: 0.12.0.pre
100
100
  description: A debates component for decidim's participatory spaces.
101
101
  email:
102
102
  - josepjaume@gmail.com
@@ -110,6 +110,9 @@ files:
110
110
  - README.md
111
111
  - Rakefile
112
112
  - app/assets/images/decidim/debates/icon.svg
113
+ - app/cells/decidim/debates/debate_cell.rb
114
+ - app/cells/decidim/debates/debate_m/footer.erb
115
+ - app/cells/decidim/debates/debate_m_cell.rb
113
116
  - app/commands/decidim/debates/admin/create_debate.rb
114
117
  - app/commands/decidim/debates/admin/update_debate.rb
115
118
  - app/commands/decidim/debates/create_debate.rb
@@ -123,13 +126,12 @@ files:
123
126
  - app/forms/decidim/debates/admin/debate_form.rb
124
127
  - app/forms/decidim/debates/debate_form.rb
125
128
  - app/helpers/decidim/debates/application_helper.rb
129
+ - app/helpers/decidim/debates/debate_cells_helper.rb
126
130
  - app/jobs/decidim/debates/settings_change_job.rb
127
- - app/models/decidim/debates/abilities/admin/admin_ability.rb
128
- - app/models/decidim/debates/abilities/admin/participatory_process_admin_ability.rb
129
- - app/models/decidim/debates/abilities/admin/participatory_process_moderator_ability.rb
130
- - app/models/decidim/debates/abilities/current_user_ability.rb
131
131
  - app/models/decidim/debates/application_record.rb
132
132
  - app/models/decidim/debates/debate.rb
133
+ - app/permissions/decidim/debates/admin/permissions.rb
134
+ - app/permissions/decidim/debates/permissions.rb
133
135
  - app/presenters/decidim/debates/admin_log/debate_presenter.rb
134
136
  - app/presenters/decidim/debates/debate_presenter.rb
135
137
  - app/presenters/decidim/debates/official_author_presenter.rb
@@ -192,9 +194,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
194
  version: '2.3'
193
195
  required_rubygems_version: !ruby/object:Gem::Requirement
194
196
  requirements:
195
- - - ">="
197
+ - - ">"
196
198
  - !ruby/object:Gem::Version
197
- version: '0'
199
+ version: 1.3.1
198
200
  requirements: []
199
201
  rubyforge_project:
200
202
  rubygems_version: 2.7.6
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Debates
5
- module Abilities
6
- module Admin
7
- # Defines the abilities related to debates for an admin user.
8
- # Intended to be used with `cancancan`.
9
- class AdminAbility < Decidim::Abilities::AdminAbility
10
- def define_abilities
11
- can :manage, Debate do |debate|
12
- debate.author.blank?
13
- end
14
- can :unreport, Debate
15
- can :hide, Debate
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Debates
5
- module Abilities
6
- module Admin
7
- # Defines the abilities related to debates for a logged in process admin user.
8
- # Intended to be used with `cancancan`.
9
- class ParticipatoryProcessAdminAbility < Decidim::Abilities::ParticipatoryProcessAdminAbility
10
- def define_participatory_process_abilities
11
- super
12
-
13
- can :manage, Debate do |debate|
14
- debate.author.blank?
15
- end
16
- can :unreport, Debate
17
- can :hide, Debate
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Debates
5
- module Abilities
6
- module Admin
7
- # Defines the abilities related to Debate for a logged in process admin user.
8
- # Intended to be used with `cancancan`.
9
- class ParticipatoryProcessModeratorAbility < Decidim::Abilities::ParticipatoryProcessModeratorAbility
10
- def define_participatory_process_abilities
11
- super
12
-
13
- can [:unreport, :hide], Debate do |debate|
14
- can_manage_process?(debate.component.participatory_space)
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Debates
5
- module Abilities
6
- # Defines the abilities related to debates for a logged in user.
7
- # Intended to be used with `cancancan`.
8
- class CurrentUserAbility
9
- include CanCan::Ability
10
-
11
- attr_reader :user, :context
12
-
13
- def initialize(user, context)
14
- return unless user
15
-
16
- @user = user
17
- @context = context
18
-
19
- can :create, Debate if authorized?(:create) && creation_enabled?
20
- can :report, Debate
21
- end
22
-
23
- private
24
-
25
- def authorized?(action)
26
- return unless component
27
-
28
- ActionAuthorizer.new(user, component, action).authorize.ok?
29
- end
30
-
31
- def creation_enabled?
32
- return unless current_settings
33
- current_settings.creation_enabled?
34
- end
35
-
36
- def current_settings
37
- context.fetch(:current_settings, nil)
38
- end
39
-
40
- def component
41
- component = context.fetch(:current_component, nil)
42
- return nil unless component && component.manifest.name == :debates
43
-
44
- component
45
- end
46
- end
47
- end
48
- end
49
- end