decidim-decidim_awesome 0.6.5 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -8
  3. data/app/assets/config/decidim_admin_decidim_awesome_manifest.css +2 -2
  4. data/app/assets/config/decidim_admin_decidim_awesome_manifest.js +1 -1
  5. data/app/assets/config/decidim_decidim_awesome_manifest.css +2 -2
  6. data/app/assets/config/decidim_decidim_awesome_manifest.js +3 -2
  7. data/app/assets/config/legacy_decidim_admin_decidim_awesome_manifest.js +2 -0
  8. data/app/assets/config/legacy_decidim_decidim_awesome_manifest.js +4 -0
  9. data/app/assets/javascripts/decidim/decidim_awesome/admin/auto_edit.js.es6 +77 -0
  10. data/app/assets/javascripts/decidim/decidim_awesome/admin/codemirror.js.es6 +14 -0
  11. data/app/assets/javascripts/decidim/decidim_awesome/admin/form_builder.js.es6 +80 -0
  12. data/app/assets/javascripts/decidim/decidim_awesome/admin/legacy_form_builder.js.es6 +80 -0
  13. data/app/assets/javascripts/decidim/decidim_awesome/admin/user_picker.js.es6 +24 -0
  14. data/app/assets/javascripts/decidim/decidim_awesome/awesome_admin.js +7 -0
  15. data/app/assets/javascripts/decidim/decidim_awesome/{application.js → awesome_application.js} +1 -2
  16. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/hashtags.js.es6 +48 -0
  17. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/layers.js.es6 +107 -0
  18. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/load_map.js.es6 +15 -0
  19. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/map.js.es6 +170 -178
  20. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/markers.js.es6 +56 -0
  21. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/meetings.js.es6 +7 -6
  22. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/proposals.js.es6 +18 -5
  23. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/utilities.js.es6 +57 -0
  24. data/app/assets/javascripts/decidim/decidim_awesome/editors/legacy_quill_editor.js.es6 +172 -0
  25. data/app/assets/javascripts/decidim/decidim_awesome/editors/quill_editor.js.es6 +34 -9
  26. data/app/assets/javascripts/decidim/decidim_awesome/editors/tabs_focus.js.es6 +24 -0
  27. data/app/assets/javascripts/decidim/decidim_awesome/forms/custom_fields_builder.js.es6 +211 -0
  28. data/app/assets/javascripts/decidim/decidim_awesome/forms/rich_text_plugin.js.es6 +106 -0
  29. data/app/assets/javascripts/decidim/decidim_awesome/legacy_admin.js +7 -0
  30. data/app/assets/javascripts/decidim/decidim_awesome/legacy_application.js +3 -0
  31. data/app/assets/javascripts/decidim/decidim_awesome/proposals/custom_fields.js.es6 +21 -0
  32. data/app/assets/stylesheets/decidim/decidim_awesome/admin/auto_edits.scss +15 -0
  33. data/app/assets/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +27 -0
  34. data/app/assets/stylesheets/decidim/decidim_awesome/admin/constraints.scss +12 -0
  35. data/app/assets/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +66 -0
  36. data/app/assets/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +35 -0
  37. data/app/assets/stylesheets/decidim/decidim_awesome/{admin.scss → awesome_admin.scss} +19 -4
  38. data/app/assets/stylesheets/decidim/decidim_awesome/awesome_application.scss +22 -0
  39. data/app/assets/stylesheets/decidim/decidim_awesome/awesome_map/leaflet.scss.erb +9 -0
  40. data/app/assets/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +95 -1
  41. data/app/assets/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss +1 -1
  42. data/app/assets/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +16 -1
  43. data/app/awesome_overrides/forms/decidim/proposals/proposal_wizard_create_step_form_override.rb +28 -0
  44. data/app/awesome_overrides/presenters/decidim/menu_presenter_override.rb +11 -3
  45. data/app/cells/decidim/decidim_awesome/content_blocks/map/show.erb +74 -0
  46. data/app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb +54 -0
  47. data/app/cells/decidim/decidim_awesome/content_blocks/map_form/show.erb +61 -0
  48. data/app/cells/decidim/decidim_awesome/content_blocks/map_form_cell.rb +19 -0
  49. data/app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb +32 -0
  50. data/app/commands/decidim/decidim_awesome/admin/create_proposal_custom_field.rb +45 -0
  51. data/app/commands/decidim/decidim_awesome/admin/create_scoped_admin.rb +38 -0
  52. data/app/commands/decidim/decidim_awesome/admin/destroy_constraint.rb +4 -0
  53. data/app/commands/decidim/decidim_awesome/admin/destroy_proposal_custom_field.rb +40 -0
  54. data/app/commands/decidim/decidim_awesome/admin/destroy_scoped_admin.rb +40 -0
  55. data/app/commands/decidim/decidim_awesome/admin/destroy_scoped_style.rb +1 -1
  56. data/app/commands/decidim/decidim_awesome/admin/rename_scope_label.rb +58 -0
  57. data/app/commands/decidim/decidim_awesome/admin/update_config.rb +5 -1
  58. data/app/controllers/concerns/decidim/decidim_awesome/admin_not_found_redirect.rb +39 -0
  59. data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +1 -1
  60. data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +33 -20
  61. data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +4 -0
  62. data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +2 -2
  63. data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +38 -0
  64. data/app/controllers/decidim/decidim_awesome/admin/scoped_admins_controller.rb +38 -0
  65. data/app/controllers/decidim/decidim_awesome/admin/scoped_styles_controller.rb +38 -0
  66. data/app/controllers/decidim/decidim_awesome/map_component/map_controller.rb +1 -4
  67. data/app/forms/decidim/decidim_awesome/admin/config_form.rb +50 -0
  68. data/app/forms/decidim/decidim_awesome/admin/constraint_form.rb +3 -1
  69. data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +11 -7
  70. data/app/helpers/decidim/decidim_awesome/amendments_helper_override.rb +48 -0
  71. data/app/helpers/decidim/decidim_awesome/map_helper.rb +66 -53
  72. data/app/helpers/decidim/decidim_awesome/proposals/application_helper_override.rb +78 -0
  73. data/app/middleware/decidim/decidim_awesome/current_config.rb +182 -0
  74. data/app/models/decidim/decidim_awesome/awesome_config.rb +15 -0
  75. data/app/models/decidim/decidim_awesome/user_override.rb +25 -0
  76. data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +2 -0
  77. data/app/uploaders/decidim/decidim_awesome/image_uploader.rb +0 -5
  78. data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +2 -2
  79. data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +7 -0
  80. data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +2 -2
  81. data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +21 -0
  82. data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +0 -3
  83. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +25 -0
  84. data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +0 -2
  85. data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +4 -6
  86. data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +1 -2
  87. data/app/views/decidim/decidim_awesome/admin/proposals/_editor.html.erb +4 -0
  88. data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +6 -0
  89. data/app/views/decidim/decidim_awesome/map_component/map/show.html.erb +3 -32
  90. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +101 -0
  91. data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +83 -0
  92. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +1 -0
  93. data/app/views/layouts/decidim/admin/decidim_awesome.html.erb +25 -11
  94. data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +8 -1
  95. data/app/views/layouts/decidim/decidim_awesome/_custom_styles.html.erb +1 -1
  96. data/app/views/v0.23/decidim/proposals/collaborative_drafts/_show.html.erb +134 -0
  97. data/app/views/v0.23/layouts/decidim/_head.html.erb +2 -2
  98. data/app/views/v0.23/layouts/decidim/admin/_header.html.erb +2 -2
  99. data/app/views/v0.24/decidim/proposals/collaborative_drafts/_show.html.erb +128 -0
  100. data/app/views/{v0.22 → v0.24}/layouts/decidim/_head.html.erb +4 -2
  101. data/app/views/{v0.22 → v0.24}/layouts/decidim/admin/_header.html.erb +3 -2
  102. data/config/locales/ca.yml +75 -3
  103. data/config/locales/cs.yml +75 -3
  104. data/config/locales/en.yml +104 -11
  105. data/config/locales/es.yml +74 -2
  106. data/config/locales/eu.yml +76 -4
  107. data/config/locales/fr.yml +214 -142
  108. data/config/locales/it.yml +284 -0
  109. data/config/locales/ja.yml +284 -0
  110. data/config/locales/nl.yml +208 -136
  111. data/config/locales/sv.yml +109 -37
  112. data/db/migrate/20210628150825_change_awesome_config_var_type.rb +12 -0
  113. data/lib/decidim/decidim_awesome/admin_engine.rb +16 -4
  114. data/lib/decidim/decidim_awesome/awesome_helpers.rb +17 -10
  115. data/lib/decidim/decidim_awesome/checksums.yml +19 -9
  116. data/lib/decidim/decidim_awesome/config.rb +54 -9
  117. data/lib/decidim/decidim_awesome/context_analyzers/request_analyzer.rb +27 -21
  118. data/lib/decidim/decidim_awesome/custom_fields.rb +94 -0
  119. data/lib/decidim/decidim_awesome/engine.rb +64 -8
  120. data/lib/decidim/decidim_awesome/iframe_component/component.rb +1 -1
  121. data/lib/decidim/decidim_awesome/map_component/component.rb +8 -2
  122. data/lib/decidim/decidim_awesome/menu_hacker.rb +17 -15
  123. data/lib/decidim/decidim_awesome/system_checker.rb +1 -1
  124. data/lib/decidim/decidim_awesome/test/shared_examples/box_label_editor.rb +116 -0
  125. data/lib/decidim/decidim_awesome/test/shared_examples/current_config_examples.rb +143 -0
  126. data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +4 -0
  127. data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +428 -0
  128. data/lib/decidim/decidim_awesome/version.rb +2 -2
  129. data/lib/decidim/decidim_awesome.rb +41 -8
  130. data/vendor/assets/javascripts/codemirror.js +9801 -0
  131. data/vendor/assets/javascripts/delta.min.js +405 -0
  132. data/vendor/assets/javascripts/delta.min.js.map +1 -0
  133. data/vendor/assets/javascripts/europa.min.js +4 -0
  134. data/vendor/assets/javascripts/form-builder.min.js +19 -0
  135. data/vendor/assets/javascripts/form-render.min.js +19 -0
  136. data/vendor/assets/javascripts/inscrybmde.min.js +1 -1
  137. data/vendor/assets/javascripts/jquery-ui.min.js +13 -0
  138. data/vendor/assets/javascripts/jquery.truncate.js +105 -0
  139. data/vendor/assets/javascripts/keymap/sublime.js +720 -0
  140. data/vendor/assets/javascripts/mode/css/css.js +864 -0
  141. data/vendor/assets/javascripts/select2.js +6147 -0
  142. data/vendor/assets/langs/en-US.lang +110 -0
  143. data/vendor/assets/stylesheets/codemirror.css +350 -0
  144. data/vendor/assets/stylesheets/inscrybmde.min.scss +194 -0
  145. data/vendor/assets/stylesheets/jquery-ui.min.css +7 -0
  146. data/vendor/assets/stylesheets/select2-foundation-theme.css +249 -0
  147. data/vendor/assets/stylesheets/select2.css +515 -0
  148. metadata +101 -34
  149. data/app/assets/images/decidim/decidim_awesome/loading.gif +0 -0
  150. data/app/assets/javascripts/decidim/decidim_awesome/admin.js +0 -2
  151. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/legacy_map.js.es6 +0 -225
  152. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/legacy_proposals.js.es6 +0 -82
  153. data/app/assets/javascripts/decidim/decidim_awesome/editors/markdown_view.js.es6 +0 -12
  154. data/app/assets/stylesheets/decidim/decidim_awesome/application.scss +0 -8
  155. data/app/assets/stylesheets/decidim/decidim_awesome/editors/markdown_view.scss +0 -27
  156. data/app/awesome_overrides/presenters/decidim/proposals/proposal_presenter_override.rb +0 -64
  157. data/lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb +0 -18
  158. data/lib/decidim/decidim_awesome/content_renderers.rb +0 -9
  159. data/vendor/assets/stylesheets/inscrybmde.min.css +0 -8
