decidim-elections 0.22.0 → 0.23.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/decidim_elections_manifest.js +2 -0
  3. data/app/assets/javascripts/decidim/elections/vote.js.es6 +170 -0
  4. data/app/assets/stylesheets/decidim/elections/elections.scss +10 -0
  5. data/app/assets/stylesheets/decidim/elections/focus/_evote.scss +279 -0
  6. data/app/assets/stylesheets/decidim/elections/focus/_focus.scss +128 -0
  7. data/app/cells/decidim/elections/election_cell.rb +22 -0
  8. data/app/cells/decidim/elections/election_m/data.erb +19 -0
  9. data/app/cells/decidim/elections/election_m/footer.erb +5 -0
  10. data/app/cells/decidim/elections/election_m_cell.rb +103 -0
  11. data/app/cells/decidim/elections/voting_step_navigation/show.erb +29 -0
  12. data/app/cells/decidim/elections/voting_step_navigation_cell.rb +42 -0
  13. data/app/commands/decidim/elections/admin/create_election.rb +14 -3
  14. data/app/commands/decidim/elections/admin/create_question.rb +2 -1
  15. data/app/commands/decidim/elections/admin/destroy_election.rb +4 -0
  16. data/app/commands/decidim/elections/admin/import_proposals_to_elections.rb +87 -0
  17. data/app/commands/decidim/elections/admin/publish_election.rb +54 -0
  18. data/app/commands/decidim/elections/admin/unpublish_election.rb +43 -0
  19. data/app/commands/decidim/elections/admin/update_election.rb +15 -3
  20. data/app/commands/decidim/elections/admin/update_question.rb +2 -1
  21. data/app/controllers/concerns/decidim/elections/orderable.rb +36 -0
  22. data/app/controllers/decidim/elections/admin/answers_controller.rb +9 -1
  23. data/app/controllers/decidim/elections/admin/elections_controller.rb +26 -0
  24. data/app/controllers/decidim/elections/admin/proposals_imports_controller.rb +53 -0
  25. data/app/controllers/decidim/elections/elections_controller.rb +68 -0
  26. data/app/controllers/decidim/elections/votes_controller.rb +50 -0
  27. data/app/events/decidim/elections/election_published_event.rb +8 -0
  28. data/app/forms/decidim/elections/admin/answer_import_proposals_form.rb +41 -0
  29. data/app/forms/decidim/elections/admin/election_form.rb +15 -2
  30. data/app/forms/decidim/elections/admin/question_form.rb +1 -0
  31. data/app/helpers/decidim/elections/application_helper.rb +12 -0
  32. data/app/helpers/decidim/elections/election_cells_helper.rb +12 -0
  33. data/app/helpers/decidim/elections/votes_helper.rb +21 -0
  34. data/app/models/decidim/elections/answer.rb +5 -1
  35. data/app/models/decidim/elections/election.rb +69 -0
  36. data/app/models/decidim/elections/question.rb +9 -2
  37. data/app/permissions/decidim/elections/admin/permissions.rb +13 -3
  38. data/app/permissions/decidim/elections/permissions.rb +35 -0
  39. data/app/presenters/decidim/elections/admin_log/election_presenter.rb +41 -0
  40. data/app/presenters/decidim/elections/election_presenter.rb +28 -0
  41. data/app/queries/decidim/elections/filtered_elections.rb +37 -0
  42. data/app/services/decidim/elections/election_search.rb +35 -0
  43. data/app/types/decidim/elections/election_question_type.rb +2 -2
  44. data/app/types/decidim/elections/election_type.rb +2 -1
  45. data/app/types/decidim/elections/elections_type.rb +1 -1
  46. data/app/views/decidim/elections/admin/answers/index.html.erb +2 -1
  47. data/app/views/decidim/elections/admin/elections/_form.html.erb +2 -4
  48. data/app/views/decidim/elections/admin/elections/index.html.erb +23 -1
  49. data/app/views/decidim/elections/admin/proposals_imports/new.html.erb +24 -0
  50. data/app/views/decidim/elections/admin/questions/_form.html.erb +4 -0
  51. data/app/views/decidim/elections/admin/questions/index.html.erb +3 -1
  52. data/app/views/decidim/elections/elections/_count.html.erb +1 -0
  53. data/app/views/decidim/elections/elections/_election.html.erb +1 -0
  54. data/app/views/decidim/elections/elections/_elections.html.erb +24 -0
  55. data/app/views/decidim/elections/elections/_filters.html.erb +24 -0
  56. data/app/views/decidim/elections/elections/_filters_small_view.html.erb +18 -0
  57. data/app/views/decidim/elections/elections/index.html.erb +24 -0
  58. data/app/views/decidim/elections/elections/index.js.erb +10 -0
  59. data/app/views/decidim/elections/elections/show.html.erb +64 -0
  60. data/app/views/decidim/elections/votes/_election_votes_confirm.html.erb +53 -0
  61. data/app/views/decidim/elections/votes/_election_votes_confirm_footer.html.erb +24 -0
  62. data/app/views/decidim/elections/votes/_election_votes_confirmed.html.erb +26 -0
  63. data/app/views/decidim/elections/votes/_election_votes_encrypting.html.erb +20 -0
  64. data/app/views/decidim/elections/votes/_election_votes_header.html.erb +8 -0
  65. data/app/views/decidim/elections/votes/_election_votes_modal.html.erb +46 -0
  66. data/app/views/decidim/elections/votes/_election_votes_question.html.erb +49 -0
  67. data/app/views/decidim/elections/votes/_election_votes_steps_header.html.erb +12 -0
  68. data/app/views/decidim/elections/votes/new.html.erb +44 -0
  69. data/app/views/layouts/decidim/_election_votes_header.html.erb +13 -0
  70. data/app/views/layouts/decidim/election_votes.html.erb +24 -0
  71. data/config/locales/am-ET.yml +1 -0
  72. data/config/locales/bg.yml +7 -0
  73. data/config/locales/ca.yml +136 -6
  74. data/config/locales/cs.yml +133 -1
  75. data/config/locales/da.yml +1 -0
  76. data/config/locales/de.yml +134 -4
  77. data/config/locales/el.yml +11 -1
  78. data/config/locales/en.yml +131 -1
  79. data/config/locales/eo.yml +1 -0
  80. data/config/locales/es-MX.yml +131 -1
  81. data/config/locales/es-PY.yml +131 -1
  82. data/config/locales/es.yml +134 -4
  83. data/config/locales/et.yml +1 -0
  84. data/config/locales/fi-plain.yml +131 -1
  85. data/config/locales/fi.yml +131 -1
  86. data/config/locales/fr-CA.yml +131 -1
  87. data/config/locales/fr.yml +131 -1
  88. data/config/locales/gl.yml +111 -0
  89. data/config/locales/hr.yml +1 -0
  90. data/config/locales/hu.yml +18 -0
  91. data/config/locales/is.yml +1 -0
  92. data/config/locales/it.yml +98 -1
  93. data/config/locales/ja-JP.yml +95 -8
  94. data/config/locales/ja.yml +254 -0
  95. data/config/locales/ko-KR.yml +1 -0
  96. data/config/locales/ko.yml +1 -0
  97. data/config/locales/lt.yml +1 -0
  98. data/config/locales/{lv-LV.yml → lv.yml} +11 -1
  99. data/config/locales/mt.yml +1 -0
  100. data/config/locales/nl.yml +92 -1
  101. data/config/locales/no.yml +63 -0
  102. data/config/locales/om-ET.yml +1 -0
  103. data/config/locales/pl.yml +126 -1
  104. data/config/locales/pt.yml +84 -1
  105. data/config/locales/ro-RO.yml +85 -1
  106. data/config/locales/si-LK.yml +1 -0
  107. data/config/locales/so-SO.yml +1 -0
  108. data/config/locales/sv.yml +122 -2
  109. data/config/locales/sw-KE.yml +1 -0
  110. data/config/locales/ti-ER.yml +1 -0
  111. data/config/locales/tr-TR.yml +261 -0
  112. data/config/locales/vi-VN.yml +1 -0
  113. data/config/locales/vi.yml +1 -0
  114. data/config/locales/zh-CN.yml +254 -0
  115. data/config/locales/zh-TW.yml +1 -0
  116. data/db/migrate/20200601141412_add_published_at_to_elections.rb +7 -0
  117. data/db/migrate/20200807125040_remove_subtitle_from_decidim_elections.rb +7 -0
  118. data/db/migrate/20200910103648_add_min_selections_to_decidim_elections_questions.rb +7 -0
  119. data/lib/decidim/elections.rb +5 -0
  120. data/lib/decidim/elections/admin_engine.rb +7 -0
  121. data/lib/decidim/elections/bulletin_board_client.rb +35 -0
  122. data/lib/decidim/elections/component.rb +17 -12
  123. data/lib/decidim/elections/engine.rb +8 -1
  124. data/lib/decidim/elections/test/factories.rb +59 -6
  125. data/lib/decidim/elections/version.rb +1 -1
  126. data/lib/tasks/decidim_elections.rake +16 -0
  127. metadata +84 -16
