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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 275f84e183275612a1add39ce3da32b9277ffda9137d3c854c4598096a170875
4
- data.tar.gz: 98d895bffe24589ceafea8bc8b239252bc1f6e81353e018fbc0c971820586a8b
3
+ metadata.gz: e66b30e2476e200011abd836e27bf1bb39693cf379e764b355098b8db233f674
4
+ data.tar.gz: cfcc74ee98f3205d5f82a5bc8300d8c08d8eabc4d8ee2e53e5216545a86a2aae
5
5
  SHA512:
6
- metadata.gz: 3cf5ce72651241f58724e698cbdd66a005609e642b2d8091c51d8ca782d1c8d00297fdc6591af4124bb233a384c9918d8d905de88ea95a9de63f4c428278828a
7
- data.tar.gz: c7a1d0374a0f2d044415bebfc6a174d4e8e13ca198788127ce54cdb47d989e2e3a2caee54ef9d2b8f984d8cf1772499a047dbafe0a45934bb610cd9e6f367959
6
+ metadata.gz: e8c7e24b71a4063babc7d6a4336e02a3aafea2c731a69af9e277e9daef0273119f5ee2738410671560a00c7d5cbeb77c7725e221f7d423235f499e7dd9b4c9c8
7
+ data.tar.gz: 3d85b2913258ed6d2ed2274b715bbd7fea7363ce82943c00f45f5e2bdf6800058b005b6d85c94074b5e7b2596c63a0446d01ebe8cef156a3c920f61530191238
data/README.md CHANGED
@@ -22,11 +22,11 @@ And then execute:
22
22
  bundle
