decidim-debates 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +15 -0
  3. data/Rakefile +3 -0
  4. data/app/assets/images/decidim/debates/icon.svg +1 -0
  5. data/app/commands/decidim/debates/admin/create_debate.rb +57 -0
  6. data/app/commands/decidim/debates/admin/update_debate.rb +46 -0
  7. data/app/commands/decidim/debates/create_debate.rb +68 -0
  8. data/app/controllers/decidim/debates/admin/application_controller.rb +15 -0
  9. data/app/controllers/decidim/debates/admin/debates_controller.rb +73 -0
  10. data/app/controllers/decidim/debates/application_controller.rb +13 -0
  11. data/app/controllers/decidim/debates/debates_controller.rb +78 -0
  12. data/app/events/decidim/debates/create_debate_event.rb +42 -0
  13. data/app/forms/decidim/debates/admin/debate_form.rb +33 -0
  14. data/app/forms/decidim/debates/debate_form.rb +25 -0
  15. data/app/helpers/decidim/debates/application_helper.rb +12 -0
  16. data/app/models/decidim/debates/abilities/admin/admin_ability.rb +21 -0
  17. data/app/models/decidim/debates/abilities/admin/participatory_process_admin_ability.rb +23 -0
  18. data/app/models/decidim/debates/abilities/admin/participatory_process_moderator_ability.rb +21 -0
  19. data/app/models/decidim/debates/abilities/current_user_ability.rb +49 -0
  20. data/app/models/decidim/debates/application_record.rb +10 -0
  21. data/app/models/decidim/debates/debate.rb +103 -0
  22. data/app/presenters/decidim/debates/debate_presenter.rb +20 -0
  23. data/app/presenters/decidim/debates/official_author_presenter.rb +34 -0
  24. data/app/services/decidim/debates/debate_search.rb +38 -0
  25. data/app/views/decidim/debates/admin/debates/_form.html.erb +36 -0
  26. data/app/views/decidim/debates/admin/debates/edit.html.erb +7 -0
  27. data/app/views/decidim/debates/admin/debates/index.html.erb +52 -0
  28. data/app/views/decidim/debates/admin/debates/new.html.erb +7 -0
  29. data/app/views/decidim/debates/debates/_count.html.erb +1 -0
  30. data/app/views/decidim/debates/debates/_debate.html.erb +42 -0
  31. data/app/views/decidim/debates/debates/_debates.html.erb +4 -0
  32. data/app/views/decidim/debates/debates/_filters.html.erb +20 -0
  33. data/app/views/decidim/debates/debates/_filters_small_view.html.erb +18 -0
  34. data/app/views/decidim/debates/debates/_share.html.erb +33 -0
  35. data/app/views/decidim/debates/debates/index.html.erb +27 -0
  36. data/app/views/decidim/debates/debates/index.js.erb +9 -0
  37. data/app/views/decidim/debates/debates/new.html.erb +43 -0
  38. data/app/views/decidim/debates/debates/show.html.erb +80 -0
  39. data/config/locales/ca.yml +114 -0
  40. data/config/locales/en.yml +117 -0
  41. data/config/locales/es.yml +114 -0
  42. data/config/locales/eu.yml +114 -0
  43. data/config/locales/fi.yml +114 -0
  44. data/config/locales/fr.yml +114 -0
  45. data/config/locales/gl.yml +114 -0
  46. data/config/locales/it.yml +114 -0
  47. data/config/locales/nl.yml +114 -0
  48. data/config/locales/pl.yml +116 -0
  49. data/config/locales/pt-BR.yml +114 -0
  50. data/config/locales/pt.yml +114 -0
  51. data/config/locales/ru.yml +5 -0
  52. data/config/locales/sv.yml +114 -0
  53. data/config/locales/uk.yml +5 -0
  54. data/db/migrate/20170118141619_create_debates.rb +18 -0
  55. data/db/migrate/20180117100413_add_debate_information_updates.rb +7 -0
  56. data/db/migrate/20180118132243_add_author_to_debates.rb +7 -0
  57. data/db/migrate/20180119150434_add_reference_to_debates.rb +12 -0
  58. data/db/migrate/20180122090505_add_user_group_author_to_debates.rb +7 -0
  59. data/lib/decidim/debates/admin.rb +10 -0
  60. data/lib/decidim/debates/admin_engine.rb +33 -0
  61. data/lib/decidim/debates/engine.rb +26 -0
  62. data/lib/decidim/debates/feature.rb +55 -0
  63. data/lib/decidim/debates/test/factories.rb +52 -0
  64. data/lib/decidim/debates/version.rb +10 -0
  65. data/lib/decidim/debates.rb +12 -0
  66. metadata +197 -0