@@ -2,62 +2,74 @@ sv:
2
2
  activemodel:
3
3
  attributes:
4
4
  config:
5
- allow_images_in_full_editor: Allow images in the full HTML editor
6
- allow_images_in_markdown_editor: Allow images in the markdown editor
7
- allow_images_in_proposals: Allow images in the proposals editor
8
- allow_images_in_small_editor: Allow images in the minimal HTML editor
9
- auto_save_forms: Auto save forms in local storage
5
+ allow_images_in_full_editor: Tillåt bilder i den fullständiga HTML-editorn
6
+ allow_images_in_markdown_editor: Tillåt bilder i den fullständiga Markdown-editorn
7
+ allow_images_in_proposals: Tillåt bilder i förslagsfältet
8
+ allow_images_in_small_editor: Tillåt bilder i den minimala HTML-editorn
9
+ auto_save_forms: Spara formulär automatiskt i lokal lagring
10
10
  intergram_auto_no_response: A message that is sent one minute after the user sends its first message and no response was received
11
11
  intergram_auto_response: A message that is sent immediately after the user sends its first message
12
- intergram_chat_id: Chat ID
13
- intergram_color: Color of the widget
12
+ intergram_chat_id: Chatt ID
13
+ intergram_color: Huvudfärg för widget
14
14
  intergram_for_admins: Enable Intergram Chat in the admin backend
