decidim-admin 0.13.1 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-admin might be problematic. Click here for more details.

Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/admin/application.js.es6 +3 -0
  3. data/app/assets/javascripts/decidim/admin/bundle.js +5 -5
  4. data/app/assets/javascripts/decidim/admin/bundle.js.map +1 -1
  5. data/app/assets/javascripts/decidim/admin/draggable-list.js.es6 +30 -0
  6. data/app/assets/stylesheets/decidim/admin/components/_autocomplete_select.component.scss +6 -0
  7. data/app/assets/stylesheets/decidim/admin/extra/_action-icon.scss +5 -0
  8. data/app/assets/stylesheets/decidim/admin/extra/_title_bar.scss +4 -0
  9. data/app/assets/stylesheets/decidim/admin/modules/_card-grid.scss +25 -0
  10. data/app/assets/stylesheets/decidim/admin/modules/_draggable-list.scss +27 -0
  11. data/app/assets/stylesheets/decidim/admin/modules/_forms.scss +8 -1
  12. data/app/assets/stylesheets/decidim/admin/modules/_modules.scss +8 -0
  13. data/app/assets/stylesheets/decidim/admin/utils/_mixins.scss +2 -0
  14. data/app/cells/decidim/admin/content_block/show.erb +13 -0
  15. data/app/cells/decidim/admin/content_block_cell.rb +19 -0
  16. data/app/commands/decidim/admin/reorder_content_blocks.rb +97 -0
  17. data/app/commands/decidim/admin/update_component_permissions.rb +31 -11
  18. data/app/commands/decidim/admin/update_content_block.rb +55 -0
  19. data/app/commands/decidim/admin/update_organization_appearance.rb +0 -3
  20. data/app/controllers/decidim/admin/component_permissions_controller.rb +32 -5
  21. data/app/controllers/decidim/admin/components/base_controller.rb +2 -1
  22. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +0 -8
  23. data/app/controllers/decidim/admin/concerns/has_private_users.rb +6 -10
  24. data/app/controllers/decidim/admin/impersonations_controller.rb +1 -0
  25. data/app/controllers/decidim/admin/officializations_controller.rb +1 -0
  26. data/app/controllers/decidim/admin/organization_homepage_content_blocks_controller.rb +64 -0
  27. data/app/controllers/decidim/admin/organization_homepage_controller.rb +52 -0
  28. data/app/forms/decidim/admin/content_block_form.rb +24 -0
  29. data/app/forms/decidim/admin/organization_appearance_form.rb +0 -4
  30. data/app/helpers/decidim/admin/resource_permissions_helper.rb +24 -0
  31. data/app/views/decidim/admin/component_permissions/edit.html.erb +8 -3
  32. data/app/views/decidim/admin/components/edit.html.erb +1 -1
  33. data/app/views/decidim/admin/components/new.html.erb +1 -1
  34. data/app/views/decidim/admin/officializations/index.html.erb +3 -2
  35. data/app/views/decidim/admin/organization_appearance/_form.html.erb +0 -10
  36. data/app/views/decidim/admin/organization_homepage/edit.html.erb +43 -0
  37. data/app/views/decidim/admin/organization_homepage_content_blocks/edit.html.erb +13 -0
  38. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +3 -2
  39. data/app/views/layouts/decidim/admin/newsletters.erb +1 -1
  40. data/app/views/layouts/decidim/admin/settings.html.erb +3 -0
  41. data/config/locales/ca.yml +8 -30
  42. data/config/locales/en.yml +8 -30
  43. data/config/locales/es-PY.yml +8 -30
  44. data/config/locales/es.yml +8 -30
  45. data/config/locales/eu.yml +8 -30
  46. data/config/locales/fi.yml +128 -150
  47. data/config/locales/fr.yml +8 -30
  48. data/config/locales/gl.yml +8 -30
  49. data/config/locales/hu.yml +660 -0
  50. data/config/locales/it.yml +8 -30
  51. data/config/locales/nl.yml +8 -30
  52. data/config/locales/pl.yml +8 -30
  53. data/config/locales/pt-BR.yml +41 -63
  54. data/config/locales/pt.yml +8 -30
  55. data/config/locales/ru.yml +18 -43
  56. data/config/locales/sv.yml +38 -60
  57. data/config/locales/uk.yml +19 -44
  58. data/config/routes.rb +3 -0
  59. data/lib/decidim/admin/engine.rb +8 -0
  60. data/lib/decidim/admin/form_builder.rb +2 -1
  61. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +1 -1
  62. data/lib/decidim/admin/test/manage_attachments_examples.rb +4 -4
  63. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +192 -0
  64. data/lib/decidim/admin/version.rb +1 -1
  65. metadata +31 -11
