decidim-proposals 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/proposals/admin/create_proposal.rb +4 -1
  3. data/app/commands/decidim/proposals/create_proposal.rb +4 -1
  4. data/app/controllers/decidim/proposals/admin/proposals_controller.rb +4 -0
  5. data/app/controllers/decidim/proposals/proposals_controller.rb +12 -6
  6. data/app/forms/decidim/proposals/admin/proposal_form.rb +13 -2
  7. data/app/forms/decidim/proposals/proposal_form.rb +13 -2
  8. data/app/helpers/decidim/proposals/application_helper.rb +3 -0
  9. data/app/helpers/decidim/proposals/map_helper.rb +19 -0
  10. data/app/helpers/decidim/proposals/proposal_order_helper.rb +16 -0
  11. data/app/models/decidim/proposals/abilities/admin_user.rb +2 -0
  12. data/app/models/decidim/proposals/abilities/current_user.rb +3 -0
  13. data/app/models/decidim/proposals/abilities/process_admin_user.rb +2 -1
  14. data/app/models/decidim/proposals/proposal.rb +12 -3
  15. data/app/services/decidim/proposals/proposal_search.rb +0 -5
  16. data/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +1 -1
  17. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +8 -2
  18. data/app/views/decidim/proposals/admin/proposals/index.html.erb +12 -14
  19. data/app/views/decidim/proposals/proposals/_filters.html.erb +2 -2
  20. data/app/views/decidim/proposals/proposals/_filters_small_view.html.erb +1 -1
  21. data/app/views/decidim/proposals/proposals/_proposals.html.erb +1 -1
  22. data/app/views/decidim/proposals/proposals/_tags.html.erb +1 -1
  23. data/app/views/decidim/proposals/proposals/index.html.erb +27 -0
  24. data/app/views/decidim/proposals/proposals/new.html.erb +8 -2
  25. data/app/views/decidim/proposals/proposals/show.html.erb +18 -1
  26. data/config/i18n-tasks.yml +3 -1
  27. data/config/locales/ca.yml +11 -8
  28. data/config/locales/en.yml +9 -6
  29. data/config/locales/es.yml +14 -11
  30. data/config/locales/eu.yml +119 -1
  31. data/config/locales/fi.yml +143 -0
  32. data/db/migrate/20170215113152_create_proposal_reports.rb +14 -0
  33. data/db/migrate/20170215131720_add_report_count_to_proposals.rb +5 -0
  34. data/db/migrate/20170215132030_add_reference_to_proposals.rb +7 -0
  35. data/db/migrate/20170220152416_add_hidden_at_to_proposals.rb +5 -0
  36. data/db/migrate/20170228105156_add_geolocalization_fields_to_proposals.rb +7 -0
  37. data/db/migrate/20170307085300_migrate_proposal_reports_data_to_reports.rb +26 -0
  38. data/lib/decidim/proposals/feature.rb +4 -3
  39. data/lib/decidim/proposals/test/factories.rb +8 -0
  40. metadata +25 -16
@@ -8,6 +8,8 @@ en:
8
8
  scope_id: Scope
9
9
  title: Title
10
10
  user_group_id: Create proposal as
11
+ proposal_answer:
12
+ answer: Answer
11
13
  decidim:
12
14
  features:
13
15
  proposals:
@@ -18,9 +20,9 @@ en:
18
20
  settings:
19
21
  global:
20
22
  comments_enabled: Comments enabled
23
+ geocoding_enabled: Geocoding enabled
21
24
  official_proposals_enabled: Official proposals enabled
22
25
  proposal_answering_enabled: Proposal answering enabled
23
- scoped_proposals_enabled: Scoped proposals enabled
24
26
  vote_limit: Vote limit
25
27
  step:
26
28
  comments_blocked: Comments blocked
@@ -52,7 +54,6 @@ en:
52
54
  success: Proposal successfully created
53
55
  form:
54
56
  select_a_category: Select a category
55
- select_a_scope: Select a scope
56
57
  index:
57
58
  title: Proposals
58
59
  new:
@@ -95,10 +96,11 @@ en:
95
96
  filters_small_view:
96
97
  close_modal: Close modal
97
98
  filter: Filter
98
- filter_for: Filter by
99
+ filter_by: Filter by
99
100
  unfold: Unfold
100
101
  index:
101
102
  new_proposal: New proposal
103
+ view_proposal: View proposal
102
104
  linked_proposals:
103
105
  proposal_votes:
104
106
  one: <span class="card--list__data__number">1</span>vote
@@ -106,7 +108,6 @@ en:
106
108
  new:
107
109
  back: Back
108
110
  select_a_category: Please select a category
109
- select_a_scope: Please select a scope
110
111
  send: Send
111
112
  title: New proposal
112
113
  orders:
@@ -119,6 +120,7 @@ en:
119
120
  show:
120
121
  proposal_accepted_reason: 'This proposal has been accepted because:'
121
122
  proposal_rejected_reason: 'This proposal has been rejected because:'
123
+ report: Report
122
124
  vote_button:
123
125
  already_voted: Already voted
124
126
  no_votes_remaining: No votes remaining
@@ -137,6 +139,7 @@ en:
137
139
  votes: Votes
138
140
  resource_links:
139
141
  included_proposals:
140
- results: 'Proposal appearing in these results:'
142
+ proposal_projects: 'Proposal appearing in these projects:'
143
+ proposal_results: 'Proposal appearing in these results:'
141
144
  proposals_from_meeting:
142
- meetings: Related meetings
145
+ proposal_meetings: Related meetings
@@ -7,19 +7,21 @@ es:
7
7
  scope_id: Ámbito
8
8
  title: Título
9
9
  user_group_id: Crear propuesta como
10
+ proposal_answer:
11
+ answer: Respuesta
10
12
  decidim:
11
13
  features:
12
14
  proposals:
13
15
  actions:
14
16
  create: Crear propuestas
15
- vote: Votar
17
+ vote: Dar apoyo
16
18
  name: Propuestas
17
19
  settings:
18
20
  global:
19
21
  comments_enabled: Comentarios habilitados
22
+ geocoding_enabled: Geocodificación habilitada
20
23
  official_proposals_enabled: Propuestas oficiales habilitadas
21
24
  proposal_answering_enabled: Respuesta oficial a propuestas habilitadas
22
- scoped_proposals_enabled: Propuestas con ámbito
23
25
  vote_limit: Límite de votos
24
26
  step:
25
27
  comments_blocked: Comentarios bloqueados
@@ -51,7 +53,6 @@ es:
51
53
  success: Propuesta creada correctamente
52
54
  form:
53
55
  select_a_category: Seleccione una categoría
54
- select_a_scope: Seleccione un ámbito
55
56
  index:
56
57
  title: Propuestas
57
58
  new:
@@ -94,10 +95,11 @@ es:
94
95
  filters_small_view:
95
96
  close_modal: Cerrar ventana
96
97
  filter: Filtrar
97
- filter_for: Filtrar por
98
+ filter_by: Filtrar por
98
99
  unfold: Desplegar
99
100
  index:
100
101
  new_proposal: Nueva propuesta
102
+ view_proposal: Ver propuesta
101
103
  linked_proposals:
102
104
  proposal_votes:
103
105
  one: <span class="card--list__data__number">1</span>vote
@@ -105,7 +107,6 @@ es:
105
107
  new:
106
108
  back: Atrás
107
109
  select_a_category: Por favor, seleccione una categoría
108
- select_a_scope: Por favor, seleccione un ámbito
109
110
  send: Enviar
110
111
  title: Nueva propuesta
111
112
  orders:
@@ -118,23 +119,25 @@ es:
118
119
  show:
119
120
  proposal_accepted_reason: 'Esta propuesta ha sido aceptada porque:'
120
121
  proposal_rejected_reason: 'Esta propuesta ha sido rechazada porque:'
122
+ report: Denunciar
121
123
  vote_button:
122
124
  already_voted: Ya votado
123
125
  no_votes_remaining: No hay votos restantes
124
- vote: Votar
126
+ vote: Dar apoyo
125
127
  votes_blocked: Votación desactivada
126
128
  votes_count:
127
129
  count:
128
- one: VOTAR
129
- other: VOTOS
130
+ one: APOYO
131
+ other: APOYOS
130
132
  votes_limit:
131
133
  vote_limit:
132
- description: En lugar de votación tantas propuestas como desee, sólo se puede votar hasta %{limit} propuestas.
134
+ description: En lugar de dar apoyo tantas propuestas como se desee, sólo se puede dar apoyo hasta %{limit} propuestas.
133
135
  left: Restante
134
136
  title: Tiene %{limit} votos a distribuir
135
137
  votes: Votos
136
138
  resource_links:
137
139
  included_proposals:
138
- results: 'Propuesta formulada en estos resultados:'
140
+ proposal_projects: 'Propuesta formulada en estos proyectos:'
141
+ proposal_results: 'Propuesta formulada en estos resultados:'
139
142
  proposals_from_meeting:
140
- meetings: Encuentros relacionados
143
+ proposal_meetings: Encuentros relacionados
@@ -2,4 +2,122 @@ eu:
2
2
  activemodel:
3
3
  attributes:
4
4
  proposal:
5
- category_id: Kategoria
5
+ body: Testu-gorputza
6
+ category_id: Kategoria
7
+ scope_id: Esparrua
8
+ title: Izenburua
9
+ user_group_id: 'Sortu proposamen bat honako hau gisa:'
10
+ decidim:
11
+ features:
12
+ proposals:
13
+ actions:
14
+ create: Sortu proposamenak
15
+ vote: Bozkatu
16
+ name: Proposamenak
17
+ settings:
18
+ step:
19
+ creation_enabled: Gaitu proposamenen sorrera
20
+ votes_blocked: Bozketa blokeatuta
21
+ votes_enabled: Boto gaituak
22
+ proposals:
23
+ actions:
24
+ answer: Erantzuna
25
+ new: Proposamen berria
26
+ title: Ekintzak
27
+ admin:
28
+ models:
29
+ proposal:
30
+ name: Proposamena
31
+ proposal_answers:
32
+ edit:
33
+ accepted: Onartuta
34
+ answer_proposal: Erantzuna proposamenari
35
+ rejected: Uko eginda
36
+ proposals:
37
+ answer:
38
+ invalid: Arazo bat izan da proposamen honi erantzutean.
39
+ success: Proposamenari ongi erantzun zaio
40
+ create:
41
+ invalid: Arazo bat izan da proposamen hau sortzean.
42
+ success: Proposamena zuzen sortu da.
43
+ form:
44
+ select_a_category: Aukeratu kategoria bat
45
+ index:
46
+ title: Proposamenak
47
+ new:
48
+ create: Sortu proposamena
49
+ title: Proposamen berria
50
+ answers:
51
+ accepted: Onartuta
52
+ not_answered: Erantzun gabe
53
+ rejected: Uko eginda
54
+ create:
55
+ error: Erroreak gertatu dira proposamena gordetzean.
56
+ success: Proposamena zuzen sortu da.
57
+ models:
58
+ proposal:
59
+ fields:
60
+ category: Kategoria
61
+ official_proposal: Proposamen ofiziala
62
+ scope: Esparrua
63
+ state: Egoera
64
+ title: Izenburua
65
+ proposals:
66
+ count:
67
+ proposals_count:
68
+ one: Proposamen bat
69
+ other: "%{count} proposamen"
70
+ filters:
71
+ accepted: Onartuta
72
+ activity: Jarduera
73
+ all: Guztiak
74
+ category: Kategoria
75
+ citizenship: Herritarrak
76
+ official: Ofiziala
77
+ origin: Jatorria
78
+ rejected: Ezetsiak
79
+ related_to: Honekin lotuta
80
+ scopes: Esparruak
81
+ search: Bilatu
82
+ state: Egoera
83
+ voted: Bozkatuta
84
+ filters_small_view:
85
+ close_modal: Itxi leihoa
86
+ filter: Iragazi
87
+ filter_by: 'Iragazi honen arabera:'
88
+ unfold: Zabaldu
89
+ index:
90
+ new_proposal: Proposamen berria
91
+ linked_proposals:
92
+ proposal_votes:
93
+ one: <span class="card--list__data__number">1</span>boto
94
+ other: <span class="card--list__data__number">%{count}</span>boto
95
+ new:
96
+ back: Atzera
97
+ select_a_category: Mesedez, aukeratu kategoria bat
98
+ send: Bidali
99
+ title: Proposamen berria
100
+ orders:
101
+ label: 'Antolatu proposamenak honen arabera:'
102
+ most_voted: Bozkatuena
103
+ random: Ausazkoa
104
+ recent: Berri-berria
105
+ proposal:
106
+ view_proposal: Proposamena ikusi
107
+ show:
108
+ proposal_rejected_reason: 'Proposamen hau baztertu da honako arrazoi hauengatik:'
109
+ vote_button:
110
+ already_voted: Bozkatuta duzu
111
+ no_votes_remaining: Ez da gelditzen botorik
112
+ vote: Bozkatu
113
+ votes_blocked: Bozketa desaktibatu da
114
+ votes_count:
115
+ count:
116
+ one: BOTOA EMAN
117
+ other: ZENBAT BOTO
118
+ votes_limit:
119
+ vote_limit:
120
+ description: Nahi beste proposamen bozkatu ordez, gehienez ere %{limit} proposamen bozka ditzakezu.
121
+ left: Gainerakoa
122
+ title: Gehienez, %{limit} boto dituzu banatzeko
123
+ votes: Zenbat boto
@@ -0,0 +1,143 @@
1
+ fi:
2
+ activemodel:
3
+ attributes:
4
+ proposal:
5
+ body: Runko
6
+ category_id: Kategoria
7
+ scope_id: Konteksti
8
+ title: Otsikko
9
+ user_group_id: Luo ehdotus käyttäjänä
10
+ proposal_answer:
11
+ answer: Vastaa
12
+ decidim:
13
+ features:
14
+ proposals:
15
+ actions:
16
+ create: Luo ehdotuksia
17
+ vote: Äänestä
18
+ name: Ehdotukset
19
+ settings:
20
+ global:
21
+ comments_enabled: Kommentointi sallittu
22
+ geocoding_enabled: Geokoodaus päällä
23
+ official_proposals_enabled: Viralliset ehdotukset sallittu
24
+ proposal_answering_enabled: Ehdotuksiin vastaaminen sallittu
25
+ vote_limit: Äänestysrajoite
26
+ step:
27
+ comments_blocked: Kommentointi estetty
28
+ creation_enabled: Ehdotusten luonti sallittu
29
+ proposal_answering_enabled: Ehdotuksiin vastaaminen sallittu
30
+ votes_blocked: Äänestys estetty
31
+ votes_enabled: Äänestys sallittu
32
+ proposals:
33
+ actions:
34
+ answer: Vastaa
35
+ new: Uusi ehdotus
36
+ title: Toiminnot
37
+ admin:
38
+ models:
39
+ proposal:
40
+ name: Ehdotus
41
+ proposal_answers:
42
+ edit:
43
+ accepted: Hyväksytty
44
+ answer_proposal: Vastaa ehdotukseen
45
+ rejected: Hylätty
46
+ title: 'Vastaa ehdotukseen: %{title}'
47
+ proposals:
48
+ answer:
49
+ invalid: Ehdotukseen vastaamisessa esiintyi virhe
50
+ success: Ehdotukseen vastattu onnistuneesti
51
+ create:
52
+ invalid: Ehdotuksen luonnissa tapahtui virhe
53
+ success: Ehdotus luotu onnistuneesti
54
+ form:
55
+ select_a_category: Valitse kategoria
56
+ index:
57
+ title: Ehdotukset
58
+ new:
59
+ create: Luo ehdotus
60
+ title: Uusi ehdotus
61
+ answers:
62
+ accepted: Hyväksytty
63
+ not_answered: Vastaamaton
64
+ rejected: Hylätty
65
+ create:
66
+ error: Ehdotuksen tallennuksessa tapahtui virhe.
67
+ success: Ehdotus luotu onnistuneesti.
68
+ models:
69
+ proposal:
70
+ fields:
71
+ category: Kategoria
72
+ official_proposal: Virallinen ehdotus
73
+ scope: Konteksti
74
+ state: Tila
75
+ title: Otsikko
76
+ proposals:
77
+ count:
78
+ proposals_count:
79
+ one: 1 ehdotus
80
+ other: "%{count} ehdotusta"
81
+ filters:
82
+ accepted: Hyväksytty
83
+ activity: Aktiivisuus
84
+ all: Kaikki
85
+ category: Kategoria
86
+ citizenship: Kansalaisuus
87
+ official: Virallinen
88
+ origin: Alkuperä
89
+ rejected: Hylätty
90
+ related_to: Liittyy aiheeseen
91
+ scopes: Kontekstit
92
+ search: Haku
93
+ state: Tila
94
+ voted: Äänestetty
95
+ filters_small_view:
96
+ close_modal: Sulje ikkuna
97
+ filter: Suodata
98
+ filter_by: Suodata
99
+ unfold: Avaa
100
+ index:
101
+ new_proposal: Uusi ehdotus
102
+ view_proposal: Näytä ehdotus
103
+ linked_proposals:
104
+ proposal_votes:
105
+ one: <span class="card--list__data__number">1</span>ääni
106
+ other: <span class="card--list__data__number">%{count}</span>ääntä
107
+ new:
108
+ back: Takaisin
109
+ select_a_category: Valitse kategoria
110
+ send: Lähetä
111
+ title: Uusi ehdotus
112
+ orders:
113
+ label: 'Järjestä ehdotukset:'
114
+ most_voted: Eniten ääniä saaneet
115
+ random: Satunnainen
116
+ recent: Viimeisimmät
117
+ proposal:
118
+ view_proposal: Näytä ehdotus
119
+ show:
120
+ proposal_accepted_reason: 'Tämä ehdotus on hyväksytty, koska:'
121
+ proposal_rejected_reason: 'Tämä ehdotus on hylätty, koska:'
122
+ report: Ilmoita
123
+ vote_button:
124
+ already_voted: Jo äänestetty
125
+ no_votes_remaining: Ei ääniä jäljellä
126
+ vote: Äänestä
127
+ votes_blocked: Äänestys estetty
128
+ votes_count:
129
+ count:
130
+ one: ÄÄNI
131
+ other: ÄÄNTÄ
132
+ votes_limit:
133
+ vote_limit:
134
+ description: Voit maksimissaan äänestää %{limit} ehdotusta sen sijaan, että voisit äänestää kuinka montaa haluat.
135
+ left: Jäljellä
136
+ title: Sinulla on %{limit} ääntä käytettävänäsi
137
+ votes: Äänet
138
+ resource_links:
139
+ included_proposals:
140
+ proposal_projects: 'Ehdotus esiintyy näissä projekteissa:'
141
+ proposal_results: 'Ehdotus esiintyy näissä tuloksissa:'
142
+ proposals_from_meeting:
143
+ proposal_meetings: Liittyvät tapaamiset
@@ -0,0 +1,14 @@
1
+ class CreateProposalReports < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :decidim_proposals_proposal_reports do |t|
4
+ t.references :decidim_proposal, null: false, index: { name: "decidim_proposals_proposal_result_proposal" }
5
+ t.references :decidim_user, null: false, index: { name: "decidim_proposals_proposal_result_user" }
6
+ t.string :reason, null: false
7
+ t.text :details
8
+
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :decidim_proposals_proposal_reports, [:decidim_proposal_id, :decidim_user_id], unique: true, name: "decidim_proposals_proposal_report_proposal_user_unique"
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class AddReportCountToProposals < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :decidim_proposals_proposals, :report_count, :integer, default: 0
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ class AddReferenceToProposals < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :decidim_proposals_proposals, :reference, :string
4
+ Decidim::Proposals::Proposal.find_each(&:save)
5
+ change_column_null :decidim_proposals_proposals, :reference, false
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ class AddHiddenAtToProposals < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :decidim_proposals_proposals, :hidden_at, :datetime
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ class AddGeolocalizationFieldsToProposals < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :decidim_proposals_proposals, :address, :text
4
+ add_column :decidim_proposals_proposals, :latitude, :float
5
+ add_column :decidim_proposals_proposals, :longitude, :float
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ class MigrateProposalReportsDataToReports < ActiveRecord::Migration[5.0]
2
+ class Decidim::Proposals::ProposalReport < ApplicationRecord
3
+ belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User"
4
+ belongs_to :proposal, foreign_key: "decidim_proposal_id", class_name: "Decidim::Proposals::Proposal"
5
+ end
6
+
7
+ def change
8
+ Decidim::Proposals::ProposalReport.all.each do |proposal_report|
9
+ moderation = Decidim::Moderation.find_or_create_by!({
10
+ reportable: proposal_report.proposal,
11
+ participatory_process: proposal_report.proposal.feature.participatory_process
12
+ })
13
+ Decidim::Report.create!({
14
+ moderation: moderation,
15
+ user: proposal_report.user,
16
+ reason: proposal_report.reason,
17
+ details: proposal_report.details
18
+ })
19
+ moderation.update_attributes!(report_count: moderation.report_count + 1)
20
+ end
21
+
22
+ drop_table :decidim_proposals_proposal_reports
23
+ remove_column :decidim_proposals_proposals, :report_count
24
+ remove_column :decidim_proposals_proposals, :hidden_at
25
+ end
26
+ end
@@ -19,8 +19,8 @@ Decidim.register_feature(:proposals) do |feature|
19
19
  settings.attribute :vote_limit, type: :integer, default: 0