15
- intergram_intro_message: First message when the user opens the chat for the first time
16
- intergram_require_login: Only for logged users
15
+ intergram_intro_message: Första meddelandet när användaren öppnar chatten för första gången
16
+ intergram_require_login: Endast för inloggade användare
17
17
  intergram_title_closed: Closed chat title
18
18
  intergram_title_open: Opened chat title
19
19
  intergram_use_floating_button: If checked, the closed chat is always a button instead of a text
20
- scoped_styles: 'Custom styles #%{id}'
20
+ proposal_custom_fields: Custom fields %{id}
21
+ scoped_admins: Scoped admins group %{id}
22
+ scoped_styles: Custom styles %{id}
21
23
  use_markdown_editor: Use a Markdown editor instead of the HTML editor
22
24
  constraint:
23
25
  component_id: or specifically in
24
26
  component_manifest: Only in components of type
25
27
  participatory_space_manifest: Apply to participatory spaces of type
26
- participatory_space_slug: Only in
28
+ participatory_space_slug: Endast i
27
29
  menu:
28
30
  position: Position
29
- raw_label: Label
31
+ raw_label: Etikett
30
32
  target: Opens in
31
- url: URL
32
- visibility: Visibility
33
+ url: Webbadress
34
+ visibility: Synlighet
35
+ proposal:
36
+ proposal_custom_fields: Custom fields
33
37
  decidim:
34
38
  admin:
35
39
  menu:
36
- decidim_awesome: Decidim awesome
40
+ decidim_awesome: Decidim Awesome
37
41
  components:
38
42
  awesome_iframe:
39
43
  name: Fullscreen Iframe
40
44
  settings:
41
45
  global:
42
- announcement: Announcement
43
- iframe: Iframe code
46
+ announcement: Meddelande
47
+ iframe: Iframe kod
44
48
  iframe_help: 'Put your code as html: <iframe width="100%" height="700" frameBorder="0" allowFullscreen src="..."></iframe>. Content will be sanitized from other HTML tags. Ensure to use 100% as width to fill the screen.'
45
49
  no_margins: No margins between the iframe and the rest of the page
46
50
  viewport_width: Limit maximum width to the application viewport
47
51
  step:
48
52
  announcement: Announcement
