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.

Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/config/decidim_admin_manifest.js +1 -0
  4. data/app/assets/javascripts/decidim/admin/application.js.es6 +13 -5
  5. data/app/assets/javascripts/decidim/admin/auto_buttons_by_position.component.js.es6 +42 -0
  6. data/app/assets/javascripts/decidim/admin/auto_label_by_position.component.js.es6 +33 -0
  7. data/app/assets/javascripts/decidim/admin/dynamic_fields.component.js.es6 +163 -0
  8. data/app/assets/javascripts/decidim/admin/field_dependent_inputs.component.js.es6 +39 -0
  9. data/app/assets/javascripts/decidim/admin/managed_users.js.es6 +12 -0
  10. data/app/assets/javascripts/decidim/admin/sort_list.component.js.es6 +1 -1
  11. data/app/assets/javascripts/decidim/admin/subform_toggler.component.js.es6 +35 -0
  12. data/app/assets/javascripts/decidim/admin/tab_focus.js.es6 +4 -4
  13. data/app/assets/stylesheets/decidim/admin/application.scss.erb +1 -1
  14. data/app/assets/stylesheets/decidim/admin/extra/_dropdown_inverted.scss +7 -5
  15. data/app/assets/stylesheets/decidim/admin/modules/_agenda.scss +34 -0
  16. data/app/assets/stylesheets/decidim/admin/modules/_buttons.scss +5 -0
  17. data/app/assets/stylesheets/decidim/admin/modules/_cards.scss +15 -0
  18. data/app/assets/stylesheets/decidim/admin/modules/_forms.scss +4 -0
  19. data/app/assets/stylesheets/decidim/admin/modules/_modules.scss +1 -0
  20. data/app/assets/stylesheets/decidim/admin/modules/_typography.scss +8 -0
  21. data/app/assets/stylesheets/decidim/admin/utils/_flex.scss +2 -2
  22. data/app/assets/stylesheets/decidim/admin/utils/_helpers.scss +28 -0
  23. data/app/assets/stylesheets/decidim/admin/utils/_mixins.scss +44 -0
  24. data/app/commands/decidim/admin/create_area.rb +3 -1
  25. data/app/commands/decidim/admin/{create_feature.rb → create_component.rb} +11 -11
  26. data/app/commands/decidim/admin/create_oauth_application.rb +36 -0
  27. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +85 -0
  28. data/app/commands/decidim/admin/destroy_area.rb +42 -0
  29. data/app/commands/decidim/admin/{destroy_feature.rb → destroy_component.rb} +11 -11
  30. data/app/commands/decidim/admin/destroy_oauth_application.rb +39 -0
  31. data/app/commands/decidim/admin/{impersonate_managed_user.rb → impersonate_user.rb} +19 -13
  32. data/app/commands/decidim/admin/publish_component.rb +51 -0
  33. data/app/commands/decidim/admin/{unpublish_feature.rb → unpublish_component.rb} +12 -12
  34. data/app/commands/decidim/admin/update_area.rb +5 -1
  35. data/app/commands/decidim/admin/update_component.rb +62 -0
  36. data/app/commands/decidim/admin/{update_feature_permissions.rb → update_component_permissions.rb} +10 -10
  37. data/app/commands/decidim/admin/update_oauth_application.rb +39 -0
  38. data/app/controllers/decidim/admin/application_controller.rb +1 -1
  39. data/app/controllers/decidim/admin/areas_controller.rb +6 -4
  40. data/app/controllers/decidim/admin/{feature_permissions_controller.rb → component_permissions_controller.rb} +12 -12
  41. data/app/controllers/decidim/admin/{features → components}/base_controller.rb +9 -9
  42. data/app/controllers/decidim/admin/components_controller.rb +142 -0
  43. data/app/controllers/decidim/admin/concerns/has_private_users.rb +102 -0
  44. data/app/controllers/decidim/admin/dashboard_controller.rb +1 -1
  45. data/app/controllers/decidim/admin/exports_controller.rb +6 -6
  46. data/app/controllers/decidim/admin/impersonatable_users_controller.rb +29 -0
  47. data/app/controllers/decidim/admin/impersonations_controller.rb +122 -0
  48. data/app/controllers/decidim/admin/logs_controller.rb +1 -1
  49. data/app/controllers/decidim/admin/managed_users/impersonation_logs_controller.rb +25 -0
  50. data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +3 -5
  51. data/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
  52. data/app/controllers/decidim/admin/oauth_applications_controller.rb +90 -0
  53. data/app/controllers/decidim/admin/officializations_controller.rb +4 -3
  54. data/app/events/decidim/component_published_event.rb +6 -0
  55. data/app/forms/decidim/admin/{feature_form.rb → component_form.rb} +3 -3
  56. data/app/forms/decidim/admin/impersonate_user_form.rb +26 -0
  57. data/app/forms/decidim/admin/oauth_application_form.rb +32 -0
  58. data/app/forms/decidim/admin/organization_appearance_form.rb +6 -1
  59. data/app/forms/decidim/admin/organization_form.rb +1 -1
  60. data/app/forms/decidim/admin/participatory_space_private_user_form.rb +18 -0
  61. data/app/forms/decidim/admin/permissions_form.rb +1 -1
  62. data/app/helpers/decidim/admin/attributes_display_helper.rb +10 -3
  63. data/app/helpers/decidim/admin/bulk_actions_helper.rb +36 -0
  64. data/app/helpers/decidim/admin/exports_helper.rb +10 -10
  65. data/app/helpers/decidim/admin/settings_helper.rb +1 -1
  66. data/app/models/decidim/admin/abilities/admin_ability.rb +12 -9
  67. data/app/models/decidim/admin/abilities/participatory_process_admin_ability.rb +2 -2
  68. data/app/models/decidim/admin/abilities/user_manager_ability.rb +7 -6
  69. data/app/queries/decidim/admin/user_filter.rb +59 -0
  70. data/app/views/decidim/admin/area_types/edit.html.erb +1 -1
  71. data/app/views/decidim/admin/area_types/index.html.erb +2 -2
  72. data/app/views/decidim/admin/area_types/new.html.erb +1 -1
  73. data/app/views/decidim/admin/areas/edit.html.erb +1 -1
  74. data/app/views/decidim/admin/areas/index.html.erb +2 -2
  75. data/app/views/decidim/admin/areas/new.html.erb +1 -1
  76. data/app/views/decidim/admin/attachment_collections/edit.html.erb +1 -1
  77. data/app/views/decidim/admin/attachment_collections/index.html.erb +2 -2
  78. data/app/views/decidim/admin/attachment_collections/new.html.erb +1 -1
  79. data/app/views/decidim/admin/attachment_collections/show.html.erb +2 -3
  80. data/app/views/decidim/admin/attachments/edit.html.erb +1 -1
  81. data/app/views/decidim/admin/attachments/index.html.erb +1 -1
  82. data/app/views/decidim/admin/attachments/new.html.erb +1 -1
  83. data/app/views/decidim/admin/attachments/show.html.erb +2 -3
  84. data/app/views/decidim/admin/bulk_actions/_recategorize.html.erb +1 -1
  85. data/app/views/decidim/admin/categories/edit.html.erb +1 -1
  86. data/app/views/decidim/admin/categories/index.html.erb +2 -2
  87. data/app/views/decidim/admin/categories/new.html.erb +1 -1
  88. data/app/views/decidim/admin/categories/show.html.erb +2 -3
  89. data/app/views/decidim/admin/{feature_permissions → component_permissions}/edit.html.erb +3 -3
  90. data/app/views/decidim/admin/components/_component.html.erb +37 -0
  91. data/app/views/decidim/admin/{features → components}/_form.html.erb +6 -6
  92. data/app/views/decidim/admin/{features → components}/_settings_fields.html.erb +2 -2
  93. data/app/views/decidim/admin/components/edit.html.erb +7 -0
  94. data/app/views/decidim/admin/{features → components}/index.html.erb +6 -6
  95. data/app/views/decidim/admin/components/new.html.erb +8 -0
  96. data/app/views/decidim/admin/devise/mailers/reset_password_instructions.html.erb +1 -1
  97. data/app/views/decidim/admin/exports/_dropdown.html.erb +3 -3
  98. data/app/views/decidim/admin/impersonatable_users/index.html.erb +84 -0
  99. data/app/views/decidim/admin/impersonations/_form.html.erb +40 -0
  100. data/app/views/decidim/admin/impersonations/_handler_form.html.erb +5 -0
  101. data/app/views/decidim/admin/impersonations/new.html.erb +23 -0
  102. data/app/views/decidim/admin/managed_users/{impersonations → impersonation_logs}/index.html.erb +2 -0
  103. data/app/views/decidim/admin/managed_users/promotions/new.html.erb +4 -4
  104. data/app/views/decidim/admin/moderations/index.html.erb +2 -2
  105. data/app/views/decidim/admin/newsletters/_form.html.erb +1 -1
  106. data/app/views/decidim/admin/newsletters/edit.html.erb +1 -1
  107. data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
  108. data/app/views/decidim/admin/newsletters/new.html.erb +1 -1
  109. data/app/views/decidim/admin/newsletters/show.html.erb +1 -1
  110. data/app/views/decidim/admin/oauth_applications/_form.html.erb +19 -0
  111. data/app/views/decidim/admin/oauth_applications/edit.html.erb +13 -0
  112. data/app/views/decidim/admin/oauth_applications/index.html.erb +38 -0
  113. data/app/views/decidim/admin/oauth_applications/new.html.erb +13 -0
  114. data/app/views/decidim/admin/oauth_applications/show.html.erb +27 -0
  115. data/app/views/decidim/admin/officializations/index.html.erb +2 -2
  116. data/app/views/decidim/admin/officializations/new.html.erb +2 -2
  117. data/app/views/decidim/admin/organization/_form.html.erb +1 -1
  118. data/app/views/decidim/admin/organization/edit.html.erb +1 -2
  119. data/app/views/decidim/admin/organization_appearance/edit.html.erb +1 -2
  120. data/app/views/decidim/admin/participatory_space_private_users/_form.html.erb +18 -0
  121. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +59 -0
  122. data/app/views/decidim/admin/participatory_space_private_users/new.html.erb +7 -0
  123. data/app/views/decidim/admin/scope_types/edit.html.erb +1 -1
  124. data/app/views/decidim/admin/scope_types/index.html.erb +2 -2
  125. data/app/views/decidim/admin/scope_types/new.html.erb +1 -1
  126. data/app/views/decidim/admin/scopes/edit.html.erb +1 -1
  127. data/app/views/decidim/admin/scopes/index.html.erb +3 -3
  128. data/app/views/decidim/admin/scopes/new.html.erb +1 -1
  129. data/app/views/decidim/admin/static_pages/edit.html.erb +1 -1
  130. data/app/views/decidim/admin/static_pages/index.html.erb +3 -3
  131. data/app/views/decidim/admin/static_pages/new.html.erb +1 -1
  132. data/app/views/decidim/admin/static_pages/show.html.erb +2 -3
  133. data/app/views/decidim/admin/user_groups/index.html.erb +3 -3
  134. data/app/views/decidim/admin/users/_form.html.erb +3 -3
  135. data/app/views/decidim/admin/users/index.html.erb +2 -2
  136. data/app/views/decidim/admin/users/new.html.erb +1 -1
  137. data/app/views/layouts/decidim/admin/_application.html.erb +9 -9
  138. data/app/views/layouts/decidim/admin/_header.html.erb +3 -4
  139. data/app/views/layouts/decidim/admin/_template_top.html.erb +1 -1
  140. data/app/views/layouts/decidim/admin/_title_bar.html.erb +1 -1
  141. data/app/views/layouts/decidim/admin/login.html.erb +1 -1
  142. data/app/views/layouts/decidim/admin/pages.html.erb +1 -1
  143. data/app/views/layouts/decidim/admin/users.html.erb +5 -3
  144. data/config/locales/ca.yml +119 -50
  145. data/config/locales/en.yml +119 -50
  146. data/config/locales/es.yml +120 -51
  147. data/config/locales/eu.yml +122 -53
  148. data/config/locales/fi.yml +121 -52
  149. data/config/locales/fr.yml +159 -90
  150. data/config/locales/gl.yml +119 -50
  151. data/config/locales/it.yml +120 -51
  152. data/config/locales/nl.yml +207 -138
  153. data/config/locales/pl.yml +119 -50
  154. data/config/locales/pt-BR.yml +120 -51
  155. data/config/locales/pt.yml +120 -51
  156. data/config/locales/ru.yml +7 -51
  157. data/config/locales/sv.yml +120 -51
  158. data/config/locales/uk.yml +7 -52
  159. data/config/routes.rb +6 -2
  160. data/db/migrate/20180413233318_add_reason_to_decidim_impersonation_logs.rb +7 -0
  161. data/lib/decidim/admin/components.rb +11 -0
  162. data/lib/decidim/admin/engine.rb +12 -3
  163. data/lib/decidim/admin/test/forms/attachment_collection_form_examples.rb +9 -9
  164. data/lib/decidim/admin/test/forms/attachment_form_examples.rb +1 -1
  165. data/lib/decidim/admin/test/forms/category_form_examples.rb +11 -11
  166. data/lib/decidim/admin/test/{manage_feature_permissions_examples.rb → manage_component_permissions_examples.rb} +9 -9
  167. data/lib/decidim/admin/test/manage_moderations_examples.rb +2 -2
  168. data/lib/decidim/admin/test.rb +1 -1
  169. data/lib/decidim/admin/version.rb +1 -1
  170. data/lib/decidim/admin.rb +1 -1
  171. metadata +66 -43
  172. data/app/commands/decidim/admin/create_managed_user.rb +0 -69
  173. data/app/commands/decidim/admin/publish_feature.rb +0 -51
  174. data/app/commands/decidim/admin/update_feature.rb +0 -62
  175. data/app/controllers/decidim/admin/features_controller.rb +0 -142
  176. data/app/controllers/decidim/admin/managed_users/impersonations_controller.rb +0 -78
  177. data/app/controllers/decidim/admin/managed_users_controller.rb +0 -83
  178. data/app/events/decidim/feature_published_event.rb +0 -6
  179. data/app/forms/decidim/admin/impersonate_managed_user_form.rb +0 -20
  180. data/app/forms/decidim/admin/managed_user_form.rb +0 -24
  181. data/app/queries/decidim/admin/users_officialization.rb +0 -56
  182. data/app/views/decidim/admin/features/_feature.html.erb +0 -37
  183. data/app/views/decidim/admin/features/edit.html.erb +0 -7
  184. data/app/views/decidim/admin/features/new.html.erb +0 -8
  185. data/app/views/decidim/admin/managed_users/_form.html.erb +0 -12
  186. data/app/views/decidim/admin/managed_users/impersonations/_form.html.erb +0 -10
  187. data/app/views/decidim/admin/managed_users/impersonations/new.html.erb +0 -15
  188. data/app/views/decidim/admin/managed_users/index.html.erb +0 -44
  189. data/app/views/decidim/admin/managed_users/new.html.erb +0 -47
  190. data/lib/decidim/admin/features.rb +0 -11