20
20
  settings.attribute :proposal_answering_enabled, type: :boolean, default: true
21
21
  settings.attribute :official_proposals_enabled, type: :boolean, default: true
22
- settings.attribute :scoped_proposals_enabled, type: :boolean, default: true
23
22
  settings.attribute :comments_enabled, type: :boolean, default: true
23
+ settings.attribute :geocoding_enabled, type: :boolean, default: false
24
24
  end
25
25
 
26
26
  feature.settings(:step) do |settings|
@@ -53,7 +53,8 @@ Decidim.register_feature(:proposals) do |feature|
53
53
  }
54
54
  )
55
55
  categories = feature.participatory_process.categories
56
- scopes = feature.organization.scopes
56
+ # So that we have some with global scope
57
+ scopes = feature.organization.scopes + [nil]
57
58
 
58
59
  20.times do |n|
59
60
  proposal = Decidim::Proposals::Proposal.create!(
@@ -77,7 +78,7 @@ Decidim.register_feature(:proposals) do |feature|
77
78
  end
78
79
 
79
80
  rand(3).times do |m|
80
- email = "vote-author-#{process.id}-#{n}-#{m}@decidim.org"
81
+ email = "vote-author-#{process.id}-#{n}-#{m}@example.org"
81
82
  name = "#{Faker::Name.name} #{process.id} #{n} #{m}"
82
83
 
83
84
  author = Decidim::User.create!(email: email,
@@ -50,6 +50,14 @@ FactoryGirl.define do
50
50
  }
51
51
  end
52
52
  end
53
+
54
+ trait :with_geocoding_enabled do
55
+ settings do
56
+ {
57
+ geocoding_enabled: true
58
+ }
59
+ end
60
+ end
53
61
  end
54
62
 
55
63
  factory :proposal, class: Decidim::Proposals::Proposal do