49
- iframe: Iframe code
53
+ iframe: Iframe kod
50
54
  awesome_map:
51
- name: Awesome Map
55
+ name: Karta
52
56
  settings:
53
57
  global:
54
- announcement: Announcement
58
+ announcement: Meddelande
55
59
  collapse: Start with collapsed menu
60
+ map_center: Map center (Latitude, Longitude)
61
+ map_center_help: 'Use decimal points (ie: 41.38879, 2.15899). Leave it empty to automatically fit all the markers'
56
62
  map_height: Map height (px)
63
+ map_zoom: Zoom (any number betwen 0 and 18)
64
+ map_zoom_help: Only applies if a map center is defined
65
+ menu_amendments: Show amendments
66
+ menu_hashtags: Show Hasthag search menu
67
+ menu_meetings: Visa möten
68
+ truncate: Maximum characters for popup descriptions
57
69
  step:
58
- announcement: Announcement
59
- show_accepted: Show accepted proposals
60
- show_evaluating: Show evaluating proposals
70
+ announcement: Meddelande
71
+ show_accepted: Visa godkända förslag
72
+ show_evaluating: Visa förslag som utvärderas
61
73
  show_not_answered: Show not answered proposals
62
74
  show_rejected: Show rejected proposals
63
75
  show_withdrawn: Show withdrawn proposals
@@ -76,20 +88,37 @@ sv:
76
88
  head_tags: Awesome tags included in the application header
77
89
  title: System compatibility checks
78
90
  config:
91
+ caution: 'NOTE: This feature heavily modifies some default behaviours that might lead to unexpected results. Use it with caution!'
79
92
  constraints:
80
93
  add_condition: Add case
81
94
  always: Always
95
+ cannot_be_destroyed: Sorry, this cannot be deleted. This configuration needs at least one constraint.
82
96
  delete: Delete
83
97
  edit: Edit
84
98
  title: 'Applicable only in these cases:'
99
+ create_proposal_custom_field:
100
+ error: Error creating a new "custom field" box! %{error}
101
+ success: '"custom field" box %{key} created successfully'
102
+ create_scoped_admin:
103
+ error: Error creating a new Admin group! %{error}
104
+ success: Admin group %{key} created successfully
85
105
  create_scoped_style:
86
106
  error: Error creating a new CSS box! %{error}
87
107
  success: CSS box %{key} created successfully
108
+ destroy_proposal_custom_field:
109
+ error: Error removing "custom field" box! %{error}
110
+ success: '"custom field" box %{key} removed successfully'
111
+ destroy_scoped_admin:
112
+ error: Error removing Admin group! %{error}
113
+ success: Admin group %{key} removed successfully
88
114
  destroy_scoped_style:
89
115
  error: Error removing CSS box! %{error}
90
116
  success: CSS box %{key} removed successfully
91
- experimental: Experimental options
92
117
  form:
118
+ edit_label: Rename label
119
+ errors:
120
+ incorrect_css: 'CSS in box #%{key} is invalid'
121
+ incorrect_json: 'JSON definition in box #%{key} is invalid'
93
122
  help:
94
123
  allow_images_in_full_editor: This will add an image uploader icon in all the editors WYSIWYG with the full toolbar enabled.
95
124
  allow_images_in_markdown_editor: This will allow markdown editor to upload images by copy & paste or drag & drop.