@@ -0,0 +1 @@
1
+ vi:
@@ -0,0 +1 @@
1
+ vi:
@@ -0,0 +1,254 @@
1
+ zh-CN:
2
+ activemodel:
3
+ attributes:
4
+ answer:
5
+ description: 描述
6
+ image: 图片
7
+ proposals: 有关提议
8
+ title: 标题
9
+ election:
10
+ description: 描述
11
+ end_time: 投票结束于
12
+ start_time: 投票开始于
13
+ title: 标题
14
+ question:
15
+ description: 描述
16
+ max_selections: 最大选择数
17
+ min_selections: 上面没有一个选项
18
+ title: 标题
19
+ errors:
20
+ models:
21
+ answer:
22
+ attributes:
23
+ attachment:
24
+ needs_to_be_reattached: 需要重新连接
25
+ election:
26
+ attributes:
27
+ attachment:
28
+ needs_to_be_reattached: 需要重新连接
29
+ activerecord:
30
+ models:
31
+ decidim/elections/answer:
32
+ other: 答案
33
+ decidim/elections/election:
34
+ other: 选举
35
+ decidim/elections/question:
36
+ other: 问 题
37
+ decidim:
38
+ components:
39
+ elections:
40
+ actions:
41
+ vote: 投票
42
+ name: 选举
43
+ settings:
44
+ global:
45
+ announcement: 通 知
46
+ step:
47
+ announcement: 通 知
48
+ elections:
49
+ actions:
50
+ confirm_destroy: 您确定吗?
51
+ destroy: 破坏的
52
+ edit: 编辑
53
+ edit_answers: 编辑答案
54
+ edit_questions: 编辑问题
55
+ import: 导入建议以答案
56
+ new: 新建 %{name}
57
+ preview: 预览
58
+ publish: 发布
59
+ title: 行动
60
+ unpublish: 取消发布
61
+ admin:
62
+ answers:
63
+ create:
64
+ invalid: 创建此答案时出现问题
65
+ success: 答案已成功创建
66
+ destroy:
67
+ invalid: 删除答案时出错
68
+ success: 答案已成功删除
69
+ edit:
70
+ title: 编辑答案
71
+ update: 更新答案
72
+ index:
73
+ invalid_max_selections: 您需要 %{missing_answers} 个更多答案才能匹配最大选择
74
+ title: 答案
75
+ new:
76
+ create: 创建答案
77
+ title: 新答案
78
+ update:
79
+ invalid: 更新此答案时出现问题
80
+ success: 答案已成功更新
81
+ elections:
82
+ create:
83
+ invalid: 创建此选举时出现问题
84
+ success: 已成功创建选举
85
+ destroy:
86
+ invalid: 删除此选择时出现问题
87
+ success: 选区删除成功
88
+ edit:
89
+ title: 编辑选择
90
+ update: 更新选择
91
+ index:
92
+ no_bulletin_board: 没有配置 <a href="https://github.com/decidim/decidim-bulletin-board">公告栏服务器</a> ,需要使用此模块。此任务应由系统管理员完成。
93
+ title: 选举
94
+ new:
95
+ create: 创建选择
96
+ title: 新的选举
97
+ publish:
98
+ success: 选举已成功发布。
99
+ unpublish:
100
+ success: 选举已成功取消发布。
101
+ update:
102
+ invalid: 更新这次选举时遇到问题
103
+ success: 选举已成功更新
104
+ models:
105
+ answer:
106
+ name: 答案
107
+ election:
108
+ name: 选举
109
+ question:
110
+ name: 问
111
+ proposals_imports:
112
+ create:
113
+ invalid: 将建议导入答案时遇到问题
114
+ success: "%{number} 个建议已成功导入答案"
115
+ new:
116
+ create: 导入建议以答案
117
+ no_components: 在这个参与性空间中,没有其他提案组成部分可以将提案引入答案。
118
+ select_component: 请选择一个组件
119
+ questions:
120
+ create:
121
+ invalid: 创建这个问题时出错
122
+ success: 问题已成功创建
123
+ destroy:
124
+ invalid: 删除这个问题时出错
125
+ success: 问题已成功删除
126
+ edit:
127
+ title: 编辑问题
128
+ update: 更新问题
129
+ index:
130
+ title: 问 题
131
+ new:
132
+ create: 创建问题
133
+ title: 新问题
134
+ update:
135
+ invalid: 更新此问题时出错
136
+ success: 问题已成功更新
137
+ admin_log:
138
+ election:
139
+ publish: "%{user_name} 发布了 %{resource_name} 次选择"
140
+ unpublish: "%{user_name} 未发布的 %{resource_name} 选"
141
+ election_m:
142
+ badge_name:
143
+ finished: 已完成
144
+ ongoing: 已启用
145
+ upcoming: 即将到来的
146
+ end_date: 结束
147
+ footer:
148
+ view: 查看
149
+ vote: 投票
150
+ label:
151
+ date: 日期
152
+ questions: 问题 %{count}
153
+ start_date: 开始
154
+ unspecified: 未指定
155
+ elections:
156
+ count:
157
+ elections_count:
158
+ other: "%{count} 次选择"
159
+ filters:
160
+ active: 已启用
161
+ all: 所有的
162
+ finished: 已完成
163
+ search: 搜索
164
+ state: 状态
165
+ upcoming: 即将到来的
166
+ filters_small_view:
167
+ close_modal: 关闭模式
168
+ filter: 筛选器
169
+ filter_by: 筛选方式
170
+ unfold: 展开...
171
+ show:
172
+ back: 所有选举
173
+ preview: 预览
174
+ vote: 投票
175
+ voting_period_status:
176
+ finished: 投票开始于 %{start_time} ,结束于 %{end_time}
177
+ ongoing: 投票结束于 %{end_time}
178
+ upcoming: 投票开始于 %{start_time}
179
+ models:
180
+ answer:
181
+ fields:
182
+ proposals: 建议
183
+ title: 标题
184
+ election:
185
+ fields:
186
+ end_time: 结束于
187
+ start_time: 开始于
188
+ title: 标题
189
+ question:
190
+ fields:
191
+ answers: 答案
192
+ max_selections: 最大选择
193
+ title: 标题
194
+ orders:
195
+ label: 排序选举方式
196
+ older: 更旧的
197
+ recent: 最近的
198
+ votes:
199
+ confirm:
200
+ answer: 答案
201
+ answer_number: 答案 %{number}
202
+ confirm: 确认
203
+ edit: 编辑
204
+ header: 确认您的投票
205
+ intro: 这是您要投的票的摘要。 <br> 请确认您的投票或编辑您的答案。
206
+ nota_option: 空白
207
+ question: 问题 %{count}
208
+ confirmed:
209
+ back: 回到选举
210
+ experience: 您的体验如何?
211
+ feedback: 给我们一些反馈
212
+ header: 已确认投票
213
+ lead: 您的投票已被投出!
214
+ text: '您可以检查您的投票是否已成功地添加到选票箱,其标识符如下: <strong class="evote__poll-id">%{e_vote_poll_id}</strong>'
215
+ verify_text: 要检查它,请复制标识符并粘贴在 <a href="evote-verify">投票验证页面</a>
216
+ encrypting:
217
+ header: 编码投票...
218
+ text: 您的投票正在加密,以确保您可以匿名投射。
219
+ header:
220
+ confirm: 确认您的投票
221
+ confirmed: 已确认投票
222
+ encrypting: 确认投票
223
+ messages:
224
+ not_allowed: 此时您无权投票于此次选举。
225
+ modal:
226
+ close: 关闭
227
+ proposal_header: '建议:'
228
+ new:
229
+ answer_choices: 您最多可以选择 %{choices} 个答案
230
+ more_information: 更多信息
231
+ nota_option: 空白/上面没有内容
232
+ preview_alert: 这是投票站的预览。
233
+ question_steps: '%{current_step} 的 %{total_steps} 问题'
234
+ selections: "%{selected} 的 %{max_selections}<br> 选择"
235
+ voting_step:
236
+ back: 后退
237
+ continue: 下一个
238
+ warnings:
239
+ no_elections_warning: 没有符合您的搜索条件的选项,或者没有排定任何选区。
240
+ no_scheduled_elections_warning: 目前没有预定的选举,但是你们可以在这里看到过去的所有选举都被列入清单。
241
+ events:
242
+ elections:
243
+ election_published:
244
+ email_intro: '%{resource_title} 的选择现在对 %{participatory_space_title}生效。您可以从这个页面查看:'
245
+ email_outro: 您收到此通知是因为您正在关注 %{participatory_space_title}。您可以停止收到跟随上一个链接的通知。
246
+ email_subject: '%{resource_title} 的选举现在对 %{participatory_space_title} 生效。'
247
+ notification_title: <a href="%{resource_path}">%{resource_title}</a> 选区现已启用 %{participatory_space_title}。
248
+ participatory_processes:
249
+ statistics:
250
+ elections_count: 选举
251
+ layouts:
252
+ decidim:
253
+ election_votes_header:
254
+ exit: 退出
@@ -0,0 +1 @@
1
+ zh-TW:
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddPublishedAtToElections < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_elections_elections, :published_at, :datetime
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoveSubtitleFromDecidimElections < ActiveRecord::Migration[5.2]
4
+ def change
5
+ remove_column :decidim_elections_elections, :subtitle
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddMinSelectionsToDecidimElectionsQuestions < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_elections_questions, :min_selections, :integer, null: false, default: 1
6
+ end
7
+ end
@@ -9,5 +9,10 @@ module Decidim
9
9
  # This namespace holds the logic of the `Elections` component. This component