23
23
  ```
24
24
 
25
- ## Features
25
+ ## Components
26
26
 
27
27
  ### Static pages
28
28
 
29
- This feature allows an admin to create pages to serve static content. Some
29
+ This component allows an admin to create pages to serve static content. Some
30
30
  example of this kind of pages could be:
31
31
 
32
32
  * Terms and Conditions
@@ -1,2 +1,3 @@
1
1
  //= link decidim/admin/application.js
2
+ //= link decidim/admin/managed_users.js
2
3
  //= link decidim/admin/application.css
@@ -10,6 +10,10 @@
10
10
  // = require moment.min
11
11
  // = require decidim/data_picker
12
12
  // = require jquery.auto-complete
13
+ // = require ./auto_label_by_position.component
14
+ // = require ./auto_buttons_by_position.component
15
+ // = require ./dynamic_fields.component
16
+ // = require ./field_dependent_inputs.component
13
17
  // = require_self
14
18
 
15
19
  window.Decidim = window.Decidim || {};
@@ -21,16 +25,16 @@ const pageLoad = () => {
21
25
 
22
26
  toggleNav();
23
27
 
24
- createSortList('#steps tbody', {
28
+ createSortList("#steps tbody", {
25
29
  placeholder: $('<tr style="border-style: dashed; border-color: #000"><td colspan="4">&nbsp;</td></tr>')[0],
26
30
  onSortUpdate: ($children) => {
27
- const sortUrl = $('#steps tbody').data('sort-url')
28
- const order = $children.map((index, child) => $(child).data('id')).toArray();
31
+ const sortUrl = $("#steps tbody").data("sort-url")
32
+ const order = $children.map((index, child) => $(child).data("id")).toArray();
29
33
 
30
34
  $.ajax({
31
- method: 'POST',
35
+ method: "POST",
32
36
  url: sortUrl,
33
- contentType: 'application/json',
37
+ contentType: "application/json",
34
38
  data: JSON.stringify({ items_ids: order }) }, // eslint-disable-line camelcase
35
39
  );
36
40
  }
@@ -47,4 +51,8 @@ $(() => {
47
51
  if (window.Decidim.formDatePicker) {
48
52
  window.Decidim.formDatePicker();
49
53
  }
54
+
55
+ if (window.Decidim.quillEditor) {
56
+ window.Decidim.quillEditor();
57
+ }
50
58
  });
@@ -0,0 +1,42 @@
1
+ ((exports) => {
2
+ class AutoButtonsByPositionComponent {
3
+ constructor(options = {}) {
4
+ this.listSelector = options.listSelector;
5
+ this.hideOnFirstSelector = options.hideOnFirstSelector;
6
+ this.hideOnLastSelector = options.hideOnLastSelector;
7
+
8
+ this.run();
9
+ }
10
+
11
+ run() {
12
+ const $list = $(this.listSelector);
13
+ const hideOnFirst = this.hideOnFirstSelector;
14
+ const hideOnLast = this.hideOnLastSelector;
15
+
16
+ if ($list.length === 1) {
17
+ const $item = $list.first();
18
+
19
+ $item.find(hideOnFirst).hide();
20
+ $item.find(hideOnLast).hide();
21
+ } else {
22
+ $list.each((idx, el) => {
23
+ if (el.id === $list.first().attr("id")) {
24
+ $(el).find(hideOnFirst).hide();
25
+ $(el).find(hideOnLast).show();
26
+ }
27
+ else if (el.id === $list.last().attr("id")) {
28
+ $(el).find(hideOnLast).hide();
29
+ $(el).find(hideOnFirst).show();
30
+ }
31
+ else {
32
+ $(el).find(hideOnLast).show();
33
+ $(el).find(hideOnFirst).show();
34
+ }
35
+ });
36
+ }
37
+ }
38
+ }
39
+
40
+ exports.DecidimAdmin = exports.DecidimAdmin || {};
41
+ exports.DecidimAdmin.AutoButtonsByPositionComponent = AutoButtonsByPositionComponent;
42
+ })(window);
@@ -0,0 +1,33 @@
1
+ ((exports) => {
2
+ class AutoLabelByPositionComponent {
3
+ constructor(options = {}) {
4
+ this.listSelector = options.listSelector;
5
+ this.labelSelector = options.labelSelector;
6
+ this.onPositionComputed = options.onPositionComputed;
7
+
8
+ this.run();
9
+ }
10
+
11
+ run() {
12
+ const $list = $(this.listSelector);
13
+
14
+ $list.each((idx, el) => {
15
+ const $label = $(el).find(this.labelSelector);
16
+ const labelContent = $label.html();
17
+
18
+ if (labelContent.match(/#(\d+)/)) {
19
+ $label.html(labelContent.replace(/#(\d+)/, `#${idx + 1}`));
20
+ } else {
21
+ $label.html(`${labelContent} #${idx + 1}`);
22
+ }
23
+
24
+ if (this.onPositionComputed) {
25
+ this.onPositionComputed(el, idx);
26
+ }
27
+ });
28
+ }
29
+ }
30
+
31
+ exports.DecidimAdmin = exports.DecidimAdmin || {};
32
+ exports.DecidimAdmin.AutoLabelByPositionComponent = AutoLabelByPositionComponent;
33
+ })(window);
@@ -0,0 +1,163 @@
1
+ ((exports) => {
2
+ class DynamicFieldsComponent {
3
+ constructor(options = {}) {
4
+ this.wrapperSelector = options.wrapperSelector;
5
+ this.containerSelector = options.containerSelector;
6
+ this.fieldSelector = options.fieldSelector;
7
+ this.addFieldButtonSelector = options.addFieldButtonSelector;
8
+ this.removeFieldButtonSelector = options.removeFieldButtonSelector;
9
+ this.moveUpFieldButtonSelector = options.moveUpFieldButtonSelector;
10
+ this.moveDownFieldButtonSelector = options.moveDownFieldButtonSelector;
11
+ this.onAddField = options.onAddField;
12
+ this.onRemoveField = options.onRemoveField;
13
+ this.onMoveUpField = options.onMoveUpField;
14
+ this.onMoveDownField = options.onMoveDownField;
15
+ this.placeholderId = options.placeholderId;
16
+ this.elementCounter = 0;
17
+ this._enableInterpolation();
18
+ this._activateFields();
19
+ this._bindEvents();
20
+ }
21
+
22
+ _enableInterpolation() {
23
+ $.fn.replaceAttribute = function(attribute, placeholder, value) {
24
+ $(this).find(`[${attribute}*=${placeholder}]`).addBack(`[${attribute}*=${placeholder}]`).each((index, element) => {
25
+ $(element).attr(attribute, $(element).attr(attribute).replace(placeholder, value));
26
+ });
27
+
28
+ return this;
29
+ }
30
+
31
+ $.fn.template = function(placeholder, value) {
32
+ const $subtemplate = $(this).find("template");
33
+
34
+ if ($subtemplate.length > 0) {
35
+ $subtemplate.html((index, oldHtml) => $(oldHtml).template(placeholder, value)[0].outerHTML);
36
+ }
37
+
38
+ $(this).replaceAttribute("id", placeholder, value);
39
+ $(this).replaceAttribute("name", placeholder, value);
40
+ $(this).replaceAttribute("data-tabs-content", placeholder, value);
41
+ $(this).replaceAttribute("for", placeholder, value);
42
+ $(this).replaceAttribute("tabs_id", placeholder, value);
43
+ $(this).replaceAttribute("href", placeholder, value);
44
+
45
+ return this;
46
+ }
47
+ }
48
+
49
+ _bindEvents() {
50
+ $(this.wrapperSelector).on("click", this.addFieldButtonSelector, (event) =>
51
+ this._bindSafeEvent(event, () => this._addField())
52
+ );
53
+
54
+ $(this.wrapperSelector).on("click", this.removeFieldButtonSelector, (event) =>
55
+ this._bindSafeEvent(event, (target) => this._removeField(target))
56
+ );
57
+
58
+ if (this.moveUpFieldButtonSelector) {
59
+ $(this.wrapperSelector).on("click", this.moveUpFieldButtonSelector, (event) =>
60
+ this._bindSafeEvent(event, (target) => this._moveUpField(target))
61
+ );
62
+ }
63
+
64
+ if (this.moveDownFieldButtonSelector) {
65
+ $(this.wrapperSelector).on("click", this.moveDownFieldButtonSelector, (event) =>
66
+ this._bindSafeEvent(event, (target) => this._moveDownField(target))
67
+ );
68
+ }
69
+ }
70
+
71
+ _bindSafeEvent(event, cb) {
72
+ event.preventDefault();
73
+ event.stopPropagation();
74
+
75
+ try {
76
+ return cb(event.target);
77
+ } catch (error) {
78
+ console.error(error); // eslint-disable-line no-console
79
+ return error;
80
+ }
81
+ }
82
+
83
+ _addField() {
84
+ const $container = $(this.wrapperSelector).find(this.containerSelector);
85
+ const $template = $(this.wrapperSelector).children("template");
86
+ const $newField = $($template.html()).template(this.placeholderId, this._getUID());
87
+
88
+ $newField.find("ul.tabs").attr("data-tabs", true);
89
+
90
+ $newField.appendTo($container);
91
+ $newField.foundation();
92
+
93
+ if (this.onAddField) {
94
+ this.onAddField($newField);
95
+ }
96
+ }
97
+
98
+ _removeField(target) {
99
+ const $target = $(target);
100
+ const $removedField = $target.parents(this.fieldSelector);
101
+ const idInput = $removedField.find("input").filter((idx, input) => input.name.match(/id/));
102
+
103
+ if (idInput.length > 0) {
104
+ const deletedInput = $removedField.find("input").filter((idx, input) => input.name.match(/delete/));
105
+
106
+ if (deletedInput.length > 0) {
107
+ $(deletedInput[0]).val(true);
108
+ }
109
+
110
+ $removedField.addClass("hidden");
111
+ $removedField.hide();
112
+ } else {
113
+ $removedField.remove();
114
+ }
115
+
116
+ if (this.onRemoveField) {
117
+ this.onRemoveField($removedField);
118
+ }
119
+ }
120
+
121
+ _moveUpField(target) {
122
+ const $target = $(target);
123
+ const $movedUpField = $target.parents(this.fieldSelector);
124
+
125
+ $movedUpField.prev().before($movedUpField);
126
+
127
+ if (this.onMoveUpField) {
128
+ this.onMoveUpField($movedUpField);
129
+ }
130
+ }
131
+
132
+ _moveDownField(target) {
133
+ const $target = $(target);
134
+ const $movedDownField = $target.parents(this.fieldSelector);
135
+
136
+ $movedDownField.next().after($movedDownField);
137
+
138
+ if (this.onMoveDownField) {
139
+ this.onMoveDownField($movedDownField);
140
+ }
141
+ }
142
+
143
+ _activateFields() {
144
+ $(this.fieldSelector).each((idx, el) => {
145
+ $(el).template(this.placeholderId, this._getUID());
146
+
147
+ $(el).find("ul.tabs").attr("data-tabs", true);
148
+ })
149
+ }
150
+
151
+ _getUID() {
152
+ this.elementCounter += 1;
153
+
154
+ return (new Date().getTime()) + this.elementCounter;
155
+ }
156
+ }
157
+
158
+ exports.DecidimAdmin = exports.DecidimAdmin || {};
159
+ exports.DecidimAdmin.DynamicFieldsComponent = DynamicFieldsComponent;
160
+ exports.DecidimAdmin.createDynamicFields = (options) => {
161
+ return new DynamicFieldsComponent(options);
162
+ };
163
+ })(window);
@@ -0,0 +1,39 @@
1
+ ((exports) => {
2
+ class FieldDependentInputsComponent {
3
+ constructor(options = {}) {
4
+ this.controllerField = options.controllerField;
5
+ this.wrapperSelector = options.wrapperSelector;
6
+ this.dependentFieldsSelector = options.dependentFieldsSelector;
7
+ this.dependentInputSelector = options.dependentInputSelector;
8
+ this.enablingCondition = options.enablingCondition;
9
+ this._bindEvent();
10
+ this._run();
11
+ }
12
+
13
+ _run() {
14
+ const $controllerField = this.controllerField;
15
+ const $dependentFields = $controllerField.parents(this.wrapperSelector).find(this.dependentFieldsSelector);
16
+ const $dependentInputs = $dependentFields.find(this.dependentInputSelector);
17
+
18
+ if (this.enablingCondition($controllerField)) {
19
+ $dependentInputs.prop("disabled", false);
20
+ $dependentFields.show();
21
+ } else {
22
+ $dependentInputs.prop("disabled", true);
23
+ $dependentFields.hide();
24
+ }
25
+ }
26
+
27
+ _bindEvent() {
28
+ this.controllerField.on("change", () => {
29
+ this._run();
30
+ });
31
+ }
32
+ }
33
+
34
+ exports.DecidimAdmin = exports.DecidimAdmin || {};
35
+ exports.DecidimAdmin.FieldDependentInputsComponent = FieldDependentInputsComponent;
36
+ exports.DecidimAdmin.createFieldDependentInputs = (options) => {
37
+ return new FieldDependentInputsComponent(options);
38
+ };
39
+ })(window);
@@ -0,0 +1,12 @@
1
+ // = require ./subform_toggler.component
2
+
3
+ ((exports) => {
4
+ const { SubformTogglerComponent } = exports.DecidimAdmin;
5
+
6
+ const subformToggler = new SubformTogglerComponent({
7
+ controllerSelect: $("select#impersonate_user_authorization_handler_name"),
8
+ subformWrapperClass: "authorization-handler"
9
+ });
10
+
11
+ subformToggler.run();
12
+ })(window);
@@ -16,7 +16,7 @@
16
16
  */