@@ -114,4 +114,196 @@ shared_examples "Managing component permissions" do
114
114
  )
115
115
  end
116
116
  end
117
+
118
+ context "when managing resource permissions" do
119
+ let!(:resource) do
120
+ create(:dummy_resource, component: component)
121
+ end
122
+
123
+ let(:edit_resource_permissions_path) do
124
+ ::Decidim::EngineRouter.admin_proxy(participatory_space).edit_component_permissions_path(component.id,
125
+ resource_name: resource.resource_manifest.name,
126
+ resource_id: resource.id)
127
+ end
128
+
129
+ let(:component_settings) { nil }
130
+
131
+ before do
132
+ if component_settings
133
+ component.settings = component_settings
134
+ component.save!
135
+ end
136
+ switch_to_host(organization.host)
137
+ login_as user, scope: :user
138
+ visit edit_resource_permissions_path
139
+ end
140
+
141
+ it "shows the resource permissions settings" do
142
+ expect(page).to have_content(resource.title)
143
+ end
144
+
145
+ context "when resources permissions are disabled" do
146
+ let(:component_settings) { { resources_permissions_enabled: false } }
147
+
148
+ it "doesn't show the resource permissions settings" do
149
+ expect(page).not_to have_content(resource.title)
150
+ end
151
+ end
152
+
153
+ context "when setting permissions" do
154
+ it "saves permission settings for the resource" do
155
+ within "form.new_component_permissions" do
156
+ within ".foo-permission" do
157
+ select "Example authorization", from: "component_permissions_permissions_foo_authorization_handler_name"
158
+ fill_in "component_permissions_permissions_foo_options_postal_code", with: "08002"
159
+ end
160
+ find("*[type=submit]").click
161
+ end
162
+
163
+ expect(page).to have_content("DUMMY ADMIN ENGINE")
164
+
165
+ expect(resource.reload.permissions["foo"]).to(
166
+ include(
167
+ "authorization_handler_name" => "dummy_authorization_handler",
168
+ "options" => { "postal_code" => "08002" }
169
+ )
170
+ )
171
+ expect(component.reload.permissions).to be_nil
172
+ end
173
+ end
174
+
175
+ context "when unsetting permissions" do
176
+ before do
177
+ resource.create_resource_permission(
178
+ permissions: {
179
+ "foo" => {
180
+ "authorization_handler_name" => "dummy_authorization_handler",
181
+ "options" => { "postal_code" => "08002" }
182
+ }
183
+ }
184
+ )
185
+
186
+ visit edit_resource_permissions_path
187
+ end
188
+
189
+ it "removes the action from the permissions hash" do
190
+ within "form.new_component_permissions" do
191
+ within ".foo-permission" do
192
+ select "Everyone", from: "component_permissions_permissions_foo_authorization_handler_name"
193
+ end
194
+
195
+ find("*[type=submit]").click
196
+ end
197
+
198
+ expect(page).to have_content("DUMMY ADMIN ENGINE")
199
+
200
+ expect(resource.reload.permissions["foo"]).to be_nil
201
+ end
202
+ end
203
+
204
+ context "when changing existing permissions" do
205
+ before do
206
+ resource.create_resource_permission(
207
+ permissions: {
208
+ "foo" => {
209
+ "authorization_handler_name" => "dummy_authorization_handler",
210
+ "options" => { "postal_code" => "08002" }
211
+ }
212
+ }
213
+ )
214
+
215
+ visit edit_resource_permissions_path
216
+ end
217
+
218
+ it "changes the configured action in the resource permissions hash" do
219
+ within "form.new_component_permissions" do
220
+ within ".foo-permission" do
221
+ select "Another example authorization", from: "component_permissions_permissions_foo_authorization_handler_name"
222
+ fill_in "component_permissions_permissions_foo_options_passport_number", with: "AXXXXXXXX"
223
+ end
224
+
225
+ find("*[type=submit]").click
226
+ end
227
+
228
+ expect(page).to have_content("DUMMY ADMIN ENGINE")
229
+
230
+ expect(resource.reload.permissions["foo"]).to(
231
+ include(
232
+ "authorization_handler_name" => "another_dummy_authorization_handler",
233
+ "options" => { "passport_number" => "AXXXXXXXX" }
234
+ )
235
+ )
236
+ end
237
+ end
238
+
239
+ context "when overriding component permissions" do
240
+ before do
241
+ component.update!(
242
+ permissions: {
243
+ "foo" => {
244
+ "authorization_handler_name" => "dummy_authorization_handler",
245
+ "options" => { "postal_code" => "08002" }
246
+ }
247
+ }
248
+ )
249
+
250
+ visit edit_resource_permissions_path
251
+ end
252
+
253
+ it "changes the configured action in the resource permissions hash" do
254
+ within "form.new_component_permissions" do
255
+ within ".foo-permission" do
256
+ select "Another example authorization", from: "component_permissions_permissions_foo_authorization_handler_name"
257
+ fill_in "component_permissions_permissions_foo_options_passport_number", with: "AXXXXXXXX"
258
+ end
259
+
260
+ find("*[type=submit]").click
261
+ end
262
+
263
+ expect(page).to have_content("DUMMY ADMIN ENGINE")
264
+
265
+ expect(resource.reload.permissions["foo"]).to(
266
+ include(
267
+ "authorization_handler_name" => "another_dummy_authorization_handler",
268
+ "options" => { "passport_number" => "AXXXXXXXX" }
269
+ )
270
+ )
271
+
272
+ expect(component.reload.permissions["foo"]).to(
273
+ include(
274
+ "authorization_handler_name" => "dummy_authorization_handler",
275
+ "options" => { "postal_code" => "08002" }
276
+ )
277
+ )
278
+ end
279
+ end
280
+
281
+ context "when unsetting component permissions" do
282
+ before do
283
+ component.update!(
284
+ permissions: {
285
+ "foo" => {
286
+ "authorization_handler_name" => "dummy_authorization_handler",
287
+ "options" => { "postal_code" => "08002" }
288
+ }
289
+ }
290
+ )
291
+ visit edit_resource_permissions_path
292
+ end
293
+
294
+ it "saves the action from the permissions hash as an empty hash" do
295
+ within "form.new_component_permissions" do
296
+ within ".foo-permission" do
297
+ select "Everyone", from: "component_permissions_permissions_foo_authorization_handler_name"
298
+ end
299
+
300
+ find("*[type=submit]").click
301
+ end
302
+
303
+ expect(page).to have_content("DUMMY ADMIN ENGINE")
304
+
305
+ expect(resource.reload.permissions["foo"]).to eq({})
306
+ end
307
+ end
308
+ end
117
309
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-admin version.
5
5
  module Admin