10
10
  # allows users to create elections in a participatory space.
11
11
  module Elections
12
+ autoload :BulletinBoardClient, "decidim/elections/bulletin_board_client"
13
+
14
+ def self.bulletin_board
15
+ @bulletin_board ||= BulletinBoardClient.new(Rails.application.secrets.bulletin_board || {})
16
+ end
12
17
  end
13
18
  end
@@ -11,9 +11,16 @@ module Decidim
11
11
 
12
12
  routes do
13
13
  resources :elections do
14
+ member do
15
+ put :publish
16
+ put :unpublish
17
+ end
14
18
  resources :questions do
15
19
  resources :answers do
16
20
  get :proposals_picker, on: :collection
21
+ collection do
22
+ resource :proposals_import, only: [:new, :create]
23
+ end
17
24
  end
18
25
  end
19
26
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Elections
5
+ class BulletinBoardClient
6
+ def initialize(params)
7
+ @server = params[:server].presence
8
+ @api_key = params[:api_key].presence
9
+ @identification_private_key = params[:identification_private_key]&.strip.presence
10
+
11
+ @private_key = OpenSSL::PKey::RSA.new(identification_private_key_content) if identification_private_key
12
+ end
13
+
14
+ def public_key
15
+ private_key&.public_key
16
+ end
17
+
18
+ def configured?
19
+ private_key && server && api_key
20
+ end
21
+
22
+ private
23
+
24
+ attr_reader :identification_private_key, :server, :api_key, :private_key
25
+
26
+ def identification_private_key_content
27
+ @identification_private_key_content ||= if identification_private_key.starts_with?("-----")
28
+ identification_private_key
29
+ else
30
+ File.read(Rails.application.root.join(identification_private_key))
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -6,14 +6,15 @@ Decidim.register_component(:elections) do |component|
6
6
  component.engine = Decidim::Elections::Engine