17
17
  constructor(sortListSelector, options) {
18
18
  if ($(sortListSelector).length > 0) {
19
- exports.sortable(sortListSelector, options)[0].addEventListener('sortupdate', (event) => {
19
+ exports.sortable(sortListSelector, options)[0].addEventListener("sortupdate", (event) => {
20
20
  const $children = $(event.target).children();
21
21
 
22
22
  if (options.onSortUpdate) {
@@ -0,0 +1,35 @@
1
+ ((exports) => {
2
+ class SubformTogglerComponent {
3
+ constructor(options = {}) {
4
+ this.controllerSelect = options.controllerSelect;
5
+ this.subformWrapperClass = options.subformWrapperClass;
6
+ this._bindEvent();
7
+ this.run();
8
+ }
9
+
10
+ run() {
11
+ let $controllerSelect = this.controllerSelect;
12
+ let subformWrapperClass = this.subformWrapperClass;
13
+ let value = $controllerSelect.val();
14
+
15
+ let $form = $controllerSelect.parents("form");
16
+ let $subforms = $form.find(`.${subformWrapperClass}`);
17
+ let $selectedSubform = $subforms.filter(`#${subformWrapperClass}-${value}`)
18
+
19
+ $subforms.find("input,textarea").prop("disabled", true);
20
+ $subforms.hide();
21
+
22
+ $selectedSubform.find("input,textarea").prop("disabled", false);
23
+ $selectedSubform.show();
24
+ }
25
+
26
+ _bindEvent() {
27
+ this.controllerSelect.on("change", () => {
28
+ this.run();
29
+ });
30
+ }
31
+ }
32
+
33
+ exports.DecidimAdmin = exports.DecidimAdmin || {};
34
+ exports.DecidimAdmin.SubformTogglerComponent = SubformTogglerComponent;
35
+ })(window);
@@ -5,15 +5,15 @@
5
5
  */
6
6
  $(() => {
7
7
  // Event launched by foundation
8
- $('[data-tabs]').on('change.zf.tabs', (event) => {
9
- const $container = $(event.target).next('.tabs-content .tabs-panel.is-active');
8
+ $("[data-tabs]").on("change.zf.tabs", (event) => {
9
+ const $container = $(event.target).next(".tabs-content .tabs-panel.is-active");
10
10
  // Detect quilljs editor inside the tabs-panel
11
- let $content = $container.find('.editor .ql-editor');
11
+ let $content = $container.find(".editor .ql-editor");
12
12
  if ($content.length > 0) {
13
13
  $content.focus();
14
14
  // Detect if inside the tabs-panel have an input
15
15
  } else {
16
- $content = $container.find('input:first');
16
+ $content = $container.find("input:first");
17
17
  if ($content.length > 0) {
18
18
  $content.focus();
19
19
  }
@@ -1,6 +1,6 @@
1
1
  @import "decidim";
2
2
  @import "extra/*";
3
3
 
4
- <% Decidim.feature_manifests.map(&:admin_stylesheet).compact.each do |stylesheet| %>
4
+ <% Decidim.component_manifests.map(&:admin_stylesheet).compact.each do |stylesheet| %>
5
5
  @import "<%= stylesheet %>";
6
6
  <% end %>
@@ -21,17 +21,13 @@
21
21
  box-shadow: 0 3px 5px rgba(0, 0, 0, .3);
22
22
  min-width: 100px;
23
23
 
24
- li{
25
- padding: 8px 8px 0;
26
- }
27
-
28
24
  li:hover{
29
25
  background-color: darken($white, 5%) !important;
30
26
  }
31
27
 
32
28
  a{
33
29
  color: $body-font-color;
34
- padding: .5rem;
30
+ padding: 16px;
35
31
  }
36
32
 
37
33
  a:hover{
@@ -40,6 +36,12 @@
40
36
  }
41
37
  }
42
38
 
39
+ .dropdown-inverted.dropdown.menu{
40
+ .is-active > a{
41
+ color: $anchor-color;
42
+ }
43
+ }
44
+
43
45
  .dropdown-menu-inverted_label{
44
46
  vertical-align: middle;
45
47
  }
@@ -0,0 +1,34 @@
1
+ .agenda{
2
+ .grid-x{
3
+ border-bottom: 1px solid $light-gray;
4
+
5
+ .cell:first-child{
6
+ color: $medium-gray;
7
+ }
8
+
9
+ .cell:nth-child(2){
10
+ color: $muted;
11
+
12
+ small{
13
+ color: $medium-gray;
14
+ }
15
+ }
16
+
17
+ .cell:nth-last-child(2){
18
+ display: flex;
19
+ align-items: baseline;
20
+
21
+ small{
22
+ color: $medium-gray;
23
+ white-space: nowrap;
24
+ overflow-x: hidden;
25
+ text-overflow: ellipsis;
26
+ flex: 1;
27
+ }
28
+ }
29
+
30
+ .cell:last-child{
31
+ color: map-get($foundation-palette, alert);
32
+ }
33
+ }
34
+ }
@@ -21,6 +21,11 @@
21
21
  letter-spacing: 0;
22
22
  }
23
23
  }
24
+
25
+ &.reverse{
26
+ @include modifiers(color);
27
+ @include modifiers(background-color, (primary: $white, secondary: $white, success: $white, warning: $white, alert: $white));
28
+ }
24
29
  }
25
30
 
26
31
  .button.muted{
@@ -14,6 +14,15 @@ $card-padding-small: 1rem;
14
14
 
15
15
  font-size: 1rem;
16
16
  width: 100%;
17
+
18
+ &--nocaps{
19
+ text-transform: lowercase;
20
+ letter-spacing: 0;
21
+
22
+ &::first-letter{
23
+ text-transform: uppercase;
24
+ }
25
+ }
17
26
  }
18
27
 
19
28
  .card-footer{
@@ -94,6 +103,12 @@ $card-padding-small: 1rem;
94
103
  display: block;
95
104
  }
96
105
 
106
+ .card-divider{
107
+ @include modifiers(background){
108
+ color: $white;
109
+ }
110
+ }
111
+
97
112
  .card-divider--reduced{
98
113
  // height adjust
99
114
  padding: (($global-padding / 2) + rem-calc(.7)) $global-padding;
@@ -23,6 +23,10 @@ textarea{
23
23
  .input-field,
24
24
  .data-picker{
25
25
  margin-bottom: $input-margin;
26
+
27
+ &.nomargin{
28
+ margin-bottom: 0;
29
+ }
26
30
  }
27
31
 
28
32
  .check-radio-group{
@@ -25,3 +25,4 @@
25
25
  @import "pics";
26
26
  @import "filters";
27
27
  @import "dropdown";
28
+ @import "agenda";
@@ -17,3 +17,11 @@
17
17
  .text-info{
18
18
  color: $secondary;
19
19
  }
20
+
21
+ .text-lowercase{
22
+ text-transform: lowercase;
23
+ }
24
+
25
+ .text-uppercase{
26
+ text-transform: uppercase;
27
+ }
@@ -51,10 +51,10 @@ $spaces: $space ($space * 2);
51
51
  @include flex-align($x: center, $y: middle);
52
52
  }
53
53
 
54
- // flex--cc:
54
+ // flex--sbc:
55
55
  // justify-content: space-between;
56
56
  // align-items: center;
57
57
  .flex--sbc{
58
58
  @include flex;
59
- @include flex-align($x: spaced, $y: middle);
59
+ @include flex-align($x: justify, $y: middle);
60
60
  }
@@ -23,3 +23,31 @@
23
23
  margin-bottom: 0;
24
24
  }
25
25
  }
26
+
27
+ // Make parent relative to absolute positioning children
28
+ .absolutes{
29
+ position: relative;
30
+
31
+ .left,
32
+ .right,
33
+ .top,
34
+ .bottom{
35
+ position: absolute;
36
+ }
37
+
38
+ .left{
39
+ left: 0;
40
+ }
41
+
42
+ .right{
43
+ right: 0;
44
+ }
45
+
46
+ .top{
47
+ top: 0;
48
+ }
49
+
50
+ .bottom{
51
+ bottom: 0;
52
+ }
53
+ }
@@ -34,3 +34,47 @@ $palette: $foundation-palette;
34
34
  }
35
35
  }
36
36
  }
37
+
38
+ // helpers
39
+ $margin-s: 1rem;
40
+ $margin-sm: 2rem;
41
+ $margin-m: 3rem;
42
+ $margin-l: 5rem;
43
+
44
+ $size:(
45
+ none: 0,
46
+ s: $margin-s,
47
+ sm: $margin-sm,
48
+ m: $margin-m,
49
+ l: $margin-l
50
+ ) !default;
51
+
52
+ $property:(
53
+ p: padding,
54
+ m: margin
55
+ ) !default;
56
+
57
+ $side:(
58
+ t: top,
59
+ r: right,
60
+ b: bottom,
61
+ l: left
62
+ ) !default;
63
+
64
+ @mixin make-spaces(){
65
+ @each $p-key, $prop in $property{
66
+ @each $v-key, $value in $size{
67
+ .#{$p-key}-#{$v-key}{
68
+ #{$prop}: #{$value};
69
+ }
70
+
71
+ @each $s-key, $side in $side{
72
+ .#{$p-key}#{$s-key}-#{$v-key}{
73
+ #{$prop}-#{$side}: #{$value};
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+
80
+ @include make-spaces()