decidim-admin 0.10.1 → 0.11.0.pre1
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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/assets/config/decidim_admin_manifest.js +1 -0
- data/app/assets/javascripts/decidim/admin/application.js.es6 +13 -5
- data/app/assets/javascripts/decidim/admin/auto_buttons_by_position.component.js.es6 +42 -0
- data/app/assets/javascripts/decidim/admin/auto_label_by_position.component.js.es6 +33 -0
- data/app/assets/javascripts/decidim/admin/dynamic_fields.component.js.es6 +163 -0
- data/app/assets/javascripts/decidim/admin/field_dependent_inputs.component.js.es6 +39 -0
- data/app/assets/javascripts/decidim/admin/managed_users.js.es6 +12 -0
- data/app/assets/javascripts/decidim/admin/sort_list.component.js.es6 +1 -1
- data/app/assets/javascripts/decidim/admin/subform_toggler.component.js.es6 +35 -0
- data/app/assets/javascripts/decidim/admin/tab_focus.js.es6 +4 -4
- data/app/assets/stylesheets/decidim/admin/application.scss.erb +1 -1
- data/app/assets/stylesheets/decidim/admin/extra/_dropdown_inverted.scss +7 -5
- data/app/assets/stylesheets/decidim/admin/modules/_agenda.scss +34 -0
- data/app/assets/stylesheets/decidim/admin/modules/_buttons.scss +5 -0
- data/app/assets/stylesheets/decidim/admin/modules/_cards.scss +15 -0
- data/app/assets/stylesheets/decidim/admin/modules/_forms.scss +4 -0
- data/app/assets/stylesheets/decidim/admin/modules/_modules.scss +1 -0
- data/app/assets/stylesheets/decidim/admin/modules/_typography.scss +8 -0
- data/app/assets/stylesheets/decidim/admin/utils/_flex.scss +2 -2
- data/app/assets/stylesheets/decidim/admin/utils/_helpers.scss +28 -0
- data/app/assets/stylesheets/decidim/admin/utils/_mixins.scss +44 -0
- data/app/commands/decidim/admin/create_area.rb +3 -1
- data/app/commands/decidim/admin/{create_feature.rb → create_component.rb} +11 -11
- data/app/commands/decidim/admin/create_oauth_application.rb +36 -0
- data/app/commands/decidim/admin/create_participatory_space_private_user.rb +85 -0
- data/app/commands/decidim/admin/destroy_area.rb +42 -0
- data/app/commands/decidim/admin/{destroy_feature.rb → destroy_component.rb} +11 -11
- data/app/commands/decidim/admin/destroy_oauth_application.rb +39 -0
- data/app/commands/decidim/admin/{impersonate_managed_user.rb → impersonate_user.rb} +19 -13
- data/app/commands/decidim/admin/publish_component.rb +51 -0
- data/app/commands/decidim/admin/{unpublish_feature.rb → unpublish_component.rb} +12 -12
- data/app/commands/decidim/admin/update_area.rb +5 -1
- data/app/commands/decidim/admin/update_component.rb +62 -0
- data/app/commands/decidim/admin/{update_feature_permissions.rb → update_component_permissions.rb} +10 -10
- data/app/commands/decidim/admin/update_oauth_application.rb +39 -0
- data/app/controllers/decidim/admin/application_controller.rb +1 -1
- data/app/controllers/decidim/admin/areas_controller.rb +6 -4
- data/app/controllers/decidim/admin/{feature_permissions_controller.rb → component_permissions_controller.rb} +12 -12
- data/app/controllers/decidim/admin/{features → components}/base_controller.rb +9 -9
- data/app/controllers/decidim/admin/components_controller.rb +142 -0
- data/app/controllers/decidim/admin/concerns/has_private_users.rb +102 -0
- data/app/controllers/decidim/admin/dashboard_controller.rb +1 -1
- data/app/controllers/decidim/admin/exports_controller.rb +6 -6
- data/app/controllers/decidim/admin/impersonatable_users_controller.rb +29 -0
- data/app/controllers/decidim/admin/impersonations_controller.rb +122 -0
- data/app/controllers/decidim/admin/logs_controller.rb +1 -1
- data/app/controllers/decidim/admin/managed_users/impersonation_logs_controller.rb +25 -0
- data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +3 -5
- data/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
- data/app/controllers/decidim/admin/oauth_applications_controller.rb +90 -0
- data/app/controllers/decidim/admin/officializations_controller.rb +4 -3
- data/app/events/decidim/component_published_event.rb +6 -0
- data/app/forms/decidim/admin/{feature_form.rb → component_form.rb} +3 -3
- data/app/forms/decidim/admin/impersonate_user_form.rb +26 -0
- data/app/forms/decidim/admin/oauth_application_form.rb +32 -0
- data/app/forms/decidim/admin/organization_appearance_form.rb +6 -1
- data/app/forms/decidim/admin/organization_form.rb +1 -1
- data/app/forms/decidim/admin/participatory_space_private_user_form.rb +18 -0
- data/app/forms/decidim/admin/permissions_form.rb +1 -1
- data/app/helpers/decidim/admin/attributes_display_helper.rb +10 -3
- data/app/helpers/decidim/admin/bulk_actions_helper.rb +36 -0
- data/app/helpers/decidim/admin/exports_helper.rb +10 -10
- data/app/helpers/decidim/admin/settings_helper.rb +1 -1
- data/app/models/decidim/admin/abilities/admin_ability.rb +12 -9
- data/app/models/decidim/admin/abilities/participatory_process_admin_ability.rb +2 -2
- data/app/models/decidim/admin/abilities/user_manager_ability.rb +7 -6
- data/app/queries/decidim/admin/user_filter.rb +59 -0
- data/app/views/decidim/admin/area_types/edit.html.erb +1 -1
- data/app/views/decidim/admin/area_types/index.html.erb +2 -2
- data/app/views/decidim/admin/area_types/new.html.erb +1 -1
- data/app/views/decidim/admin/areas/edit.html.erb +1 -1
- data/app/views/decidim/admin/areas/index.html.erb +2 -2
- data/app/views/decidim/admin/areas/new.html.erb +1 -1
- data/app/views/decidim/admin/attachment_collections/edit.html.erb +1 -1
- data/app/views/decidim/admin/attachment_collections/index.html.erb +2 -2
- data/app/views/decidim/admin/attachment_collections/new.html.erb +1 -1
- data/app/views/decidim/admin/attachment_collections/show.html.erb +2 -3
- data/app/views/decidim/admin/attachments/edit.html.erb +1 -1
- data/app/views/decidim/admin/attachments/index.html.erb +1 -1
- data/app/views/decidim/admin/attachments/new.html.erb +1 -1
- data/app/views/decidim/admin/attachments/show.html.erb +2 -3
- data/app/views/decidim/admin/bulk_actions/_recategorize.html.erb +1 -1
- data/app/views/decidim/admin/categories/edit.html.erb +1 -1
- data/app/views/decidim/admin/categories/index.html.erb +2 -2
- data/app/views/decidim/admin/categories/new.html.erb +1 -1
- data/app/views/decidim/admin/categories/show.html.erb +2 -3
- data/app/views/decidim/admin/{feature_permissions → component_permissions}/edit.html.erb +3 -3
- data/app/views/decidim/admin/components/_component.html.erb +37 -0
- data/app/views/decidim/admin/{features → components}/_form.html.erb +6 -6
- data/app/views/decidim/admin/{features → components}/_settings_fields.html.erb +2 -2
- data/app/views/decidim/admin/components/edit.html.erb +7 -0
- data/app/views/decidim/admin/{features → components}/index.html.erb +6 -6
- data/app/views/decidim/admin/components/new.html.erb +8 -0
- data/app/views/decidim/admin/devise/mailers/reset_password_instructions.html.erb +1 -1
- data/app/views/decidim/admin/exports/_dropdown.html.erb +3 -3
- data/app/views/decidim/admin/impersonatable_users/index.html.erb +84 -0
- data/app/views/decidim/admin/impersonations/_form.html.erb +40 -0
- data/app/views/decidim/admin/impersonations/_handler_form.html.erb +5 -0
- data/app/views/decidim/admin/impersonations/new.html.erb +23 -0
- data/app/views/decidim/admin/managed_users/{impersonations → impersonation_logs}/index.html.erb +2 -0
- data/app/views/decidim/admin/managed_users/promotions/new.html.erb +4 -4
- data/app/views/decidim/admin/moderations/index.html.erb +2 -2
- data/app/views/decidim/admin/newsletters/_form.html.erb +1 -1
- data/app/views/decidim/admin/newsletters/edit.html.erb +1 -1
- data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
- data/app/views/decidim/admin/newsletters/new.html.erb +1 -1
- data/app/views/decidim/admin/newsletters/show.html.erb +1 -1
- data/app/views/decidim/admin/oauth_applications/_form.html.erb +19 -0
- data/app/views/decidim/admin/oauth_applications/edit.html.erb +13 -0
- data/app/views/decidim/admin/oauth_applications/index.html.erb +38 -0
- data/app/views/decidim/admin/oauth_applications/new.html.erb +13 -0
- data/app/views/decidim/admin/oauth_applications/show.html.erb +27 -0
- data/app/views/decidim/admin/officializations/index.html.erb +2 -2
- data/app/views/decidim/admin/officializations/new.html.erb +2 -2
- data/app/views/decidim/admin/organization/_form.html.erb +1 -1
- data/app/views/decidim/admin/organization/edit.html.erb +1 -2
- data/app/views/decidim/admin/organization_appearance/edit.html.erb +1 -2
- data/app/views/decidim/admin/participatory_space_private_users/_form.html.erb +18 -0
- data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +59 -0
- data/app/views/decidim/admin/participatory_space_private_users/new.html.erb +7 -0
- data/app/views/decidim/admin/scope_types/edit.html.erb +1 -1
- data/app/views/decidim/admin/scope_types/index.html.erb +2 -2
- data/app/views/decidim/admin/scope_types/new.html.erb +1 -1
- data/app/views/decidim/admin/scopes/edit.html.erb +1 -1
- data/app/views/decidim/admin/scopes/index.html.erb +3 -3
- data/app/views/decidim/admin/scopes/new.html.erb +1 -1
- data/app/views/decidim/admin/static_pages/edit.html.erb +1 -1
- data/app/views/decidim/admin/static_pages/index.html.erb +3 -3
- data/app/views/decidim/admin/static_pages/new.html.erb +1 -1
- data/app/views/decidim/admin/static_pages/show.html.erb +2 -3
- data/app/views/decidim/admin/user_groups/index.html.erb +3 -3
- data/app/views/decidim/admin/users/_form.html.erb +3 -3
- data/app/views/decidim/admin/users/index.html.erb +2 -2
- data/app/views/decidim/admin/users/new.html.erb +1 -1
- data/app/views/layouts/decidim/admin/_application.html.erb +9 -9
- data/app/views/layouts/decidim/admin/_header.html.erb +3 -4
- data/app/views/layouts/decidim/admin/_template_top.html.erb +1 -1
- data/app/views/layouts/decidim/admin/_title_bar.html.erb +1 -1
- data/app/views/layouts/decidim/admin/login.html.erb +1 -1
- data/app/views/layouts/decidim/admin/pages.html.erb +1 -1
- data/app/views/layouts/decidim/admin/users.html.erb +5 -3
- data/config/locales/ca.yml +119 -50
- data/config/locales/en.yml +119 -50
- data/config/locales/es.yml +120 -51
- data/config/locales/eu.yml +122 -53
- data/config/locales/fi.yml +121 -52
- data/config/locales/fr.yml +159 -90
- data/config/locales/gl.yml +119 -50
- data/config/locales/it.yml +120 -51
- data/config/locales/nl.yml +207 -138
- data/config/locales/pl.yml +119 -50
- data/config/locales/pt-BR.yml +120 -51
- data/config/locales/pt.yml +120 -51
- data/config/locales/ru.yml +7 -51
- data/config/locales/sv.yml +120 -51
- data/config/locales/uk.yml +7 -52
- data/config/routes.rb +6 -2
- data/db/migrate/20180413233318_add_reason_to_decidim_impersonation_logs.rb +7 -0
- data/lib/decidim/admin/components.rb +11 -0
- data/lib/decidim/admin/engine.rb +12 -3
- data/lib/decidim/admin/test/forms/attachment_collection_form_examples.rb +9 -9
- data/lib/decidim/admin/test/forms/attachment_form_examples.rb +1 -1
- data/lib/decidim/admin/test/forms/category_form_examples.rb +11 -11
- data/lib/decidim/admin/test/{manage_feature_permissions_examples.rb → manage_component_permissions_examples.rb} +9 -9
- data/lib/decidim/admin/test/manage_moderations_examples.rb +2 -2
- data/lib/decidim/admin/test.rb +1 -1
- data/lib/decidim/admin/version.rb +1 -1
- data/lib/decidim/admin.rb +1 -1
- metadata +66 -43
- data/app/commands/decidim/admin/create_managed_user.rb +0 -69
- data/app/commands/decidim/admin/publish_feature.rb +0 -51
- data/app/commands/decidim/admin/update_feature.rb +0 -62
- data/app/controllers/decidim/admin/features_controller.rb +0 -142
- data/app/controllers/decidim/admin/managed_users/impersonations_controller.rb +0 -78
- data/app/controllers/decidim/admin/managed_users_controller.rb +0 -83
- data/app/events/decidim/feature_published_event.rb +0 -6
- data/app/forms/decidim/admin/impersonate_managed_user_form.rb +0 -20
- data/app/forms/decidim/admin/managed_user_form.rb +0 -24
- data/app/queries/decidim/admin/users_officialization.rb +0 -56
- data/app/views/decidim/admin/features/_feature.html.erb +0 -37
- data/app/views/decidim/admin/features/edit.html.erb +0 -7
- data/app/views/decidim/admin/features/new.html.erb +0 -8
- data/app/views/decidim/admin/managed_users/_form.html.erb +0 -12
- data/app/views/decidim/admin/managed_users/impersonations/_form.html.erb +0 -10
- data/app/views/decidim/admin/managed_users/impersonations/new.html.erb +0 -15
- data/app/views/decidim/admin/managed_users/index.html.erb +0 -44
- data/app/views/decidim/admin/managed_users/new.html.erb +0 -47
- data/lib/decidim/admin/features.rb +0 -11
data/config/locales/uk.yml
CHANGED
@@ -21,8 +21,6 @@ uk:
|
|
21
21
|
description: Опис
|
22
22
|
name: Ім'я
|
23
23
|
parent_id: Батьківський об'єкт
|
24
|
-
feature:
|
25
|
-
name: Ім'я
|
26
24
|
id: Псевдонім
|
27
25
|
newsletter:
|
28
26
|
body: Основний текст
|
@@ -212,59 +210,20 @@ uk:
|
|
212
210
|
exports:
|
213
211
|
export_as: "%{name} як %{export_format}"
|
214
212
|
notice: Зараз відбувається збереження у вигляді файлу. Ви отримаєте електронного листа після його завершення.
|
215
|
-
|
216
|
-
create:
|
217
|
-
error: При додаванні цієї складової сталася помилка.
|
218
|
-
success: Складову успішно додано.
|
219
|
-
destroy:
|
220
|
-
error: При видаленні цієї складової сталася помилка.
|
221
|
-
success: Складову успішно видалено.
|
222
|
-
edit:
|
223
|
-
title: Редагувати складову
|
224
|
-
update: Оновити
|
213
|
+
impersonatable_users:
|
225
214
|
index:
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
type: Різновид складової
|
231
|
-
new:
|
232
|
-
add: Додати складову
|
233
|
-
title: 'Додати складову: %{name}'
|
234
|
-
publish:
|
235
|
-
success: Складову було успішно опубліковано.
|
236
|
-
title: Складові
|
237
|
-
unpublish:
|
238
|
-
success: Публікацію складової було успішно скасовано.
|
239
|
-
update:
|
240
|
-
error: При оновленні цієї складової сталася помилка.
|
241
|
-
success: Цю складову було успішно оновлено.
|
242
|
-
managed_users:
|
215
|
+
impersonate: Виступити в ролі учасника
|
216
|
+
needs_authorization_warning: Для цієї організації потрібно мати принаймні один спосіб підтвердження особи.
|
217
|
+
view_logs: Переглянути журнали
|
218
|
+
impersonations:
|
243
219
|
close_session:
|
244
220
|
error: При закритті поточного сеансу уособлення сталася помилка.
|
245
221
|
success: Поточний сеанс виступу в ролі учасника успішно завершено.
|
246
222
|
create:
|
247
|
-
error: При створенні керованого учасника сталася помилка.
|
248
223
|
success: Керованого учасника було успішно створено.
|
249
|
-
form:
|
250
|
-
name: Ім'я
|
251
|
-
impersonate:
|
252
|
-
error: При видаванні себе за керованого учасника сталася помилка.
|
253
|
-
impersonations:
|
254
|
-
new:
|
255
|
-
impersonate: Виступити в ролі учасника
|
256
|
-
new_managed_user_impersonation: Новий виступ в ролі керованого учасника
|
257
|
-
index:
|
258
|
-
impersonate: Виступити в ролі учасника
|
259
|
-
needs_authoriation_warning: Для цієї організації потрібно мати принаймні один спосіб підтвердження особи.
|
260
|
-
promote: Підвищити
|
261
|
-
view_logs: Переглянути журнали
|
262
224
|
new:
|
263
|
-
|
264
|
-
|
265
|
-
no_authorization_handlers: Немає доступних шляхів підтвердження особи для керування учасниками. Будь ласка, зв'яжіться зі своїм системним адміністратором.
|
266
|
-
select_authorization_method: Оберіть спосіб підтвердження своєї особи
|
267
|
-
step: '%{current}-й крок з %{total} кроків'
|
225
|
+
impersonate: Виступити в ролі учасника
|
226
|
+
managed_users:
|
268
227
|
promotion:
|
269
228
|
error: При підвищенні керованого учасника сталася помилка.
|
270
229
|
success: Керованого учасника було успішно підвищено.
|
@@ -281,7 +240,6 @@ uk:
|
|
281
240
|
areas: Терени
|
282
241
|
configuration: Конфігурація
|
283
242
|
dashboard: Приладна дошка
|
284
|
-
managed_users: Керовані учасники
|
285
243
|
newsletters: Розсилання новин
|
286
244
|
officializations: Надання офіційного статусу
|
287
245
|
scope_types: Різновиди терену
|
@@ -317,8 +275,6 @@ uk:
|
|
317
275
|
expired_at: 'Термін дії закінчився:'
|
318
276
|
started_at: Започатковано о
|
319
277
|
user: Учасник
|
320
|
-
managed_user:
|
321
|
-
name: Керований учасник
|
322
278
|
newsletter:
|
323
279
|
fields:
|
324
280
|
created_at: 'Створено:'
|
@@ -503,7 +459,6 @@ uk:
|
|
503
459
|
authorization_workflows: Методи підтвердження особи
|
504
460
|
dashboard: Приладна дошка
|
505
461
|
impersonations: Виступи в ролі учасника
|
506
|
-
managed_users: Керовані учасники
|
507
462
|
officializations: Надання офіційного статусу
|
508
463
|
scope_types: Різновиди терену
|
509
464
|
scopes: Терени
|
data/config/routes.rb
CHANGED
@@ -18,6 +18,7 @@ Decidim::Admin::Engine.routes.draw do
|
|
18
18
|
resources :logs, only: [:index]
|
19
19
|
resources :area_types, except: [:show]
|
20
20
|
resources :areas, except: [:show]
|
21
|
+
|
21
22
|
resources :authorization_workflows, only: :index
|
22
23
|
|
23
24
|
Decidim.authorization_admin_engines.each do |manifest|
|
@@ -32,9 +33,10 @@ Decidim::Admin::Engine.routes.draw do
|
|
32
33
|
|
33
34
|
resources :officializations, only: [:new, :create, :index, :destroy], param: :user_id
|
34
35
|
|
35
|
-
resources :
|
36
|
+
resources :impersonatable_users, only: [:index] do
|
36
37
|
resources :promotions, controller: "managed_users/promotions", only: [:new, :create]
|
37
|
-
resources :
|
38
|
+
resources :impersonation_logs, controller: "managed_users/impersonation_logs", only: [:index]
|
39
|
+
resources :impersonations, controller: "managed_users/impersonations", only: [:new, :create] do
|
38
40
|
collection do
|
39
41
|
post :close_session
|
40
42
|
end
|
@@ -55,6 +57,8 @@ Decidim::Admin::Engine.routes.draw do
|
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
60
|
+
resources :oauth_applications
|
61
|
+
|
58
62
|
root to: "dashboard#show"
|
59
63
|
end
|
60
64
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
# This module contains all logic related to Components and how they're handled
|
6
|
+
# at the admin panel level.
|
7
|
+
module Components
|
8
|
+
autoload :BaseController, "decidim/admin/components/base_controller"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/decidim/admin/engine.rb
CHANGED
@@ -12,6 +12,8 @@ require "foundation-rails"
|
|
12
12
|
require "foundation_rails_helper"
|
13
13
|
require "autoprefixer-rails"
|
14
14
|
require "rectify"
|
15
|
+
require "doorkeeper"
|
16
|
+
require "doorkeeper-i18n"
|
15
17
|
|
16
18
|
module Decidim
|
17
19
|
module Admin
|
@@ -57,11 +59,11 @@ module Decidim
|
|
57
59
|
if: can?(:read, Decidim::StaticPage)
|
58
60
|
|
59
61
|
menu.item I18n.t("menu.users", scope: "decidim.admin"),
|
60
|
-
can?(:read, :admin_users) ? decidim_admin.users_path : decidim_admin.
|
62
|
+
can?(:read, :admin_users) ? decidim_admin.users_path : decidim_admin.impersonatable_users_path,
|
61
63
|
icon_name: "person",
|
62
64
|
position: 5,
|
63
|
-
active: [%w(
|
64
|
-
if: can?(:read, :admin_users) || can?(:read, :
|
65
|
+
active: [%w(user_groups users managed_users impersonatable_users authorization_workflows).map { |segment| "/decidim/admin/#{segment}" }, []],
|
66
|
+
if: can?(:read, :admin_users) || can?(:read, :impersonatable_users)
|
65
67
|
|
66
68
|
menu.item I18n.t("menu.newsletters", scope: "decidim.admin"),
|
67
69
|
decidim_admin.newsletters_path,
|
@@ -83,6 +85,13 @@ module Decidim
|
|
83
85
|
position: 10,
|
84
86
|
active: [%w(decidim/admin/logs), []],
|
85
87
|
if: can?(:read, :admin_log)
|
88
|
+
|
89
|
+
menu.item I18n.t("menu.oauth_applications", scope: "decidim.admin"),
|
90
|
+
decidim_admin.oauth_applications_path,
|
91
|
+
icon_name: "dashboard",
|
92
|
+
position: 11,
|
93
|
+
active: [%w(decidim/admin/oauth_applications), []],
|
94
|
+
if: can?(:read, :oauth_applications)
|
86
95
|
end
|
87
96
|
end
|
88
97
|
end
|
@@ -5,6 +5,15 @@ require "spec_helper"
|
|
5
5
|
module Decidim
|
6
6
|
module Admin
|
7
7
|
shared_examples_for "attachment collection form" do
|
8
|
+
subject do
|
9
|
+
described_class.from_params(
|
10
|
+
attributes
|
11
|
+
).with_context(
|
12
|
+
collection_for: collection_for,
|
13
|
+
current_organization: organization
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
8
17
|
let(:name) do
|
9
18
|
{
|
10
19
|
en: "My attachment collection",
|
@@ -34,15 +43,6 @@ module Decidim
|
|
34
43
|
end
|
35
44
|
let(:organization) { create :organization }
|
36
45
|
|
37
|
-
subject do
|
38
|
-
described_class.from_params(
|
39
|
-
attributes
|
40
|
-
).with_context(
|
41
|
-
collection_for: collection_for,
|
42
|
-
current_organization: organization
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
46
|
context "with correct data" do
|
47
47
|
it "is valid" do
|
48
48
|
expect(subject).to be_valid
|
@@ -5,6 +5,15 @@ require "spec_helper"
|
|
5
5
|
module Decidim
|
6
6
|
module Admin
|
7
7
|
shared_examples_for "category form" do
|
8
|
+
subject do
|
9
|
+
described_class.from_params(
|
10
|
+
attributes
|
11
|
+
).with_context(
|
12
|
+
current_participatory_space: participatory_space,
|
13
|
+
current_organization: organization
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
8
17
|
let(:name) do
|
9
18
|
{
|
10
19
|
en: "Name",
|
@@ -35,15 +44,6 @@ module Decidim
|
|
35
44
|
end
|
36
45
|
let(:organization) { create :organization }
|
37
46
|
|
38
|
-
subject do
|
39
|
-
described_class.from_params(
|
40
|
-
attributes
|
41
|
-
).with_context(
|
42
|
-
current_participatory_space: participatory_space,
|
43
|
-
current_organization: organization
|
44
|
-
)
|
45
|
-
end
|
46
|
-
|
47
47
|
context "when everything is OK" do
|
48
48
|
it { is_expected.to be_valid }
|
49
49
|
end
|
@@ -72,13 +72,13 @@ module Decidim
|
|
72
72
|
context "when the parent_id is set" do
|
73
73
|
let!(:category) { create :category, participatory_space: participatory_space }
|
74
74
|
|
75
|
-
context "
|
75
|
+
context "and it is set to a first-class category" do
|
76
76
|
let(:parent_id) { category.id }
|
77
77
|
|
78
78
|
it { is_expected.to be_valid }
|
79
79
|
end
|
80
80
|
|
81
|
-
context "
|
81
|
+
context "and it is set to a subcategory" do
|
82
82
|
let!(:subcategory) { create :subcategory, parent: category }
|
83
83
|
let(:parent_id) { subcategory.id }
|
84
84
|
|
@@ -2,35 +2,35 @@
|
|
2
2
|
|
3
3
|
require "spec_helper"
|
4
4
|
|
5
|
-
shared_examples "Managing
|
5
|
+
shared_examples "Managing component permissions" do
|
6
6
|
let(:organization) { create(:organization, available_authorizations: ["dummy_authorization_handler"]) }
|
7
7
|
|
8
|
-
let!(:
|
9
|
-
create(:
|
8
|
+
let!(:component) do
|
9
|
+
create(:component, participatory_space: participatory_space)
|
10
10
|
end
|
11
11
|
|
12
12
|
before do
|
13
13
|
switch_to_host(organization.host)
|
14
14
|
login_as user, scope: :user
|
15
|
-
visit participatory_space_engine.
|
15
|
+
visit participatory_space_engine.components_path(participatory_space)
|
16
16
|
|
17
|
-
within ".
|
17
|
+
within ".component-#{component.id}" do
|
18
18
|
click_link "Permissions"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
it "allows setting permissions with json options" do
|
23
|
-
within "form.
|
23
|
+
within "form.new_component_permissions" do
|
24
24
|
within ".foo-permission" do
|
25
|
-
select "Example authorization", from: "
|
26
|
-
fill_in "
|
25
|
+
select "Example authorization", from: "component_permissions_permissions_foo_authorization_handler_name"
|
26
|
+
fill_in "component_permissions_permissions_foo_options", with: '{ "foo": 123 }'
|
27
27
|
end
|
28
28
|
find("*[type=submit]").click
|
29
29
|
end
|
30
30
|
|
31
31
|
expect(page).to have_content("successfully")
|
32
32
|
|
33
|
-
expect(
|
33
|
+
expect(component.reload.permissions["foo"]).to(
|
34
34
|
include(
|
35
35
|
"authorization_handler_name" => "dummy_authorization_handler",
|
36
36
|
"options" => { "foo" => 123 }
|
@@ -22,7 +22,7 @@ shared_examples "manage moderations" do
|
|
22
22
|
click_link "Moderations"
|
23
23
|
end
|
24
24
|
|
25
|
-
context "listing moderations" do
|
25
|
+
context "when listing moderations" do
|
26
26
|
it "user can review them" do
|
27
27
|
moderations.each do |moderation|
|
28
28
|
within "tr[data-id=\"#{moderation.id}\"]" do
|
@@ -50,7 +50,7 @@ shared_examples "manage moderations" do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
context "listing hidden resources" do
|
53
|
+
context "when listing hidden resources" do
|
54
54
|
it "user can review them" do
|
55
55
|
click_link "Hidden"
|
56
56
|
|
data/lib/decidim/admin/test.rb
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
|
3
3
|
require "decidim/admin/test/manage_attachments_examples"
|
4
4
|
require "decidim/admin/test/manage_attachment_collections_examples"
|
5
|
-
require "decidim/admin/test/
|
5
|
+
require "decidim/admin/test/manage_component_permissions_examples"
|
6
6
|
require "decidim/admin/test/manage_moderations_examples"
|