@@ -0,0 +1,114 @@
1
+ pt-BR:
2
+ activemodel:
3
+ attributes:
4
+ debate:
5
+ category_id: Categoria
6
+ description: Descrição
7
+ end_time: Termina em
8
+ information_updates: Atualizações de informações
9
+ instructions: Instruções para participar
10
+ start_time: Começa em
11
+ title: Título
12
+ user_group_id: Criar debate como
13
+ decidim:
14
+ debates:
15
+ actions:
16
+ confirm_destroy: Você tem certeza?
17
+ destroy: Excluir
18
+ edit: Editar
19
+ new: Novo %{name}
20
+ title: Ações
21
+ admin:
22
+ debates:
23
+ create:
24
+ invalid: Houve um problema ao criar o debate.
25
+ success: Debate criado com sucesso.
26
+ destroy:
27
+ success: Debate excluído com sucesso.
28
+ edit:
29
+ title: Editar debate
30
+ update: Atualização do debate
31
+ index:
32
+ title: Debates
33
+ new:
34
+ create: Criar debate
35
+ title: Novo debate
36
+ update:
37
+ invalid: Ocorreu um problema ao atualizar esse debate.
38
+ success: Debate atualizado com sucesso.
39
+ models:
40
+ debate:
41
+ name: Debate
42
+ debates:
43
+ count:
44
+ debates_count:
45
+ one: "%{count} debate"
46
+ other: "%{count} debates"
47
+ create:
48
+ invalid: Houve um problema ao criar o debate.
49
+ success: Debate criado com sucesso.
50
+ debate:
51
+ comments:
52
+ one: Comente
53
+ other: Comentários
54
+ participate: Participar
55
+ filters:
56
+ all: Todos
57
+ category: Categoria
58
+ category_prompt: Selecione uma categoria
59
+ citizens: Cidadãos
60
+ official: Oficial
61
+ origin: Origem
62
+ search: Pesquisa
63
+ filters_small_view:
64
+ close_modal: Fechar modal
65
+ filter: Filtro
66
+ filter_by: Filtrar por
67
+ unfold: Desdobrar
68
+ index:
69
+ new_debate: Novo debate
70
+ new:
71
+ back: Costas
72
+ create: Crio
73
+ select_a_category: Por favor, selecione uma categoria
74
+ title: Novo debate
75
+ share:
76
+ close_window: Janela fechada
77
+ share: Compartilhar
78
+ share_link: Compartilhar link
79
+ show:
80
+ comments: Comentários
81
+ report: Relatório
82
+ models:
83
+ debate:
84
+ fields:
85
+ end_time: Data final
86
+ official_debate: Debate oficial
87
+ start_time: Data de início
88
+ title: Título
89
+ events:
90
+ debates:
91
+ create_debate_event:
92
+ space_followers:
93
+ email_intro: |-
94
+ Oi, um novo debate foi criado no espaço participativo %{space_title}, confira e contribui:
95
+ email_outro: Você recebeu esta notificação porque está seguindo o espaço participativo %{space_title}. Você pode parar de receber notificações após o link anterior.
96
+ email_subject: Novo debate sobre %{space_title}
97
+ notification_title: O <a href="%{resource_path}">%{resource_title}</a> debate foi criado em <a href="%{space_path}">%{space_title}</a>.
98
+ user_followers:
99
+ email_intro: |-
100
+ Oi, %{author_name} %{author_nickname}, quem você está seguindo, criou um novo debate, confira e contribui:
101
+ email_outro: Você recebeu esta notificação porque está seguindo %{author_nickname}. Você pode parar de receber notificações após o link anterior.
102
+ email_subject: Novo debate por %{author_nickname}
103
+ notification_title: O <a href="%{resource_path}">%{resource_title}</a> debate foi criado por <a href="%{author_path}">%{author_name} %{author_nickname}</a>.
104
+ features:
105
+ debates:
106
+ actions:
107
+ create: Crio
108
+ name: Debates
109
+ settings:
110
+ global:
111
+ comments_enabled: Comentários ativados
112
+ step:
113
+ comments_blocked: Comentários bloqueados
114
+ creation_enabled: Criação de debate por usuários habilitado
@@ -0,0 +1,114 @@
1
+ pt:
2
+ activemodel:
3
+ attributes:
4
+ debate:
5
+ category_id: Categoria
6
+ description: Descrição
7
+ end_time: Termina em
8
+ information_updates: Atualizações de informações
9
+ instructions: Instruções para participar
10
+ start_time: Começa em
11
+ title: Título
12
+ user_group_id: Criar debate como
13
+ decidim:
14
+ debates:
15
+ actions:
16
+ confirm_destroy: Você tem certeza?
17
+ destroy: Excluir
18
+ edit: Editar
19
+ new: Novo %{name}
20
+ title: Ações
21
+ admin:
22
+ debates:
23
+ create:
24
+ invalid: Houve um problema ao criar o debate.
25
+ success: Debate criado com sucesso.
26
+ destroy:
27
+ success: Debate excluído com sucesso.
28
+ edit:
29
+ title: Editar debate
30
+ update: Atualização do debate
31
+ index:
32
+ title: Debates
33
+ new:
34
+ create: Criar debate
35
+ title: Novo debate
36
+ update:
37
+ invalid: Ocorreu um problema ao atualizar esse debate.
38
+ success: Debate atualizado com sucesso.
39
+ models:
40
+ debate:
41
+ name: Debate
42
+ debates:
43
+ count:
44
+ debates_count:
45
+ one: "%{count} debate"
46
+ other: "%{count} debates"
47
+ create:
48
+ invalid: Houve um problema ao criar o debate.
49
+ success: Debate criado com sucesso.
50
+ debate:
51
+ comments:
52
+ one: Comente
53
+ other: Comentários
54
+ participate: Participar
55
+ filters:
56
+ all: Todos
57
+ category: Categoria
58
+ category_prompt: Selecione uma categoria
59
+ citizens: Cidadãos
60
+ official: Oficial
61
+ origin: Origem
62
+ search: Pesquisa
63
+ filters_small_view:
64
+ close_modal: Fechar modal
65
+ filter: Filtro
66
+ filter_by: Filtrar por
67
+ unfold: Desdobrar
68
+ index:
69
+ new_debate: Novo debate
70
+ new:
71
+ back: Costas
72
+ create: Crio
73
+ select_a_category: Por favor, selecione uma categoria
74
+ title: Novo debate
75
+ share:
76
+ close_window: Janela fechada
77
+ share: Compartilhar
78
+ share_link: Compartilhar link
79
+ show:
80
+ comments: Comentários
81
+ report: Relatório
82
+ models:
83
+ debate:
84
+ fields:
85
+ end_time: Data final
86
+ official_debate: Debate oficial
87
+ start_time: Data de início
88
+ title: Título
89
+ events:
90
+ debates:
91
+ create_debate_event:
92
+ space_followers:
93
+ email_intro: |-
94
+ Oi, um novo debate foi criado no espaço participativo %{space_title}, confira e contribui:
95
+ email_outro: Você recebeu esta notificação porque está seguindo o espaço participativo %{space_title}. Você pode parar de receber notificações após o link anterior.
96
+ email_subject: Novo debate sobre %{space_title}
97
+ notification_title: O <a href="%{resource_path}">%{resource_title}</a> debate foi criado em <a href="%{space_path}">%{space_title}</a>.
98
+ user_followers:
99
+ email_intro: |-
100
+ Oi, %{author_name} %{author_nickname}, quem você está seguindo, criou um novo debate, confira e contribui:
101
+ email_outro: Você recebeu esta notificação porque está seguindo %{author_nickname}. Você pode parar de receber notificações após o link anterior.
102
+ email_subject: Novo debate por %{author_nickname}
103
+ notification_title: O <a href="%{resource_path}">%{resource_title}</a> debate foi criado por <a href="%{author_path}">%{author_name} %{author_nickname}</a>.
104
+ features:
105
+ debates:
106
+ actions:
107
+ create: Crio
108
+ name: Debates
109
+ settings:
110
+ global:
111
+ comments_enabled: Comentários ativados
112
+ step:
113
+ comments_blocked: Comentários bloqueados
114
+ creation_enabled: Criação de debate por usuários habilitado
@@ -0,0 +1,5 @@
1
+ ru:
2
+ activemodel:
3
+ attributes:
4
+ debate:
5
+ decidim_category_id: Категория
@@ -0,0 +1,114 @@
1
+ sv:
2
+ activemodel:
3
+ attributes:
4
+ debate:
5
+ category_id: Kategori
6
+ description: Beskrivning
7
+ end_time: Slutar vid
8
+ information_updates: Informationsuppdateringar
9
+ instructions: Anvisningar att delta
10
+ start_time: Börjar vid
11
+ title: Titel
12
+ user_group_id: Skapa debatt som
13
+ decidim:
14
+ debates:
15
+ actions:
16
+ confirm_destroy: Är du säker?
17
+ destroy: Radera
18
+ edit: Redigera
19
+ new: Ny %{name}
20
+ title: Handlingar
21
+ admin:
22
+ debates:
23
+ create:
24
+ invalid: Det har varit ett problem under debatten.
25
+ success: Debatt skapades framgångsrikt.
26
+ destroy:
27
+ success: Debatten raderas framgångsrikt.
28
+ edit:
29
+ title: Redigera debatt
30
+ update: Uppdatera debatt
31
+ index:
32
+ title: debatter
33
+ new:
34
+ create: Skapa debatt
35
+ title: Ny debatt
36
+ update:
37
+ invalid: Det har varit ett problem under uppdateringen av denna debatt.
38
+ success: Debatten uppdateras framgångsrikt.
39
+ models:
40
+ debate:
41
+ name: Debatt
42
+ debates:
43
+ count:
44
+ debates_count:
45
+ one: "%{count} debatt"
46
+ other: "%{count} debatter"
47
+ create:
48
+ invalid: Det har varit ett problem under debatten.
49
+ success: Debatt skapades framgångsrikt.
50
+ debate:
51
+ comments:
52
+ one: Kommentar
53
+ other: kommentarer
54
+ participate: Delta
55
+ filters:
56
+ all: Allt
57
+ category: Kategori
58
+ category_prompt: Välj en kategori
59
+ citizens: medborgare
60
+ official: Officiell
61
+ origin: Ursprung
62
+ search: Sök
63
+ filters_small_view:
64
+ close_modal: Stäng modal
65
+ filter: Filtrera
66
+ filter_by: Filtrera efter
67
+ unfold: Veckla ut
68
+ index:
69
+ new_debate: Ny debatt
70
+ new:
71
+ back: Tillbaka
72
+ create: Skapa
73
+ select_a_category: Var god välj en kategori
74
+ title: Ny debatt
75
+ share:
76
+ close_window: Stäng fönstret
77
+ share: Dela med sig
78
+ share_link: Dela länk
79
+ show:
80
+ comments: kommentarer
81
+ report: Rapportera
82
+ models:
83
+ debate:
84
+ fields:
85
+ end_time: Slutdatum
86
+ official_debate: Officiell debatt
87
+ start_time: Start datum
88
+ title: Titel
89
+ events:
90
+ debates:
91
+ create_debate_event:
92
+ space_followers:
93
+ email_intro: |-
94
+ Hej, En ny debatt har skapats på %{space_title} deltagande rymden, kolla in det och bidra:
95
+ email_outro: Du har fått den här meddelandet eftersom du följer %{space_title} deltagande rymden. Du kan sluta ta emot meddelanden efter föregående länk.
96
+ email_subject: Ny debatt om %{space_title}
97
+ notification_title: <a href="%{resource_path}">%{resource_title}</a> debatten skapades på <a href="%{space_path}">%{space_title}</a>.
98
+ user_followers:
99
+ email_intro: |-
100
+ Hej, %{author_name} %{author_nickname}, vem du följer har skapat en ny debatt, kolla in den och bidra med:
101
+ email_outro: Du har fått den här meddelandet eftersom du följer %{author_nickname}. Du kan sluta ta emot meddelanden efter föregående länk.
102
+ email_subject: Ny debatt av %{author_nickname}
103
+ notification_title: <a href="%{resource_path}">%{resource_title}</a> debatten skapades av <a href="%{author_path}">%{author_name} %{author_nickname}</a>.
104
+ features:
105
+ debates:
106
+ actions:
107
+ create: Skapa
108
+ name: debatter
109
+ settings:
110
+ global:
111
+ comments_enabled: Kommentarer aktiverade
112
+ step:
113
+ comments_blocked: Kommentarer blockerad
114
+ creation_enabled: Debatt skapande av användare aktiverat
@@ -0,0 +1,5 @@
1
+ uk:
2
+ activemodel:
3
+ attributes:
4
+ debate:
5
+ decidim_category_id: Розділ
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateDebates < ActiveRecord::Migration[5.0]
4
+ def change
5
+ create_table :decidim_debates_debates do |t|
6
+ t.jsonb :title
7
+ t.jsonb :description
8
+ t.jsonb :instructions
9
+ t.datetime :start_time
10
+ t.datetime :end_time
11
+ t.string :image
12
+ t.references :decidim_feature, index: true
13
+ t.references :decidim_category, index: true
14
+
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDebateInformationUpdates < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :decidim_debates_debates, :information_updates, :jsonb
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddAuthorToDebates < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :decidim_debates_debates, :decidim_author_id, :integer
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddReferenceToDebates < ActiveRecord::Migration[5.1]
4
+ class Debate < ApplicationRecord
5
+ self.table_name = :decidim_debates_debates
6
+ end
7
+
8
+ def change
9
+ add_column :decidim_debates_debates, :reference, :string
10
+ Debate.find_each(&:save)
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddUserGroupAuthorToDebates < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :decidim_debates_debates, :decidim_user_group_id, :integer
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ # This module contains all the domain logic associated to Decidim's Debates
6
+ # component admin panel.
7
+ module Admin
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Debates
5
+ # This is the engine that runs on the public interface of `decidim-debates`.
6
+ # It mostly handles rendering the created debate associated to a participatory
7
+ # process.
8
+ class AdminEngine < ::Rails::Engine
9
+ isolate_namespace Decidim::Debates::Admin
10
+
11
+ paths["db/migrate"] = nil
12
+
13
+ routes do
14
+ resources :debates
15
+ root to: "debates#index"
16
+ end
17
+
18
+ def load_seed
19
+ nil
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
+ end
32
+ end
33
+ end