6
6
  def self.version
7
- "0.13.1"
7
+ "0.14.1"
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-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-07-24 00:00:00.000000000 Z
13
+ date: 2018-09-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: active_link_to
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.13.1
35
+ version: 0.14.1
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.13.1
42
+ version: 0.14.1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: devise
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -102,14 +102,20 @@ dependencies:
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: 1.11.0
105
+ version: '1.12'
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: 1.12.1
106
109
  type: :runtime
107
110
  prerelease: false
108
111
  version_requirements: !ruby/object:Gem::Requirement
109
112
  requirements:
110
113
  - - "~>"
111
114
  - !ruby/object:Gem::Version
112
- version: 1.11.0
115
+ version: '1.12'
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 1.12.1
113
119
  - !ruby/object:Gem::Dependency
114
120
  name: sassc-rails
115
121
  requirement: !ruby/object:Gem::Requirement
@@ -130,28 +136,28 @@ dependencies:
130
136
  requirements:
131
137
  - - '='
132
138
  - !ruby/object:Gem::Version
133
- version: 0.13.1
139
+ version: 0.14.1
134
140
  type: :development
135
141
  prerelease: false
136
142
  version_requirements: !ruby/object:Gem::Requirement
137
143
  requirements:
138
144
  - - '='
139
145
  - !ruby/object:Gem::Version