7
7
  component.admin_engine = Decidim::Elections::AdminEngine
8
8
  component.icon = "decidim/elections/icon.svg"
9
+ component.stylesheet = "decidim/elections/elections"
9
10
  component.permissions_class_name = "Decidim::Elections::Permissions"
10
-
11
+ component.query_type = "Decidim::Elections::ElectionsType"
11
12
  # component.on(:before_destroy) do |instance|
12
13
  # # Code executed before removing the component
13
14
  # end
14
15
 
15
16
  # These actions permissions can be configured in the admin panel
16
- # component.actions = %w()
17
+ component.actions = %w(vote)
17
18
 
18
19
  component.settings(:global) do |settings|
19
20
  settings.attribute :announcement, type: :text, translated: true, editor: true
@@ -23,8 +24,15 @@ Decidim.register_component(:elections) do |component|
23
24
  settings.attribute :announcement, type: :text, translated: true, editor: true
24
25
  end
25
26
 
27
+ component.register_stat :elections_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, start_at, end_at|
28
+ elections = Decidim::Elections::FilteredElections.for(components, start_at, end_at)
29
+ elections.count
30
+ end
31
+
26
32
  component.register_resource(:election) do |resource|
27
33
  resource.model_class_name = "Decidim::Elections::Election"
34
+ resource.actions = %w(vote)
35
+ resource.card = "decidim/elections/election"
28
36
  end