@@ -99,13 +128,27 @@ sv:
99
128
  drag_and_drop_supported: When uploading images, Drag & Drop is supported. Images will be uploaded to the server and inserted as external resources (it doesn't use base64 inline encoding).
100
129
  intergram_about: Intergram uses Telegram messenger to handle a live support chat widget embedded in the bottom of the page.
101
130
  intergram_config: 'Invite the <a href="https://web.telegram.org/#/im?p=@IntergramBot">@Intergram bot</a> to your group or start a chat with it directly. <a href="https://github.com/idoco/intergram#embed-intergram-in-your-website-with-these-2-simple-steps">+ info</a>'
131
+ proposal_custom_fields: Create custom proposal fields that applies only in certain parts of the public web (use the restrictions editor for that)
132
+ proposal_custom_fields_example: Data is stored in a XML object using compatible HTML attributes (dl,dt,dd elements) replacing the "body" in a normal proposal.
133
+ proposal_custom_fields_translations: "Labels, help text, placeholders and default values can use your application custom translations. \nFor that, instead of using a string literal, use the i18n key (it must containt at least one dot).\nFor instance:\n- \"activemodel.attributes.proposal.title\" instead of \"Title\"\n- \"activemodel.attributes.proposal.address\" instead of \"Address\"\nOr use your own keys in combination with other tools to define translations (eg: using the module Term Customizer):\n - \"myapp.custom_fields.bio\" instead of \"Biography\""
134
+ scoped_admins: Promote regular user to admins that can only administrate certain parts of the public web (use the restrictions editor for that). Note that users who already have regular admin permissions will be ignored.
102
135
  scoped_styles: Create custom CSS that applies only in certain parts of the public web (use the restrictions editor for that)
103
136
  scoped_styles_variables: 'You can use the following CSS variables for organization customized colors:'
104
137
  use_markdown_editor: This will substitute the Quill WYSIWYG editor, use a Markdown editor instead. Text will be rendered as HTML in the public pages (text in database will be saved as markdown text)
105
- form_styles:
138
+ form_proposal_custom_fields:
139
+ new: Add a new "custom fields" box
140
+ remove: Remove this "custom fields" box
141
+ sure_to_remove: Are you sure you want to destroy this fields box?
142
+ form_scoped_admins:
143
+ new: Add a new "Scoped Admins" group
144
+ remove: Remove this "Scoped Admins" group
145
+ sure_to_remove: Are you sure you want to destroy this "Scoped Admins" group?
146
+ form_scoped_styles:
106
147
  new: Add a new CSS box
107
148
  remove: Remove this CSS box
108
149
  sure_to_remove: Are you sure you want to destroy this CSS box?
150
+ none: "⛔ Never! - Deactivate any other constraint"
151
+ process_groups: Process groups
109
152
  rich_text_editor_in_public_views: 'NOTE: "Rich text editor for participants" is enabled, this option won''t apply. Use the editors hacks instead to enable images in proposals.'
110
153
  show:
111
154
  title: Tweaks for %{setting}
@@ -135,10 +178,12 @@ sv:
135
178
  error: Error updating condition case
136
179
  success: Condition case updated successfully
137
180
  menu:
181
+ admins: Scoped Admins
138
182
  checks: System compatibility
139
183
  editors: Editor hacks
140
184
  livechat: Live Chat
141
185
  menu_hacks: Menu tweaks
186
+ proposal_custom_fields: Proposals Custom Fields
142
187
  proposals: Proposals hacks
143
188
  styles: Custom styles
144
189
  surveys: Surveys & forms
@@ -150,17 +195,17 @@ sv:
150
195
  error: Error removing menu item! %{error}
151
196
  success: Menu item removed successfully
152
197
  edit:
153
- save: Save
154
- title: Edit menu item
198
+ save: Spara
199
+ title: Redigera menyobjekt
155
200
  form:
156
201
  label_help: Translations aren't automatically detected, be sure to fill in all the fields!
157
202
  target:
158
- blank: New window
159
- self: Same window
203
+ blank: Nytt fönster
204
+ self: Samma fönster
160
205
  visibility:
161
- default: Visible
162
- hidden: Always hidden
163
- logged: Only visible for logged users
206
+ default: Synligt
207
+ hidden: Alltid dolt
208
+ logged: Endast synlig för inloggade användare
164
209
  non_logged: Only visible for non-logged users
165
210
  index:
166
211
  confirm_destroy: Are you sure to remove this customization?
@@ -170,7 +215,7 @@ sv:
170
215
  remove_hack: Remove customization
171
216
  title: Main menu
172
217
  new:
173
- save: Save
218
+ save: Spara
174
219
  title: New menu item
175
220
  update:
176
221
  error: Error updating menu item! %{error}
@@ -183,7 +228,31 @@ sv:
183
228
  intro_message: Hello! How can we help you?
184
229
  title_closed: Click to chat!
185
230
  title_open: Let's chat!
231
+ content_blocks:
232
+ map:
233
+ collapse: Start with collapsed menu
234
+ map_center: Map center (Latitude, Longitude)
235
+ map_center_help: 'Use decimal points (ie: 41.38879, 2.15899). Leave it empty to automatically fit all the markers'
236
+ map_height: Map height (px)
237
+ map_settings: Map settings
238
+ map_zoom: Zoom (any number betwen 0 and 18)
239
+ map_zoom_help: Only applies if a map center is defined
240
+ menu_amendments: Show amendments
241
+ menu_meetings: Visa möten
242
+ name: Karta
243
+ show_accepted: Visa godkända förslag
244
+ show_evaluating: Visa förslag som utvärderas
245
+ show_not_answered: Show not answered proposals
246
+ show_rejected: Show rejected proposals
247
+ show_withdrawn: Show withdrawn proposals
248
+ text_settings: Text settings
249
+ title: Title
250
+ truncate: Maximum characters for popup descriptions
186
251
  credits: Decidim Awesome %{version} · Made with ♥ by Platoniq
252
+ custom_fields:
253
+ errors:
254
+ invalid_fields: Content couldn't be parsed but has been assigned to the field '%{field}'
255
+ invalid_xml: 'Content couldn''t be parsed: DL/DD elements not found in the XML'
187
256
  editor_images:
188
257
  create:
189
258
  error: Error uploading image!
@@ -193,8 +262,8 @@ sv:
193
262
  error:
194
263
  unavailable: The map is unavailable. Please configure geocoding to enable this component.
195
264
  show:
196
- view_meeting: View meeting
197
- view_proposal: View proposal
265
+ view_meeting: Visa möte
266
+ view_proposal: Visa förslag
198
267
  layouts:
199
268
  decidim:
200
269
  admin:
@@ -208,5 +277,8 @@ sv:
208
277
  autosaved_success: Data saved in local storage
209
278
  categories: Categories
210
279
  drag_and_drop_image: Add images by dragging & dropping or pasting them.
211
- meetings: Meetings
212
- proposals: Proposals
280
+ hashtags: Hashtags
281
+ items: items
282
+ meetings: Möten
283
+ proposals: Förslag
284
+ select_deselect_all: Select/deselect all
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ChangeAwesomeConfigVarType < ActiveRecord::Migration[5.2]
4
+ def change
5
+ change_column :decidim_awesome_config, :var, :string
6
+
7
+ Decidim::DecidimAwesome::AwesomeConfig.find_each do |config|
8
+ config.var.gsub!('"', "")
9
+ config.save!
10
+ end
11
+ end
12
+ end
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "decidim/decidim_awesome/awesome_helpers"
4
+
3
5
  module Decidim
4
6
  module DecidimAwesome
5
7
  # This is the engine that runs on the public interface of `DecidimAwesome`.
6
8
  class AdminEngine < ::Rails::Engine
9
+ include AwesomeHelpers
10
+
7
11
  isolate_namespace Decidim::DecidimAwesome::Admin
8
12
 
9
13
  paths["db/migrate"] = nil
@@ -14,14 +18,21 @@ module Decidim
14
18
  resources :constraints
15
19
  resources :menu_hacks, except: [:show]
16
20
  resources :config, param: :var, only: [:show, :update]
17
- post :new_scoped_style, to: "config#new_scoped_style"
18
- post :destroy_scoped_style, param: :key, to: "config#destroy_scoped_style"
21
+ resources :scoped_styles, param: :var, only: [:create, :destroy]
22
+ resources :proposal_custom_fields, param: :var, only: [:create, :destroy]
23
+ resources :scoped_admins, param: :var, only: [:create, :destroy]
24
+ get :users, to: "config#users"
25
+ post :rename_scope_label, to: "config#rename_scope_label"
19
26
  get :checks, to: "checks#index"
20
27
  root to: "config#show", var: :editors
21
28
  end
22
29
 
23
30
  initializer "decidim_admin_awesome.assets" do |app|
24
- app.config.assets.precompile += %w(decidim_admin_decidim_awesome_manifest.js decidim_admin_decidim_awesome_manifest.css)
31
+ app.config.assets.precompile += if version_prefix == "v0.23"
32
+ %w(legacy_decidim_admin_decidim_awesome_manifest.js decidim_admin_decidim_awesome_manifest.css)
33
+ else
34
+ %w(decidim_admin_decidim_awesome_manifest.js decidim_admin_decidim_awesome_manifest.css)
35
+ end
25
36
  end
26
37
 
27
38
  initializer "decidim_decidim_awesome.admin_mount_routes" do
@@ -36,7 +47,8 @@ module Decidim
36
47
  decidim_admin_decidim_awesome.config_path(:editors),
37
48
  icon_name: "fire",
38
49
  position: 7.5,
39
- active: is_active_link?(decidim_admin_decidim_awesome.config_path(:editors), :inclusive)
50
+ active: is_active_link?(decidim_admin_decidim_awesome.config_path(:editors), :inclusive),
51
+ if: defined?(current_user) && current_user&.read_attribute("admin")
40
52
  end
41
53
  end
42
54
 
@@ -10,8 +10,12 @@ module Decidim
10
10
  def awesome_config_instance
11
11
  return @awesome_config_instance if @awesome_config_instance
12
12
 
13
- @awesome_config_instance = Config.new request.env["decidim.current_organization"]
14
- @awesome_config_instance.context_from_request request
13
+ # if already created in the middleware, reuse it as it might have additional constraints
14
+ @awesome_config_instance = request.env["decidim_awesome.current_config"]
15
+ unless @awesome_config_instance.is_a? Config
16
+ @awesome_config_instance = Config.new request.env["decidim.current_organization"]
17
+ @awesome_config_instance.context_from_request request
18
+ end
15
19
  @awesome_config_instance
16
20
  end
17
21
 
@@ -20,7 +24,7 @@ module Decidim
20
24
  end
21
25
 
22
26
  def javascript_config_vars
23
- awesome_config.except(:scoped_styles).to_json.html_safe
27
+ awesome_config.except(:scoped_styles, :proposal_custom_fields, :scoped_admins).to_json.html_safe
24
28
  end
25
29
 
26
30
  def show_public_intergram?
@@ -51,14 +55,17 @@ module Decidim
51
55
 
52
56
  # Collects all CSS that is applied in the current URL context
53
57
  def awesome_custom_styles
54
- return unless awesome_config[:scoped_styles]
55
- return @awesome_custom_styles if @awesome_custom_styles
58
+ @awesome_custom_styles ||= awesome_config_instance.collect_sub_configs_values("scoped_style")
59
+ end
56
60
 
57
- styles = awesome_config[:scoped_styles]&.filter do |key, _value|
58
- config = AwesomeConfig.find_by(var: "scoped_style_#{key}", organization: current_organization)
59
- @awesome_config_instance.valid_in_context?(config&.constraints)
60
- end
61
- @awesome_custom_styles = styles.values.join("\n")
61
+ # Collects all proposal custom fields that is applied in the current URL context
62
+ def awesome_scoped_admins
63
+ @awesome_scoped_admins ||= awesome_config_instance.collect_sub_configs_values("scoped_admin")
64
+ end
65
+
66
+ # Collects all proposal custom fields that is applied in the current URL context
67
+ def awesome_proposal_custom_fields
68
+ @awesome_proposal_custom_fields ||= awesome_config_instance.collect_sub_configs_values("proposal_custom_field")
62
69
  end
63
70
 
64
71
  def version_prefix
@@ -1,23 +1,33 @@
1
1
  decidim-admin:
2
2
  /app/views/layouts/decidim/admin/_header.html.erb:
3
- decidim-0.22: 6af51ec6b8a760b0ee6e00a7834f5f9a
4
3
  decidim-0.23: 45f0e15f1b02a1c1a73b1a2184fd55af
5
4
  decidim-core:
6
5
  /app/views/layouts/decidim/_head.html.erb:
7
- decidim-0.22: bf16a58cd9e6d3f73e6875ff3d0b1e48
8
6
  decidim-0.23: e7f5eea07e884665474948ea750fc720
9
7
  /app/assets/javascripts/decidim/editor.js.es6:
10
- decidim-0.22: 797d0ec1c9e79453cf6718f82d2fdd27
11
8
  decidim-0.23: cb059b8ff0ffc62c67eb99d8d7a6637b
12
9
  decidim-0.23.1: 4787f73f0f33661e3897404f10019d26
10
+ decidim-0.24: 35262835144421baa700a34ca0939396
13
11
  /app/presenters/decidim/menu_presenter.rb:
14
- decidim-0.22: 042743c44a2aff284b493c7bebbccbb3
15
12
  decidim-0.23: 042743c44a2aff284b493c7bebbccbb3
13
+ decidim-0.24: 284c96f19cd98df091d8178d6db5a8b3
16
14
  /app/presenters/decidim/menu_item_presenter.rb:
17
- decidim-0.22: 70db39954b5840924530bf94d2a0a73a
18
15
  decidim-0.23: 70db39954b5840924530bf94d2a0a73a
16
+ /app/helpers/decidim/amendments_helper.rb:
17
+ decidim-0.23: 75bd41c3186729c7c84911bc7c7e9677
19
18
  decidim-proposals:
20
- /app/presenters/decidim/proposals/proposal_presenter.rb:
21
- decidim-0.22: 7d60c8310d7fa4e38d9a27080c22b12c
22
- decidim-0.23: 437c0c25151f605401a4f14d090ba5ea
23
- decidim-0.23.1: 892021b2ce9ac10c2e1b738e6948cde0
19
+ /app/forms/decidim/proposals/proposal_wizard_create_step_form.rb:
20
+ decidim-0.23: b99c3223f1e75f2a69a89ae9a3d28182
21
+ decidim-0.23.1: 13ebf86ec88fa64d2651ab9735d5de90
22
+ decidim-0.24: db69edd0ba8ffa3965a5c44a6bfaba8d
23
+ /app/helpers/decidim/proposals/application_helper.rb:
24
+ decidim-0.23: d923323e3db542b84f42db3a4f782a8d
25
+ decidim-0.24: c5f99f5fa7de9a6e45776983330e9d73
26
+ /app/views/decidim/proposals/collaborative_drafts/show.html.erb:
27
+ decidim-0.23: b0fc5dfaf056c1a1dc667f8ded1a4b2e
28
+ decidim-0.24: 2a7e0a4c65361f238fd1b917f39c8642
29
+ /app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb:
30
+ decidim-0.23: b0fc5dfaf056c1a1dc667f8ded1a4b2e
31
+ decidim-0.24: 6f717555a20e2ab3f555003c337d3003
32
+ /app/views/decidim/proposals/admin/proposals/_form.html.erb:
33
+ decidim-0.23: 022eef3e8f57ccc2136ed1289b0f217d
@@ -9,13 +9,14 @@ module Decidim
9
9
  @vars = AwesomeConfig.for_organization(organization).includes(:constraints)
10
10
  @context = {
11
11
  participatory_space_manifest: nil,
12
- participatory_slug: nil,
12
+ participatory_space_slug: nil,
13
13
  component_id: nil,
14
14
  component_manifest: nil
15
15
  }
16
+ @sub_configs = {}
16
17
  end
17
18
 
18
- attr_reader :context
19
+ attr_reader :context, :organization, :vars
19
20
  attr_writer :defaults
20
21
 
21
22
  def defaults
@@ -84,12 +85,58 @@ module Decidim
84
85
  # if no constraints defined, applies to everything
85
86
  return true if constraints.blank?
86
87
 
88
+ # if containts the "none" constraints, deactivate everything else
89
+ return false if constraints.detect { |c| c.settings["participatory_space_manifest"] == "none" }
90
+
87
91
  # check if current context matches some constraint
88
92
  constraints.detect do |constraint|
89
- # if some setting is different, rejects
90
- invalid = constraint.settings.detect { |key, val| context[key.to_sym].to_s != val.to_s }
91
- invalid.blank?
93
+ settings = constraint.settings.symbolize_keys
94
+ match_method = settings.delete(:match)
95
+ if match_method == "exclusive"
96
+ # all keys must match
97
+ settings == context
98
+ else
99
+ # constraints keys can match the context partially (ie: if slug is not specified, any space matches in the same manifest)
100
+ # if some setting is different, rejects
101
+ invalid = constraint.settings.detect { |key, val| context[key.to_sym].to_s != val.to_s }
102
+ invalid.blank?
103
+ end
104
+ end
105
+ end
106
+
107
+ # adds some custom constraints for the instance that can be generated dynamically
108
+ def inject_sub_config_constraints(singular_key, subkey, constraints)
109
+ sub_configs_for(singular_key)[subkey.to_sym]&.add_constraints constraints
110
+ end
111
+
112
+ # Merges all subconfigs values for custom_styles or any other scoped confs
113
+ # by default filtered according to the current scope, a block can be passed for custom filtering
114
+ # ie, collect everything:
115
+ # collect_sub_configs_values("scoped_style") { true }
116
+ def collect_sub_configs_values(singular_key)
117
+ plural_key = singular_key.pluralize.to_sym
118
+
119
+ fields = config[plural_key]&.filter do |key, _value|
120
+ subconfig = sub_configs_for(singular_key)[key]
121
+ # allow custom filtering if block given
122
+ if block_given?
123
+ yield subconfig
124
+ else
125
+ valid_in_context?(subconfig&.all_constraints)
126
+ end
92
127
  end
128
+ fields.values
129
+ end
130
+
131
+ def sub_configs_for(singular_key)
132
+ return @sub_configs[singular_key] if @sub_configs[singular_key]
133
+
134
+ plural_key = singular_key.pluralize.to_sym
135
+ return {} unless config[plural_key]
136
+
137
+ @sub_configs[singular_key] = config[plural_key].map do |key, _value|
138
+ [key, AwesomeConfig.find_by(var: "#{singular_key}_#{key}", organization: @organization)]
139
+ end.to_h
93
140
  end
94
141
 
95
142
  private
@@ -107,7 +154,7 @@ module Decidim
107
154
 
108
155
  def calculate_config
109
156
  # filter vars compliant with current context
110
- valid = @vars.filter { |item| enabled_for_organization?(item.var) && valid_in_context?(item.constraints) }
157
+ valid = @vars.filter { |item| enabled_for_organization?(item.var) && valid_in_context?(item.all_constraints) }
111
158
  .map { |v| [v.var.to_sym, v.value] }.to_h
112
159
 
113
160
  map_defaults do |key|
@@ -119,9 +166,7 @@ module Decidim
119
166
  def enabled_for_organization?(key)
120
167
  case key.to_sym
121
168
  when :allow_images_in_proposals
122
- if @organization.respond_to? :rich_text_editor_in_public_views
123
- return false if @organization.rich_text_editor_in_public_views
124
- end
169
+ return false if @organization.rich_text_editor_in_public_views
125
170
  end
126
171
  true
127
172
  end
@@ -5,17 +5,32 @@ module Decidim
5
5
  module ContextAnalyzers
6
6
  # Translates some Decidim URL path to detected participatory spaces and components
7
7
  class RequestAnalyzer
8
+ class << self
9
+ def context_for(request)
10
+ analyzer = new request
11
+ analyzer.extract_context!
12
+ analyzer.context
13
+ end
14
+
15
+ # In the frontend there's no a 100% correspondence between url and manifest name
16
+ def participatory_spaces_routes
17
+ spaces = Decidim.participatory_space_manifests \
18
+ .filter { |space| !DecidimAwesome.config.participatory_spaces_routes_context.has_key?(space.name) } \
19
+ .map { |space| [space.name.to_s, space.name.to_s] }.to_h
20
+ DecidimAwesome.config.participatory_spaces_routes_context.each do |manifest, routes|
21
+ routes.each do |route|
22
+ spaces[route.to_s] = manifest.to_s
23
+ end
24
+ end
25
+ spaces
26
+ end
27
+ end
28
+
8
29
  def initialize(request)
9
30
  @request = request
10
31
  @context = {}
11
32
  end
12
33
 
13
- def self.context_for(request)
14
- analyzer = new request
15
- analyzer.extract_context!
16
- analyzer.context
17
- end
18
-
19
34
  attr_reader :request, :context
20
35
 
21
36
  def extract_context!
@@ -25,20 +40,8 @@ module Decidim
25
40
 
26
41
  private
27
42
 
28
- # In the frontend there's no a 100% correspondence between url and manifest name
29
- def participatory_spaces
30
- spaces = Decidim.participatory_space_manifests.map do |space|
31
- [space.name.to_s, space.name.to_s]
32
- end.to_h
33
- spaces.merge(
34
- "processes" => "participatory_processes",
35
- "participatory_process_groups" => "participatory_processes",
36
- "assemblies_types" => "assemblies"
37
- )
38
- end
39
-
40
43
  def process_admin_segments(segments)
41
- spaces = participatory_spaces
44
+ spaces = RequestAnalyzer.participatory_spaces_routes
42
45
  return unless spaces[segments[0]]
43
46
 
44
47
  @context[:participatory_space_manifest] = spaces[segments[0]]
@@ -53,7 +56,7 @@ module Decidim
53
56
  end
54
57
 
55
58
  def process_front_segments(segments)
56
- spaces = participatory_spaces
59
+ spaces = RequestAnalyzer.participatory_spaces_routes
57
60
  return unless spaces[segments[0]]
58
61
 
59
62
  @context[:participatory_space_manifest] = spaces[segments[0]]
@@ -70,8 +73,11 @@ module Decidim
70
73
  def system_manifest?(path)
71
74
  patterns = [
72
75
  %r{^/admin/newsletters},
76
+ %r{^/admin/moderations},
77
+ %r{^/admin/users},
73
78
  %r{^/admin/organization},
74
- %r{^/admin/static_pages}
79
+ %r{^/admin/static_pages},
80
+ %r{^/admin/logs}
75
81
  ]
76
82
  path.match(Regexp.union(patterns))
77
83
  end