140
- version: 0.13.1
146
+ version: 0.14.1
141
147
  - !ruby/object:Gem::Dependency
142
148
  name: decidim-participatory_processes
143
149
  requirement: !ruby/object:Gem::Requirement
144
150
  requirements:
145
151
  - - '='
146
152
  - !ruby/object:Gem::Version
147
- version: 0.13.1
153
+ version: 0.14.1
148
154
  type: :development
149
155
  prerelease: false
150
156
  version_requirements: !ruby/object:Gem::Requirement
151
157
  requirements:
152
158
  - - '='
153
159
  - !ruby/object:Gem::Version
154
- version: 0.13.1
160
+ version: 0.14.1
155
161
  description: Organization administration to manage a single organization.
156
162
  email:
157
163
  - josepjaume@gmail.com
@@ -170,6 +176,7 @@ files:
170
176
  - app/assets/javascripts/decidim/admin/bundle.js
171
177
  - app/assets/javascripts/decidim/admin/bundle.js.map
172
178
  - app/assets/javascripts/decidim/admin/component_permissions.js.es6
179
+ - app/assets/javascripts/decidim/admin/draggable-list.js.es6
173
180
  - app/assets/javascripts/decidim/admin/dynamic_fields.component.js.es6
174
181
  - app/assets/javascripts/decidim/admin/field_dependent_inputs.component.js.es6
175
182
  - app/assets/javascripts/decidim/admin/managed_users.js.es6
@@ -199,9 +206,11 @@ files:
199
206
  - app/assets/stylesheets/decidim/admin/modules/_agenda.scss
200
207
  - app/assets/stylesheets/decidim/admin/modules/_buttons.scss
201
208
  - app/assets/stylesheets/decidim/admin/modules/_callouts.scss
209
+ - app/assets/stylesheets/decidim/admin/modules/_card-grid.scss
202
210
  - app/assets/stylesheets/decidim/admin/modules/_cards.scss
203
211
  - app/assets/stylesheets/decidim/admin/modules/_char-counter.scss
204
212
  - app/assets/stylesheets/decidim/admin/modules/_component-counter.scss
213
+ - app/assets/stylesheets/decidim/admin/modules/_draggable-list.scss
205
214
  - app/assets/stylesheets/decidim/admin/modules/_dropdown.scss
206
215
  - app/assets/stylesheets/decidim/admin/modules/_filters.scss
207
216
  - app/assets/stylesheets/decidim/admin/modules/_forms.scss
@@ -248,6 +257,8 @@ files:
248
257
  - app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_rad-to-deg.scss
249
258
  - app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_strip-unit.scss
250
259
  - app/assets/stylesheets/decidim/admin/vendor/mathsass/helpers/_unitless-rad.scss
260
+ - app/cells/decidim/admin/content_block/show.erb
261
+ - app/cells/decidim/admin/content_block_cell.rb
251
262
  - app/commands/decidim/admin/close_session_managed_user.rb
252
263
  - app/commands/decidim/admin/create_area.rb
253
264
  - app/commands/decidim/admin/create_area_type.rb
@@ -277,6 +288,7 @@ files:
277
288
  - app/commands/decidim/admin/publish_component.rb
278
289
  - app/commands/decidim/admin/reject_user_group.rb