29
37
 
30
38
  component.register_resource(:question) do |resource|
@@ -35,10 +43,6 @@ Decidim.register_component(:elections) do |component|
35
43
  resource.model_class_name = "Decidim::Elections::Answer"
36
44
  end
37
45
 
38
- component.register_stat :elections_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, _start_at, _end_at|
39
- Decidim::Elections::Election.where(component: components).count
40
- end
41
-
42
46
  component.seeds do |participatory_space|
43
47
  admin_user = Decidim::User.find_by(
44
48
  organization: participatory_space.organization,
@@ -68,12 +72,12 @@ Decidim.register_component(:elections) do |component|
68
72
  {
69
73
  component: component,
70
74
  title: Decidim::Faker::Localized.sentence(2),
71
- subtitle: Decidim::Faker::Localized.sentence(2),
72
75
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
73
76
  Decidim::Faker::Localized.paragraph(3)
74
77
  end,
75
78
  start_time: 3.weeks.from_now,
76
- end_time: 3.weeks.from_now + 4.hours
79
+ end_time: 3.weeks.from_now + 4.hours,
80
+ published_at: Faker::Boolean.boolean(0.5) ? 1.week.ago : nil
77
81
  },
78
82
  visibility: "all"
79
83
  )
@@ -88,9 +92,10 @@ Decidim.register_component(:elections) do |component|
88
92
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
89
93
  Decidim::Faker::Localized.paragraph(3)
