decidim 0.0.1.alpha4 → 0.0.1.alpha5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.codeclimate.yml +1 -0
- data/.gitignore +2 -0
- data/.travis.yml +2 -1
- data/Dockerfile +1 -12
- data/Gemfile +8 -3
- data/Gemfile.common +1 -0
- data/Gemfile.lock +49 -38
- data/README.md +1 -0
- data/decidim-admin/Gemfile +3 -14
- data/decidim-admin/Rakefile +0 -5
- data/decidim-admin/app/assets/javascripts/decidim/admin.js +4 -3
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process.rb +47 -0
- data/decidim-admin/app/commands/decidim/admin/update_participatory_process.rb +49 -0
- data/decidim-admin/app/controllers/concerns/decidim/needs_authorization.rb +50 -0
- data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +2 -0
- data/decidim-admin/app/controllers/decidim/admin/dashboard_controller.rb +11 -0
- data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +85 -0
- data/decidim-admin/app/forms/decidim/admin/participatory_process_form.rb +37 -0
- data/decidim-admin/app/helpers/decidim/admin/application_helper.rb +2 -0
- data/decidim-admin/app/helpers/decidim/admin/attributes_display_helper.rb +62 -0
- data/decidim-admin/app/policies/decidim/admin/dashboard_policy.rb +15 -0
- data/decidim-admin/app/policies/decidim/admin/participatory_process_policy.rb +57 -0
- data/decidim-admin/app/views/decidim/admin/participatory_processes/_form.html.erb +23 -0
- data/decidim-admin/app/views/decidim/admin/participatory_processes/edit.html.erb +11 -0
- data/decidim-admin/app/views/decidim/admin/participatory_processes/index.html.erb +34 -0
- data/decidim-admin/app/views/decidim/admin/participatory_processes/new.html.erb +11 -0
- data/decidim-admin/app/views/decidim/admin/participatory_processes/show.html.erb +20 -0
- data/decidim-admin/app/views/layouts/decidim/admin/_sidebar.html.erb +1 -0
- data/decidim-admin/config/locales/ca.yml +40 -0
- data/decidim-admin/config/locales/en.yml +32 -0
- data/decidim-admin/config/locales/es.yml +40 -0
- data/decidim-admin/config/routes.rb +4 -1
- data/decidim-admin/decidim-admin.gemspec +1 -2
- data/decidim-admin/lib/decidim/admin/engine.rb +1 -1
- data/decidim-admin/spec/features/admin_invite_spec.rb +2 -6
- data/decidim-admin/spec/features/manage_participatory_processes_spec.rb +127 -0
- data/decidim-admin/spec/policies/dashboard_policy_spec.rb +23 -0
- data/decidim-admin/spec/policies/participatory_process_policy_spec.rb +153 -0
- data/decidim-dev/Gemfile +3 -14
- data/decidim-dev/decidim-dev.gemspec +2 -3
- data/decidim-dev/lib/decidim/test/i18n_spec.rb +16 -0
- data/decidim-dev/lib/decidim/test/rspec_support/action_mailer.rb +3 -2
- data/decidim-dev/lib/decidim/test/rspec_support/warden.rb +1 -0
- data/decidim-system/Gemfile +3 -14
- data/decidim-system/Rakefile +0 -5
- data/decidim-system/app/assets/javascripts/decidim/system.js +4 -3
- data/decidim-system/app/commands/decidim/system/register_organization.rb +1 -0
- data/decidim-system/app/forms/decidim/system/register_organization_form.rb +2 -1
- data/decidim-system/app/views/decidim/system/organizations/new.html.erb +4 -0
- data/decidim-system/config/locales/ca.yml +60 -0
- data/decidim-system/config/locales/es.yml +60 -0
- data/decidim-system/decidim-system.gemspec +1 -2
- data/decidim-system/lib/decidim/system/engine.rb +0 -1
- data/decidim-system/spec/commands/decidim/system/register_organization_spec.rb +1 -0
- data/decidim-system/spec/features/organizations_spec.rb +1 -0
- data/decidim.gemspec +1 -0
- data/lib/generators/decidim/templates/Gemfile.erb +0 -11
- metadata +43 -12
- data/common_gemfile.rb +0 -12
- data/decidim-admin/Gemfile.lock +0 -383
- data/decidim-dev/Gemfile.lock +0 -381
- data/decidim-system/Gemfile.lock +0 -377
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16728bf79aa6c114df6b46890af4bafc3d28ff89
|
4
|
+
data.tar.gz: 5b9218c6d7c13bab0e2df151c18a6cc5bc656126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b471cd3e5dfca0cedbb6405795e2131c4e5a8e87be791a7e198254b3c02d902954f8ca3a53ae7f4fe7481b747e36e4fbce489598245325ee58da1171a55f886f
|
7
|
+
data.tar.gz: 98911183731f92cf4b7c93ad8fd9dcda86fd786d45ed8f629e92a8220c2cf93ad1100ee80c14c29efa0ff733caeab1c66cc162d451604b032f74505dbec59d43
|
data/.codeclimate.yml
CHANGED
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Dockerfile
CHANGED
@@ -8,25 +8,14 @@ RUN curl -sL https://deb.nodesource.com/setup_4.x | bash && \
|
|
8
8
|
apt-get install -y nodejs
|
9
9
|
|
10
10
|
ADD Gemfile /tmp/Gemfile
|
11
|
+
ADD Gemfile.common /tmp/Gemfile.common
|
11
12
|
ADD Gemfile.lock /tmp/Gemfile.lock
|
12
|
-
ADD common_gemfile.rb /tmp/common_gemfile.rb
|
13
13
|
ADD decidim.gemspec /tmp/decidim.gemspec
|
14
14
|
|
15
|
-
ADD decidim-core/Gemfile /tmp/decidim-core/Gemfile
|
16
|
-
ADD decidim-core/Gemfile.lock /tmp/decidim-core/Gemfile.lock
|
17
15
|
ADD decidim-core/decidim-core.gemspec /tmp/decidim-core/decidim-core.gemspec
|
18
16
|
ADD decidim-core/lib/decidim/core/version.rb /tmp/decidim-core/lib/decidim/core/version.rb
|
19
|
-
|
20
|
-
ADD decidim-system/Gemfile /tmp/decidim-system/Gemfile
|
21
|
-
ADD decidim-system/Gemfile.lock /tmp/decidim-system/Gemfile.lock
|
22
17
|
ADD decidim-system/decidim-system.gemspec /tmp/decidim-system/decidim-system.gemspec
|
23
|
-
|
24
|
-
ADD decidim-admin/Gemfile /tmp/decidim-admin/Gemfile
|
25
|
-
ADD decidim-admin/Gemfile.lock /tmp/decidim-admin/Gemfile.lock
|
26
18
|
ADD decidim-admin/decidim-admin.gemspec /tmp/decidim-admin/decidim-admin.gemspec
|
27
|
-
|
28
|
-
ADD decidim-dev/Gemfile /tmp/decidim-dev/Gemfile
|
29
|
-
ADD decidim-dev/Gemfile.lock /tmp/decidim-dev/Gemfile.lock
|
30
19
|
ADD decidim-dev/decidim-dev.gemspec /tmp/decidim-dev/decidim-dev.gemspec
|
31
20
|
|
32
21
|
RUN cd /tmp && bundle install
|
data/Gemfile
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
source "https://rubygems.org"
|
3
3
|
|
4
|
-
|
5
|
-
gemspec
|
4
|
+
ruby "2.3.1"
|
6
5
|
|
7
6
|
gemspec path: "."
|
8
7
|
gemspec path: "decidim-core"
|
9
8
|
gemspec path: "decidim-system"
|
10
9
|
gemspec path: "decidim-admin"
|
10
|
+
gemspec path: "decidim-dev"
|
11
11
|
|
12
12
|
gem "rubocop"
|
13
|
+
gem "rspec_junit_formatter", "0.2.3"
|
14
|
+
gem "simplecov", "~> 0.12"
|
15
|
+
gem "codecov", "~> 0.1.5"
|
16
|
+
|
17
|
+
eval(File.read(File.join(File.dirname(__FILE__), "Gemfile.common")))
|
data/Gemfile.common
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem "foundation_rails_helper", git: "https://github.com/sgruhier/foundation_rails_helper"
|
data/Gemfile.lock
CHANGED
@@ -12,29 +12,19 @@ GIT
|
|
12
12
|
PATH
|
13
13
|
remote: .
|
14
14
|
specs:
|
15
|
-
decidim (0.0.1.
|
16
|
-
decidim-admin (= 0.0.1.
|
17
|
-
decidim-core (= 0.0.1.
|
18
|
-
decidim-system (= 0.0.1.
|
15
|
+
decidim (0.0.1.alpha5)
|
16
|
+
decidim-admin (= 0.0.1.alpha5)
|
17
|
+
decidim-core (= 0.0.1.alpha5)
|
18
|
+
decidim-system (= 0.0.1.alpha5)
|
19
19
|
rails (~> 5.0.0)
|
20
|
-
|
21
|
-
byebug
|
22
|
-
capybara (~> 2.4)
|
23
|
-
database_cleaner (~> 1.5.0)
|
24
|
-
factory_girl_rails
|
25
|
-
i18n-tasks (~> 0.9.5)
|
26
|
-
launchy
|
27
|
-
listen
|
28
|
-
pg
|
29
|
-
rspec-rails (~> 3.5)
|
30
|
-
wisper-rspec
|
20
|
+
rails-i18n (~> 5.0.0)
|
31
21
|
|
32
22
|
PATH
|
33
23
|
remote: decidim-admin
|
34
24
|
specs:
|
35
|
-
decidim-admin (0.0.1.
|
25
|
+
decidim-admin (0.0.1.alpha5)
|
36
26
|
active_link_to (~> 1.0.0)
|
37
|
-
decidim-core (= 0.0.1.
|
27
|
+
decidim-core (= 0.0.1.alpha5)
|
38
28
|
devise (~> 4.2)
|
39
29
|
devise-i18n (~> 1.1.0)
|
40
30
|
devise_invitable (~> 1.7.0)
|
@@ -42,7 +32,6 @@ PATH
|
|
42
32
|
foundation_rails_helper (~> 2.0.0)
|
43
33
|
jbuilder (~> 2.5)
|
44
34
|
jquery-rails (~> 4.0)
|
45
|
-
jquery-turbolinks (~> 2.1.0)
|
46
35
|
pundit (~> 1.1.0)
|
47
36
|
rails (~> 5.0.0)
|
48
37
|
rectify (~> 0.6)
|
@@ -52,7 +41,7 @@ PATH
|
|
52
41
|
PATH
|
53
42
|
remote: decidim-core
|
54
43
|
specs:
|
55
|
-
decidim-core (0.0.1.
|
44
|
+
decidim-core (0.0.1.alpha5)
|
56
45
|
active_link_to (~> 1.0.0)
|
57
46
|
devise (~> 4.2)
|
58
47
|
devise-i18n (~> 1.1.0)
|
@@ -60,18 +49,34 @@ PATH
|
|
60
49
|
foundation_rails_helper (~> 2.0.0)
|
61
50
|
jbuilder (~> 2.5)
|
62
51
|
jquery-rails (~> 4.0)
|
63
|
-
|
52
|
+
pg (~> 0.19.0)
|
64
53
|
rails (~> 5.0.0)
|
65
54
|
rectify (~> 0.6)
|
55
|
+
redis (~> 3.3.0)
|
56
|
+
roadie-rails (~> 1.0)
|
66
57
|
sass-rails (~> 5.0.0)
|
67
58
|
turbolinks (~> 5.0.0)
|
68
59
|
|
60
|
+
PATH
|
61
|
+
remote: decidim-dev
|
62
|
+
specs:
|
63
|
+
decidim-dev (0.0.1.alpha5)
|
64
|
+
byebug
|
65
|
+
capybara (~> 2.10.0)
|
66
|
+
database_cleaner (~> 1.5.0)
|
67
|
+
factory_girl_rails
|
68
|
+
i18n-tasks (~> 0.9.5)
|
69
|
+
launchy
|
70
|
+
listen (~> 3.1.0)
|
71
|
+
rspec-rails (~> 3.5)
|
72
|
+
wisper-rspec
|
73
|
+
|
69
74
|
PATH
|
70
75
|
remote: decidim-system
|
71
76
|
specs:
|
72
|
-
decidim-system (0.0.1.
|
77
|
+
decidim-system (0.0.1.alpha5)
|
73
78
|
active_link_to (~> 1.0.0)
|
74
|
-
decidim-core (= 0.0.1.
|
79
|
+
decidim-core (= 0.0.1.alpha5)
|
75
80
|
devise (~> 4.2)
|
76
81
|
devise-i18n (~> 1.1.0)
|
77
82
|
devise_invitable (~> 1.7.0)
|
@@ -79,7 +84,6 @@ PATH
|
|
79
84
|
foundation_rails_helper (~> 2.0.0)
|
80
85
|
jbuilder (~> 2.5)
|
81
86
|
jquery-rails (~> 4.0)
|
82
|
-
jquery-turbolinks (~> 2.1.0)
|
83
87
|
rails (~> 5.0.0)
|
84
88
|
rectify (~> 0.6)
|
85
89
|
sass-rails (~> 5.0.0)
|
@@ -128,7 +132,7 @@ GEM
|
|
128
132
|
minitest (~> 5.1)
|
129
133
|
tzinfo (~> 1.1)
|
130
134
|
addressable (2.4.0)
|
131
|
-
arel (7.1.
|
135
|
+
arel (7.1.4)
|
132
136
|
ast (2.3.0)
|
133
137
|
axiom-types (0.1.1)
|
134
138
|
descendants_tracker (~> 0.0.4)
|
@@ -141,7 +145,7 @@ GEM
|
|
141
145
|
bcrypt (3.1.11)
|
142
146
|
builder (3.2.2)
|
143
147
|
byebug (9.0.6)
|
144
|
-
capybara (2.10.
|
148
|
+
capybara (2.10.1)
|
145
149
|
addressable
|
146
150
|
mime-types (>= 1.16)
|
147
151
|
nokogiri (>= 1.3.3)
|
@@ -155,6 +159,8 @@ GEM
|
|
155
159
|
coercible (1.0.0)
|
156
160
|
descendants_tracker (~> 0.0.1)
|
157
161
|
concurrent-ruby (1.0.2)
|
162
|
+
css_parser (1.4.5)
|
163
|
+
addressable
|
158
164
|
database_cleaner (1.5.3)
|
159
165
|
descendants_tracker (0.0.4)
|
160
166
|
thread_safe (~> 0.3, >= 0.3.1)
|
@@ -209,15 +215,13 @@ GEM
|
|
209
215
|
rails-dom-testing (>= 1, < 3)
|
210
216
|
railties (>= 4.2.0)
|
211
217
|
thor (>= 0.14, < 2.0)
|
212
|
-
jquery-turbolinks (2.1.0)
|
213
|
-
railties (>= 3.1.0)
|
214
|
-
turbolinks
|
215
218
|
json (2.0.2)
|
216
219
|
launchy (2.4.3)
|
217
220
|
addressable (~> 2.3)
|
218
|
-
listen (3.
|
221
|
+
listen (3.1.5)
|
219
222
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
220
223
|
rb-inotify (~> 0.9, >= 0.9.7)
|
224
|
+
ruby_dep (~> 1.2)
|
221
225
|
loofah (2.0.3)
|
222
226
|
nokogiri (>= 1.5.9)
|
223
227
|
mail (2.6.4)
|
@@ -227,17 +231,15 @@ GEM
|
|
227
231
|
mime-types-data (~> 3.2015)
|
228
232
|
mime-types-data (3.2016.0521)
|
229
233
|
mini_portile2 (2.1.0)
|
230
|
-
minitest (5.9.
|
234
|
+
minitest (5.9.1)
|
231
235
|
multi_json (1.12.1)
|
232
236
|
nio4r (1.2.1)
|
233
|
-
nokogiri (1.6.8)
|
237
|
+
nokogiri (1.6.8.1)
|
234
238
|
mini_portile2 (~> 2.1.0)
|
235
|
-
pkg-config (~> 1.1.7)
|
236
239
|
orm_adapter (0.5.0)
|
237
240
|
parser (2.3.1.4)
|
238
241
|
ast (~> 2.2)
|
239
|
-
pg (0.
|
240
|
-
pkg-config (1.1.7)
|
242
|
+
pg (0.19.0)
|
241
243
|
powerpack (0.1.1)
|
242
244
|
pundit (1.1.0)
|
243
245
|
activesupport (>= 3.0.0)
|
@@ -264,6 +266,9 @@ GEM
|
|
264
266
|
nokogiri (~> 1.6.0)
|
265
267
|
rails-html-sanitizer (1.0.3)
|
266
268
|
loofah (~> 2.0)
|
269
|
+
rails-i18n (5.0.1)
|
270
|
+
i18n (~> 0.7)
|
271
|
+
railties (~> 5.0)
|
267
272
|
railties (5.0.0.1)
|
268
273
|
actionpack (= 5.0.0.1)
|
269
274
|
activesupport (= 5.0.0.1)
|
@@ -281,13 +286,20 @@ GEM
|
|
281
286
|
activesupport (>= 4.1.0)
|
282
287
|
virtus (~> 1.0.5)
|
283
288
|
wisper (>= 1.6.1)
|
289
|
+
redis (3.3.1)
|
284
290
|
responders (2.3.0)
|
285
291
|
railties (>= 4.2.0, < 5.1)
|
292
|
+
roadie (3.2.0)
|
293
|
+
css_parser (~> 1.4.5)
|
294
|
+
nokogiri (>= 1.5.0, < 1.7.0)
|
295
|
+
roadie-rails (1.1.1)
|
296
|
+
railties (>= 3.0, < 5.1)
|
297
|
+
roadie (~> 3.1)
|
286
298
|
rspec (3.5.0)
|
287
299
|
rspec-core (~> 3.5.0)
|
288
300
|
rspec-expectations (~> 3.5.0)
|
289
301
|
rspec-mocks (~> 3.5.0)
|
290
|
-
rspec-core (3.5.
|
302
|
+
rspec-core (3.5.4)
|
291
303
|
rspec-support (~> 3.5.0)
|
292
304
|
rspec-expectations (3.5.0)
|
293
305
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -314,6 +326,7 @@ GEM
|
|
314
326
|
ruby-progressbar (~> 1.7)
|
315
327
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
316
328
|
ruby-progressbar (1.8.1)
|
329
|
+
ruby_dep (1.5.0)
|
317
330
|
sass (3.4.22)
|
318
331
|
sass-rails (5.0.6)
|
319
332
|
railties (>= 4.0.0, < 6)
|
@@ -377,11 +390,9 @@ DEPENDENCIES
|
|
377
390
|
decidim!
|
378
391
|
decidim-admin!
|
379
392
|
decidim-core!
|
380
|
-
decidim-dev
|
393
|
+
decidim-dev!
|
381
394
|
decidim-system!
|
382
395
|
foundation_rails_helper!
|
383
|
-
listen
|
384
|
-
pg
|
385
396
|
pundit-matchers (~> 1.1.0)
|
386
397
|
rake (~> 11.0)
|
387
398
|
rspec (~> 3.0)
|
data/README.md
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
[![Issue Count](https://codeclimate.com/github/codegram/decidim/badges/issue_count.svg)](https://codeclimate.com/github/codegram/decidim/issues)
|
6
6
|
[![Build Status](https://travis-ci.org/codegram/decidim.svg?branch=master)](https://travis-ci.org/codegram/decidim)
|
7
7
|
[![codecov](https://codecov.io/gh/codegram/decidim/branch/master/graph/badge.svg)](https://codecov.io/gh/codegram/decidim)
|
8
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/codegram/decidim.svg)](https://gemnasium.com/github.com/codegram/decidim)
|
8
9
|
[![Issue Stats](http://issuestats.com/github/codegram/decidim/badge/pr?style=flat)](http://issuestats.com/github/codegram/decidim)
|
9
10
|
[![Issue Stats](http://issuestats.com/github/codegram/decidim/badge/issue?style=flat)](http://issuestats.com/github/codegram/decidim)
|
10
11
|
|
data/decidim-admin/Gemfile
CHANGED
@@ -1,17 +1,6 @@
|
|
1
|
-
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
-
# development dependencies will be added by default to the :development group.
|
3
|
+
gem 'decidim', path: '..'
|
6
4
|
gemspec
|
7
5
|
|
8
|
-
|
9
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
-
# your gem to rubygems.org.
|
12
|
-
|
13
|
-
# To use a debugger
|
14
|
-
# gem 'byebug', group: [:development, :test]
|
15
|
-
|
16
|
-
gemspec path: "../decidim-core"
|
17
|
-
gemspec path: ".."
|
6
|
+
eval(File.read(File.join(File.dirname(__FILE__), "..", "Gemfile.common")))
|
data/decidim-admin/Rakefile
CHANGED
@@ -11,11 +11,12 @@
|
|
11
11
|
// about supported directives.
|
12
12
|
//
|
13
13
|
//= require jquery
|
14
|
-
//= require jquery.turbolinks
|
15
14
|
//= require jquery_ujs
|
16
15
|
//= require foundation
|
16
|
+
//= require turbolinks
|
17
17
|
//= require_self
|
18
18
|
|
19
|
-
$(
|
19
|
+
$(document).on("turbolinks:load", function() {
|
20
|
+
$(function(){ $(document).foundation(); });
|
21
|
+
});
|
20
22
|
|
21
|
-
//= require turbolinks
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# A command with all the business logic when creating a new participatory
|
5
|
+
# process in the system.
|
6
|
+
class CreateParticipatoryProcess < Rectify::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# form - A form object with the params.
|
10
|
+
# organization - The Organization of the user that created the
|
11
|
+
# participatory process
|
12
|
+
def initialize(form, organization)
|
13
|
+
@form = form
|
14
|
+
@organization = organization
|
15
|
+
end
|
16
|
+
|
17
|
+
# Executes the command. Braodcasts these events:
|
18
|
+
#
|
19
|
+
# - :ok when everything is valid.
|
20
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
21
|
+
#
|
22
|
+
# Returns nothing.
|
23
|
+
def call
|
24
|
+
return broadcast(:invalid) if form.invalid?
|
25
|
+
|
26
|
+
create_participatory_process
|
27
|
+
broadcast(:ok)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :form
|
33
|
+
|
34
|
+
def create_participatory_process
|
35
|
+
ParticipatoryProcess.create!(
|
36
|
+
title: form.title,
|
37
|
+
subtitle: form.subtitle,
|
38
|
+
slug: form.slug,
|
39
|
+
hashtag: form.hashtag,
|
40
|
+
description: form.description,
|
41
|
+
short_description: form.short_description,
|
42
|
+
organization: @organization
|
43
|
+
)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Admin
|
4
|
+
# A command with all the business logic when creating a new participatory
|
5
|
+
# process in the system.
|
6
|
+
class UpdateParticipatoryProcess < Rectify::Command
|
7
|
+
# Public: Initializes the command.
|
8
|
+
#
|
9
|
+
# participatory_process - the ParticipatoryProcess to update
|
10
|
+
# form - A form object with the params.
|
11
|
+
def initialize(participatory_process, form)
|
12
|
+
@participatory_process = participatory_process
|
13
|
+
@form = form
|
14
|
+
end
|
15
|
+
|
16
|
+
# Executes the command. Braodcasts these events:
|
17
|
+
#
|
18
|
+
# - :ok when everything is valid.
|
19
|
+
# - :invalid if the form wasn't valid and we couldn't proceed.
|
20
|
+
#
|
21
|
+
# Returns nothing.
|
22
|
+
def call
|
23
|
+
return broadcast(:invalid) if form.invalid?
|
24
|
+
|
25
|
+
update_participatory_process
|
26
|
+
broadcast(:ok)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :form
|
32
|
+
|
33
|
+
def update_participatory_process
|
34
|
+
@participatory_process.update_attributes!(attributes)
|
35
|
+
end
|
36
|
+
|
37
|
+
def attributes
|
38
|
+
{
|
39
|
+
title: form.title,
|
40
|
+
subtitle: form.subtitle,
|
41
|
+
slug: form.slug,
|
42
|
+
hashtag: form.hashtag,
|
43
|
+
description: form.description,
|
44
|
+
short_description: form.short_description
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|