@@ -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
- features:
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
- add: Додати складову
227
- headers:
228
- actions: Дії
229
- name: Назва складової
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
- create: Створити
264
- new_managed_user: Новий керований учасник
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 :managed_users, controller: "managed_users", except: [:edit, :update] do
36
+ resources :impersonatable_users, only: [:index] do
36
37
  resources :promotions, controller: "managed_users/promotions", only: [:new, :create]
37
- resources :impersonations, controller: "managed_users/impersonations", only: [:index, :new, :create] do
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,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddReasonToDecidimImpersonationLogs < ActiveRecord::Migration[5.1]
4
+ def change
5
+ add_column :decidim_impersonation_logs, :reason, :text
6
+ end
7
+ 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
@@ -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.managed_users_path,
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(decidim/admin/user_groups decidim/admin/users decidim/admin/managed_users decidim/admin/authorization_workflows), []],
64
- if: can?(:read, :admin_users) || can?(:read, :managed_users)
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
@@ -51,7 +51,7 @@ module Decidim
51
51
 
52
52
  it { is_expected.to be_valid }
53
53
 
54
- context "whe the title is not present" do
54
+ context "when the title is not present" do
55
55
  let(:title) { { en: nil } }
56
56
 
57
57
  it { is_expected.not_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 "to the ID of a first-class category" do
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 "to the ID of a subcategory" do
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 feature permissions" do
5
+ shared_examples "Managing component permissions" do
6
6
  let(:organization) { create(:organization, available_authorizations: ["dummy_authorization_handler"]) }
7
7
 
8
- let!(:feature) do
9
- create(:feature, participatory_space: participatory_space)
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.features_path(participatory_space)
15
+ visit participatory_space_engine.components_path(participatory_space)
16
16
 
17
- within ".feature-#{feature.id}" do
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.new_feature_permissions" do
23
+ within "form.new_component_permissions" do
24
24
  within ".foo-permission" do
25
- select "Example authorization", from: "feature_permissions_permissions_foo_authorization_handler_name"
26
- fill_in "feature_permissions_permissions_foo_options", with: '{ "foo": 123 }'
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(feature.reload.permissions["foo"]).to(
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
 
@@ -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/manage_feature_permissions_examples"
5
+ require "decidim/admin/test/manage_component_permissions_examples"
6
6
  require "decidim/admin/test/manage_moderations_examples"
@@ -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.10.1"
7
+ "0.11.0.pre1"
8
8
  end
9
9
  end
10
10
  end
data/lib/decidim/admin.rb CHANGED
@@ -9,6 +9,6 @@ module Decidim
9
9
  # eye view of the whole admin.
10
10
  #
11
11
  module Admin
12
- autoload :Features, "decidim/admin/features"
12
+ autoload :Components, "decidim/admin/components"
13
13
  end
14
14
  end