90
94
  end,
91
- max_selections: Faker::Number.between(0, 5),
95
+ max_selections: Faker::Number.between(1, 5),
92
96
  weight: Faker::Number.number(1),
93
- random_answers_order: Faker::Boolean.boolean(0.5)
97
+ random_answers_order: Faker::Boolean.boolean(0.5),
98
+ min_selections: Faker::Number.between(0, 1)
94
99
  },
95
100
  visibility: "all"
96
101
  )
@@ -113,8 +118,8 @@ Decidim.register_component(:elections) do |component|
113
118
  Decidim::Attachment.create!(
114
119
  title: Decidim::Faker::Localized.sentence(2),
115
120
  description: Decidim::Faker::Localized.sentence(5),
116
- file: File.new(File.join(__dir__, "seeds", "city.jpeg")),
117
- attached_to: answer
121
+ attached_to: answer,
122
+ file: File.new(File.join(__dir__, "seeds", "city.jpeg")) # Keep after attached_to
118
123
  )
119
124
  end
120
125
  end
@@ -10,11 +10,18 @@ module Decidim
10
10
  isolate_namespace Decidim::Elections
11
11
 
12
12
  routes do
13
- resources :elections, only: [:index, :show]
13
+ resources :elections, only: [:index, :show] do
14
+ resource :vote
15
+ end
14
16
 
15
17
  root to: "elections#index"
16
18
  end
17
19
 
20
+ initializer "decidim_elections.add_cells_view_paths" do
21
+ Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Elections::Engine.root}/app/cells")
22
+ Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Elections::Engine.root}/app/views") # for partials
23
+ end
24
+
18
25
  initializer "decidim_elections.assets" do |app|
19
26
  app.config.assets.precompile += %w(decidim_elections_manifest.js decidim_elections_manifest.css)
20
27
  end