279
290
  - app/commands/decidim/admin/remove_admin.rb
291
+ - app/commands/decidim/admin/reorder_content_blocks.rb
280
292
  - app/commands/decidim/admin/unofficialize_user.rb
281
293
  - app/commands/decidim/admin/unpublish_component.rb
282
294
  - app/commands/decidim/admin/unreport_resource.rb
@@ -287,6 +299,7 @@ files:
287
299
  - app/commands/decidim/admin/update_category.rb
288
300
  - app/commands/decidim/admin/update_component.rb
289
301
  - app/commands/decidim/admin/update_component_permissions.rb
302
+ - app/commands/decidim/admin/update_content_block.rb
290
303
  - app/commands/decidim/admin/update_newsletter.rb
291
304
  - app/commands/decidim/admin/update_oauth_application.rb
292
305
  - app/commands/decidim/admin/update_organization.rb
@@ -323,6 +336,8 @@ files:
323
336
  - app/controllers/decidim/admin/officializations_controller.rb
324
337
  - app/controllers/decidim/admin/organization_appearance_controller.rb
325
338
  - app/controllers/decidim/admin/organization_controller.rb
339
+ - app/controllers/decidim/admin/organization_homepage_content_blocks_controller.rb
340
+ - app/controllers/decidim/admin/organization_homepage_controller.rb
326
341
  - app/controllers/decidim/admin/scope_types_controller.rb
327
342
  - app/controllers/decidim/admin/scopes_controller.rb
328
343
  - app/controllers/decidim/admin/static_pages_controller.rb
@@ -338,6 +353,7 @@ files:
338
353
  - app/forms/decidim/admin/attachment_form.rb
339
354
  - app/forms/decidim/admin/category_form.rb
340
355
  - app/forms/decidim/admin/component_form.rb
356
+ - app/forms/decidim/admin/content_block_form.rb
341
357
  - app/forms/decidim/admin/impersonate_user_form.rb
342
358
  - app/forms/decidim/admin/managed_user_promotion_form.rb
343
359
  - app/forms/decidim/admin/newsletter_form.rb
@@ -363,6 +379,7 @@ files:
363
379
  - app/helpers/decidim/admin/icon_link_helper.rb
364
380
  - app/helpers/decidim/admin/log_render_helper.rb
365
381
  - app/helpers/decidim/admin/menu_helper.rb
382
+ - app/helpers/decidim/admin/resource_permissions_helper.rb
366
383
  - app/helpers/decidim/admin/scopes_helper.rb
367
384
  - app/helpers/decidim/admin/settings_helper.rb
368
385
  - app/jobs/decidim/admin/application_job.rb
@@ -439,6 +456,8 @@ files:
439
456
  - app/views/decidim/admin/organization/edit.html.erb
440
457
  - app/views/decidim/admin/organization_appearance/_form.html.erb
441
458
  - app/views/decidim/admin/organization_appearance/edit.html.erb
459
+ - app/views/decidim/admin/organization_homepage/edit.html.erb
460
+ - app/views/decidim/admin/organization_homepage_content_blocks/edit.html.erb
442
461
  - app/views/decidim/admin/participatory_space_private_users/_form.html.erb
443
462
  - app/views/decidim/admin/participatory_space_private_users/index.html.erb
444
463
  - app/views/decidim/admin/participatory_space_private_users/new.html.erb
@@ -480,6 +499,7 @@ files:
480
499
  - config/locales/fi.yml
481
500
  - config/locales/fr.yml
482
501
  - config/locales/gl.yml
502
+ - config/locales/hu.yml
483
503
  - config/locales/it.yml
484
504
  - config/locales/nl.yml
485
505
  - config/locales/pl.yml
@@ -536,7 +556,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
536
556
  version: '0'
537
557
  requirements: []
538
558
  rubyforge_project:
539
- rubygems_version: 2.7.6
559
+ rubygems_version: 2.7.7
540
560
  signing_key:
541
561
  specification_version: 4
542
562
  summary: Decidim organization administration