decidim-voca 0.0.6 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +161 -161
  3. data/README.md +42 -133
  4. data/Rakefile +46 -39
  5. data/app/cells/decidim/footer_topics/show_overrides.erb +8 -0
  6. data/app/cells/decidim/meetings/dates_and_map/show_overrides.erb +23 -0
  7. data/app/commands/decidim/voca/admin/code_census/save_code_list.rb +34 -0
  8. data/app/commands/decidim/voca/code_census/confirm_code_authorization.rb +16 -0
  9. data/app/commands/decidim/voca/create_editor_file.rb +36 -0
  10. data/app/commands/decidim/voca/rack_attack_configurator.rb +244 -0
  11. data/app/commands/decidim/voca/sync_redis_routing.rb +120 -0
  12. data/app/commands/decidim/voca/user_fields_configurator.rb +40 -0
  13. data/app/controllers/decidim/voca/admin/application_controller.rb +4 -6
  14. data/app/controllers/decidim/voca/admin/code_census/code_lists_controller.rb +40 -0
  15. data/app/controllers/decidim/voca/application_controller.rb +4 -6
  16. data/app/controllers/decidim/voca/code_census/authorizations_controller.rb +53 -0
  17. data/app/controllers/decidim/voca/editor_files_controller.rb +47 -0
  18. data/app/controllers/decidim/voca/geolocation_controller.rb +32 -0
  19. data/app/forms/decidim/voca/admin/code_census/code_list_form.rb +21 -0
  20. data/app/forms/decidim/voca/admin/organization_config_form.rb +24 -0
  21. data/app/forms/decidim/voca/code_census/code_form.rb +41 -0
  22. data/app/forms/decidim/voca/editor_file_form.rb +18 -0
  23. data/app/jobs/decidim/voca/machine_translate_awesome_menu_label_job.rb +63 -0
  24. data/app/jobs/decidim/voca/machine_translate_component_setting_job.rb +58 -0
  25. data/app/jobs/decidim/voca/machine_translate_content_block_setting_job.rb +85 -0
  26. data/app/models/decidim/voca/conversation_uuid.rb +18 -0
  27. data/app/models/decidim/voca/editor_file.rb +18 -0
  28. data/app/models/decidim/voca/validation_code.rb +13 -0
  29. data/app/overrides/admin_add_machine_translation_flag.rb +40 -0
  30. data/app/overrides/insert_assets.rb +26 -0
  31. data/app/overrides/insert_weglot_scripts.rb +60 -0
  32. data/app/overrides/proposal_camera.rb +18 -0
  33. data/app/overrides/show_votes.rb +27 -0
  34. data/app/overrides/voca_footer.rb +52 -0
  35. data/app/packs/entrypoints/admin-decidim-voca.js +2 -0
  36. data/app/packs/entrypoints/admin-decidim-voca.scss +1 -0
  37. data/app/packs/entrypoints/decidim-voca-fixes.scss +1 -0
  38. data/app/packs/entrypoints/decidim-voca.js +1 -0
  39. data/app/packs/entrypoints/decidim-voca.scss +1 -0
  40. data/app/packs/images/voca-logo-primary-x3.png +0 -0
  41. data/app/packs/src/decidim/direct_uploads/upload_field.js +150 -0
  42. data/app/packs/src/decidim/voca/admin/voca.js +16 -0
  43. data/app/packs/src/decidim/voca/proposal_better_ux/use_camera_button.js +39 -0
  44. data/app/packs/src/decidim/voca/proposal_better_ux/utils/get_current_position.js +21 -0
  45. data/app/packs/src/decidim/voca/proposal_better_ux/utils/get_proposal_form.js +13 -0
  46. data/app/packs/src/decidim/voca/proposal_better_ux/utils/loading.js +23 -0
  47. data/app/packs/src/decidim/voca/proposal_better_ux/utils/locate_coordinates.js +23 -0
  48. data/app/packs/src/decidim/voca/proposal_custom_fields/custom_field_renderer_override.js +152 -0
  49. data/app/packs/src/decidim/voca/proposal_custom_fields/editor_budget_field.js +329 -0
  50. data/app/packs/src/decidim/voca/proposal_custom_fields/editor_upload_field.js +85 -0
  51. data/app/packs/src/decidim/voca/proposal_custom_fields/proposal_custom_fields.js +96 -0
  52. data/app/packs/src/decidim/voca/proposal_custom_fields/render_budget_field.js +76 -0
  53. data/app/packs/src/decidim/voca/proposal_fields/render_budget_field.js +76 -0
  54. data/app/packs/src/decidim/voca/questionnaire/scroll_questionnaire_steps_to_top.js +18 -0
  55. data/app/packs/src/decidim/voca/voca.js +4 -0
  56. data/app/packs/src/decidim/voca/weglot/index.js +13 -0
  57. data/app/packs/src/decidim/voca/weglot/start_weglot.js +112 -0
  58. data/app/packs/src/decidim/voca/weglot/switcher.js +92 -0
  59. data/app/packs/src/decidim/voca/weglot/wait_for_weglot.js +10 -0
  60. data/app/packs/stylesheets/decidim/voca/_custom_proposal_fields.scss +111 -0
  61. data/app/packs/stylesheets/decidim/voca/_decidim_voca.scss +5 -0
  62. data/app/packs/stylesheets/decidim/voca/_decidim_voca_fixes.scss +25 -0
  63. data/app/packs/stylesheets/decidim/voca/_primary_footer.scss +77 -0
  64. data/app/packs/stylesheets/decidim/voca/_proposal_camera.scss +14 -0
  65. data/app/packs/stylesheets/decidim/voca/_weglot.scss +61 -0
  66. data/app/packs/stylesheets/decidim/voca/admin/_decidim_voca.scss +5 -0
  67. data/app/packs/stylesheets/decidim/voca/admin/_full_machine_translation.scss +34 -0
  68. data/app/permissions/decidim/voca/admin/permissions.rb +31 -0
  69. data/app/permissions/decidim/voca/permissions.rb +17 -0
  70. data/app/views/decidim/voca/admin/code_census/authorizations/new.html.erb +33 -0
  71. data/app/views/decidim/voca/admin/code_census/code_lists/edit.html.erb +27 -0
  72. data/app/views/decidim/voca/code_census/authorizations/new.html.erb +24 -0
  73. data/app/views/decidim/voca/deepl/overrides/_admin_machine_translation_alert.html.erb +14 -0
  74. data/app/views/decidim/voca/rack_attack/_blocked.html.erb +151 -0
  75. data/app/views/decidim/voca/weglot/_js_configuration.html.erb +14 -0
  76. data/app/views/decidim/voca/weglot/_locale_switcher.html.erb +14 -0
  77. data/app/views/decidim/voca/weglot/_locale_switcher_mobile.erb +14 -0
  78. data/app/views/decidim/voca/weglot/_topbar_locale_switcher.html.erb +14 -0
  79. data/config/assets.rb +12 -0
  80. data/config/i18n-tasks.yml +14 -5
  81. data/config/locales/cs.yml +94 -0
  82. data/config/locales/custom_fields.cs.yml +30 -0
  83. data/config/locales/custom_fields.en.yml +41 -0
  84. data/config/locales/custom_fields.fr.yml +30 -0
  85. data/config/locales/custom_fields.it.yml +30 -0
  86. data/config/locales/en.yml +97 -4
  87. data/config/locales/fr.yml +102 -0
  88. data/config/locales/it.yml +94 -0
  89. data/lib/decidim/voca/awesome_menu_label_machine_translation.rb +73 -0
  90. data/lib/decidim/voca/awesome_menu_labels.rb +28 -0
  91. data/lib/decidim/voca/code_census/admin_engine.rb +22 -0
  92. data/lib/decidim/voca/code_census/engine.rb +29 -0
  93. data/lib/decidim/voca/code_census/workflow.rb +7 -0
  94. data/lib/decidim/voca/code_census.rb +4 -0
  95. data/lib/decidim/voca/component_setting_manifest.rb +27 -0
  96. data/lib/decidim/voca/component_setting_pending_locales.rb +33 -0
  97. data/lib/decidim/voca/component_translated_settings_machine_translation.rb +86 -0
  98. data/lib/decidim/voca/configuration.rb +23 -0
  99. data/lib/decidim/voca/content_block_setting_manifest.rb +67 -0
  100. data/lib/decidim/voca/content_block_translated_settings_machine_translation.rb +100 -0
  101. data/lib/decidim/voca/deepl/deepl_active_job_context.rb +27 -0
  102. data/lib/decidim/voca/deepl/deepl_context.rb +78 -0
  103. data/lib/decidim/voca/deepl/deepl_form_builder_overrides.rb +82 -0
  104. data/lib/decidim/voca/deepl/deepl_machine_translator.rb +61 -0
  105. data/lib/decidim/voca/deepl/deepl_middleware.rb +83 -0
  106. data/lib/decidim/voca/deepl/engine_config.rb +181 -0
  107. data/lib/decidim/voca/deepl/settings.rb +75 -0
  108. data/lib/decidim/voca/deepl/translation_bar_overrides.rb +20 -0
  109. data/lib/decidim/voca/deepl.rb +10 -0
  110. data/lib/decidim/voca/engine.rb +320 -11
  111. data/lib/decidim/voca/export/comment_serializer_localized_csv.rb +34 -0
  112. data/lib/decidim/voca/export/csv_with_locale_transformer.rb +53 -0
  113. data/lib/decidim/voca/export/proposal_serializer_localized_csv.rb +45 -0
  114. data/lib/decidim/voca/export/user_answers_serializer_localized_csv.rb +54 -0
  115. data/lib/decidim/voca/installation.rb +33 -0
  116. data/lib/decidim/voca/machine_translation/translate_string.rb +121 -0
  117. data/lib/decidim/voca/machine_translation_human_source.rb +29 -0
  118. data/lib/decidim/voca/machine_translation_resource_job_voca.rb +65 -0
  119. data/lib/decidim/voca/organization_voca_extensions.rb +31 -0
  120. data/lib/decidim/voca/overrides/csv_export_serializers.rb +51 -0
  121. data/lib/decidim/voca/overrides/meetings/dates_and_map_cell_overrides.rb +20 -0
  122. data/lib/decidim/voca/overrides/menu_breadcrumb_last_activity_cache.rb +31 -0
  123. data/lib/decidim/voca/overrides/mod_secure/conversation_controller_overrides.rb +19 -0
  124. data/lib/decidim/voca/overrides/mod_secure/conversation_sanitize.rb +29 -0
  125. data/lib/decidim/voca/overrides/mod_secure/conversation_uuid.rb +34 -0
  126. data/lib/decidim/voca/overrides/mod_secure/user_conversations_redirect_overrides.rb +53 -0
  127. data/lib/decidim/voca/overrides/mod_secure/user_profile_verification_override.rb +31 -0
  128. data/lib/decidim/voca/overrides/newsletter_helper_overrides.rb +30 -0
  129. data/lib/decidim/voca/overrides/resource_presenter_overrides.rb +30 -0
  130. data/lib/decidim/voca/overrides/sanitize_helper_overrides.rb +39 -0
  131. data/lib/decidim/voca/sync_locales/README.md +13 -0
  132. data/lib/decidim/voca/sync_locales/awesome_menu_label_sync.rb +89 -0
  133. data/lib/decidim/voca/sync_locales/command.rb +54 -0
  134. data/lib/decidim/voca/sync_locales/component_setting_sync.rb +72 -0
  135. data/lib/decidim/voca/sync_locales/content_block_setting_sync.rb +86 -0
  136. data/lib/decidim/voca/sync_locales/field_hash_normalizer.rb +98 -0
  137. data/lib/decidim/voca/sync_locales/locale_context.rb +589 -0
  138. data/lib/decidim/voca/sync_locales/machine_translation_enqueuer.rb +60 -0
  139. data/lib/decidim/voca/sync_locales/relation_lint_runner.rb +55 -0
  140. data/lib/decidim/voca/sync_locales/runner.rb +352 -0
  141. data/lib/decidim/voca/sync_locales.rb +11 -0
  142. data/lib/decidim/voca/update_column_without_callbacks.rb +21 -0
  143. data/lib/decidim/voca/version.rb +13 -3
  144. data/lib/decidim/voca.rb +40 -14
  145. data/lib/decidim-voca.rb +5 -0
  146. data/lib/tasks/decidim/voca/voca_anonymize.rake +41 -0
  147. data/lib/tasks/decidim/voca/voca_clean_machine_translations.rake +22 -0
  148. data/lib/tasks/decidim/voca/voca_enhanced_invalid_record.rake +141 -0
  149. data/lib/tasks/decidim/voca/voca_install_migration.rake +45 -0
  150. data/lib/tasks/decidim/voca/voca_relation_lint.rake +12 -0
  151. data/lib/tasks/decidim/voca/voca_sync_locales.rake +10 -0
  152. data/lib/tasks/decidim/voca/voca_upgrade.rake +13 -0
  153. data/lib/tasks/decidim/voca/voca_webpacker.rake +58 -0
  154. metadata +247 -55
  155. data/app/assets/config/voca_manifest.js +0 -0
  156. data/app/assets/images/decidim/voca/icon.svg +0 -1
  157. data/app/commands/decidim/voca/organization/command.rb +0 -16
  158. data/app/commands/decidim/voca/organization/organization_command.rb +0 -17
  159. data/app/commands/decidim/voca/organization/update_color_command.rb +0 -35
  160. data/app/commands/decidim/voca/organization/update_environment_command.rb +0 -23
  161. data/app/commands/decidim/voca/organization/update_feature_command.rb +0 -32
  162. data/app/commands/decidim/voca/organization/update_file_upload_command.rb +0 -45
  163. data/app/commands/decidim/voca/organization/update_locale_command.rb +0 -53
  164. data/app/commands/decidim/voca/organization/update_naming_command.rb +0 -30
  165. data/app/commands/decidim/voca/organization/update_permission_command.rb +0 -31
  166. data/app/commands/decidim/voca/organization/update_smtp_command.rb +0 -51
  167. data/app/jobs/decidim/voca/command_job.rb +0 -36
  168. data/app/jobs/decidim/voca/webhook_notifier_job.rb +0 -57
  169. data/app/rpc/decidim/voca/decidim_service_controller.rb +0 -68
  170. data/app/rpc/decidim/voca/rpc/enum_casting.rb +0 -58
  171. data/app/rpc/decidim/voca/rpc/get_settings.rb +0 -144
  172. data/app/rpc/decidim/voca/rpc/health.rb +0 -18
  173. data/app/rpc/decidim/voca/rpc/seed_admin.rb +0 -75
  174. data/app/rpc/decidim/voca/rpc/set_settings.rb +0 -56
  175. data/app/rpc/decidim/voca/rpc/setup_db.rb +0 -38
  176. data/config/environments/development.rb +0 -6
  177. data/config/spring.rb +0 -2
  178. data/lib/decidim/voca/admin.rb +0 -10
  179. data/lib/decidim/voca/admin_engine.rb +0 -27
  180. data/lib/decidim/voca/backup/app_backup.rb +0 -169
  181. data/lib/decidim/voca/backup/app_decrypt_backup_file.rb +0 -50
  182. data/lib/decidim/voca/backup/app_encrypt_backup_file.rb +0 -49
  183. data/lib/decidim/voca/backup/app_upload_to_s3.rb +0 -49
  184. data/lib/decidim/voca/middleware/dynamic_config_middleware.rb +0 -42
  185. data/lib/decidim/voca/rpc/decidim_pb.rb +0 -134
  186. data/lib/decidim/voca/rpc/decidim_services_pb.rb +0 -30
  187. data/lib/decidim/voca/test/factories.rb +0 -9
  188. data/lib/decidim/voca/updater.rb +0 -50
  189. data/lib/tasks/voca.rake +0 -88
data/README.md CHANGED
@@ -1,153 +1,62 @@
1
- [![coverage](https://git.octree.ch/decidim/vocacity/tasks/badges/main/coverage.svg?job=coverage-024)](https://github.com/octree-gva/voca-tasks)
1
+ <h1 align="center"><img src="https://github.com/octree-gva/meta/blob/main/decidim/static/header.png?raw=true" alt="Decidim - Octree Participatory democracy on a robust and open source solution" /></h1>
2
+ <h4 align="center">
3
+ <a href="https://gitlab.com/octree_gva/decidim/vocacity/decidim-modules/decidim-voca/-/work_items">Issues</a> |
4
+ <a href="https://octree-gva.github.io/decidim-voca/">Documentation</a> <br/><br />
5
+ <a href="https://crowdin.com/project/decidim-spam-module"><img src="https://badges.crowdin.net/decidim-voca/localized.svg" /></a><br /><br />
6
+ <a href="https://www.octree.ch">Octree</a> |
7
+ <a href="https://octree.ch/en/contact-us/">Contact Us</a><br/><br/>
8
+ <a href="https://decidim.org">Decidim</a> |
9
+ <a href="https://docs.decidim.org/en/">Decidim Docs</a> |
10
+ <a href="https://meta.decidim.org">Participatory Governance (meta Decidim)</a><br/><br/>
11
+ <a href="https://matrix.to/#/+decidim:matrix.org">Decidim Community (Matrix+Element.io)</a><br /><br />
12
+ </h4><br />
2
13
 
3
- [![release](https://git.octree.ch/decidim/vocacity/tasks/badges/main/release.svg)](https://github.com/octree-gva/voca-tasks)
14
+ # Decidim Voca
15
+ Fixes and adjustments for the Decidim instances distributed by voca.
4
16
 
5
- # Voca
17
+ ## Documentation
18
+ The documentation and the API specification are in the [documentation website](https://octree-gva.github.io/decidim-voca/)
6
19
 
7
- Create&Manage Decidim instances on-the-fly, deploy all its ecosystem.
8
- Voca focuses on Decidim, released on [APGL-3 open-source license](LICENSE.md) and all the ecosystem around the platform. As _Decidim is not a tool, but a framework for digital democratic participation, many tools gravitates around Decidim._
20
+ ## Development and testing (Docker)
9
21
 
10
- # RPC private API for Decidim
11
- This gem add internal functionalities to Decidim in order to be managed remotly. We do mostly:
22
+ Use the Compose stack from this directory. Prefer **`docker compose exec`** into the long-running **`voca`** service (after `docker compose up -d`) so Bundler sees the same gem path as the dev image.
12
23
 
13
- - Setup [gruf](https://github.com/bigcommerce/gruf) to run a gRPC server
14
- - Implement the [decidim.proto](https://raw.githubusercontent.com/octree-gva/voca-system/main/backend/contrib/rpc-protos/decidim/decidim.proto) spec
15
- - Add a middleware two dynamically set config data.
24
+ Example: run the **export** specs and unset `DATABASE_URL` so the dummy app uses `config/database.yml`:
16
25
 
17
-
18
- ## RPC
19
- From the .proto file, two files are generated, lib/decidim/voca/rpc/decidim_pb.rb and lib/decidim/voca/rpc/decidim_services_pb.rb. These files describe the skeletton of the input and response we need to comply.
20
-
21
- In the controller `Decidim::Voca::DecidimServiceController`, we bind its method to these services and execute Commands for each methods.
22
- For example, a compile method is implemented this way:
23
-
24
- ```
25
- ## Compile assets.
26
- def compile_assets
27
- `bundle exec rails assets:precompile`
28
- ::Google::Protobuf::Empty.new
29
- end
30
- ```
31
-
32
- When the code to resolves a RPC methods take more than 2 lines, we do a Command to isolate the code in one class. This is the case for most of the code. You can find the in the [rpc directory](./app/rpc/decidim/voca/rpc).
33
-
34
- ### Casting
35
- As RPC is a generic way to build APIs, we have to translate constants in appropriate string for the application.
36
-
37
- For example, `SETTINGS_REGISTER_MODE_OPTION::SETTINGS_REGISTER_MODE_REGISTER_AND_LOGIN` is actually just `enable` for the user_register_mode Decidim settings. To do so,
38
- we have an utility class `Decidim::Voca::Rpc::EnumCaster`.
39
-
40
- ## Middleware
41
- We get inspiration on [this article](https://pawelurbanek.com/rails-dynamic-config) to setup a middleware that retrieve config values from redis and then inject it into the code.
42
-
43
- For every query, we do a small step of getting data from our Redis store,
44
- and inject the configuration object in Decidim. Like this:
26
+ ```bash
27
+ docker compose up -d
28
+ docker compose exec voca bash -lc 'cd /home/module && unset DATABASE_URL && export RAILS_ENV=test && bundle exec rspec spec/lib/decidim/voca/export*spec.rb'
45
29
  ```
46
- # ./lib/decidim/voca/middleware/dynamic_config_middleware.rb
47
- if config_data["currency_unit"].present?
48
- Decidim.currency_unit = config_data["currency_unit"]
49
- end
50
- ```
51
-
52
- This is particularly usefull as it allows us to include Decidim configurations in our `decidim.proto` file, and set the redis value when needed.
53
-
54
- ```
55
- # ./app/commands/decidim/voca/organization/update_locale_command.rb
56
- global_configuration = locale_settings.select do |key|
57
- "#{key}" == "currency_unit" || "#{key}" == "timezone"
58
- end.delete_if { |_k, v| v.blank? }
59
- unless global_configuration.empty?
60
- redis_client = Redis.new(
61
- url: ENV.fetch("REDIS_CONFIG_URL", "redis://127.0.0.1:6379/2"),
62
- );
63
- global_configuration.each do |key, value|
64
- # Update the Redis hash values
65
- redis_client.hset("config", "#{key}", "#{value}")
66
- end
67
- # Close the Redis connection
68
- redis_client.quit
69
- end
70
- ```
71
- ## Repositories
72
-
73
- | repo | info | stable version |
74
- | -------------------------------------------------------- | --------------------------------------------------------------------------- | -------------- |
75
- | [voca-system](https://github.com/octree-gva/voca-system) | Install and manage decidim instances through a Dashboard | v0.1.0 |
76
- | [voca-tasks](https://github.com/octree-gva/voca-tasks) | Gem embedded in our Decidim image. Manipulate and manage decidim instances. | v0.1.0 |
77
- | [voca-jps](https://github.com/octree-gva/voca-jps) | Jelastic Manifest to deploy Decidim images | v0.1.0 |
78
- | [voca-docker](https://github.com/octree-gva/voca-docker) | Build Decidim docker images for Voca | v0.1.0 |
79
- | [voca-protos](https://github.com/octree-gva/voca-protos) | RPC prototypes for voca | v0.1.0 |
80
-
81
- # Decidim::Voca
82
-
83
- This Gem allows configuring a Decidim instance with gRPC. This is a domain-specific gem, which is useful only if you host your own Voca system.
84
-
85
- ## Readings before starting
86
30
 
87
- * [gruf, a RPC gem for rails](https://github.com/bigcommerce/gruf)
88
- * [GRPC for ruby](https://grpc.io/docs/languages/ruby/)
89
- * [proto3 Styleguide](https://developers.google.com/protocol-buffers/docs/style)
31
+ There is no `bin/check` in this repository; use `bundle exec rspec` and `bundle exec rubocop` inside the container. See [CONTRIBUTING.md](CONTRIBUTING.md) for where features live.
90
32
 
91
- ## Repository structure
33
+ ### Features
34
+ - `anonymize users`: Run`rails decidim:voca:anonymize` to anonymize all your database and avoid sending email or leaking nicknames/passwords.
92
35
 
93
- ### Generated client
94
- The client is generated with `bundle exec rails update_voca_proto`, and
95
- save the client and service in [`/lib/decidim/voca/rpc`](./lib/decidim/voca/rpc)
36
+ ## Contribute
96
37
 
97
- ### RPC Decidim Service
98
- The entry point for RPC Decidim Service is in [`/app/rpc/decidim/voca/decidim_service_controller.rb`](./app/rpc/decidim/voca/decidim_service_controller.rb).
99
- This controller have a method per registered message, and will call some concerns in the `/app/rpc/decidim/voca/rpc` folder.
100
-
101
- ### Updating commands
102
- We use Rectify::Command in `/app/commmands/decidim/voca` for all update-related command.
38
+ ## License
39
+ This module is under APGLv3 Licence. See [LICENSE](LICENSE.md) for more information
103
40
 
41
+ ## Update Versions
42
+ > Release a version is up to the maintainer of this repo.
104
43
 
105
- ## Installation
44
+ The main package.json version attribute is dispatch on versionning the ruby engine, allowing to bump the multi-repo with unique version.
106
45
 
107
- Add this line to your application's Gemfile:
46
+ To run these scripts, change your current branch to `main` and do:
108
47
 
109
- ```ruby
110
- gem "decidim-voca"
48
+ Release a patch
111
49
  ```
112
-
113
- And then execute:
114
-
115
- ```sh
116
- bundle install
50
+ yarn version --new-version patch --no-git-tag-version
51
+ yarn postversion
52
+ git add .
53
+ git tag v0.0.<yourpatch>
117
54
  ```
118
55
 
119
- ## Development
120
-
121
- We suppose you have docker installed in your environment.
122
-
123
- ```sh
124
- docker-compose up -d
125
- docker-compose run --rm app bash -c "cd $RAILS_ROOT && rails db:migrate"
56
+ Release a minor
126
57
  ```
127
-
128
- Your development app with the gem is ready on `http://localhost:3000`
129
-
130
- ### Run tests
131
-
132
- `test_app` will create a `spec/dummy` app, and will run a local PostGres container.
133
- This command has to be done before executing tests.
134
-
135
- ```sh
136
- bundle && bundle exec rails test_app
58
+ yarn version --new-version minor --no-git-tag-version
59
+ yarn postversion
60
+ git add .
61
+ git tag $(yarn postversion)
137
62
  ```
138
-
139
- Once this command pass, execute:
140
-
141
- ```sh
142
- bundle exec rspec spec
143
- ```
144
-
145
- to run the unit tests.
146
-
147
- ## Contributing
148
-
149
- See [Contributing](CONTRIBUTING.md).
150
-
151
- ## License
152
-
153
- See [License](LICENSE.md).
data/Rakefile CHANGED
@@ -4,7 +4,17 @@ require "decidim/dev/common_rake"
4
4
 
5
5
  def install_module(path)
6
6
  Dir.chdir(path) do
7
- # system("bundle exec rake decidim_voca:install:migrations")
7
+ system("bundle exec rails decidim_voca:install:migrations")
8
+ system("bundle add deepl-rb") unless Gem.loaded_specs.has_key?("deepl-rb")
9
+ system("bundle add activerecord-postgis-adapter") unless Gem.loaded_specs.has_key?("activerecord-postgis-adapter")
10
+ system("bundle add good_job") unless Gem.loaded_specs.has_key?("good_job")
11
+ system("bundle add deface") unless Gem.loaded_specs.has_key?("deface")
12
+ system("bundle add decidim-decidim_awesome #{Decidim::Voca.compat_decidim_awesome_version}") unless Gem.loaded_specs.has_key?("decidim-decidim_awesome")
13
+ unless Gem.loaded_specs.has_key?("decidim-telemetry")
14
+ system("bundle add decidim-telemetry --git https://gitlab.com/octree_gva/decidim/vocacity/decidim-modules/decidim-telemetry --ref #{Decidim::Voca.compat_decidim_telemetry_version}")
15
+ end
16
+ system("bundle exec rails decidim:update")
17
+ system("bundle exec rails decidim_voca:webpacker:install")
8
18
  end
9
19
  end
10
20
 
@@ -16,50 +26,54 @@ end
16
26
 
17
27
  desc "Prepare for testing"
18
28
  task :prepare_tests do
19
- # Remove previous existing db, and recreate one.
20
29
  disable_docker_compose = ENV.fetch("DISABLED_DOCKER_COMPOSE", "false") == "true"
21
30
  unless disable_docker_compose
22
- system("docker-compose -f docker-compose.yml down -v")
23
- system("docker-compose -f docker-compose.yml up -d --remove-orphans")
31
+ system("docker-compose -f docker-compose.yml down -v --remove-orphans")
32
+ system("docker-compose -f docker-compose.yml up -d ")
24
33
  end
25
- ENV["RAILS_ENV"] = "test"
26
- databaseYml = {
27
- "test" => {
28
- "adapter" => "postgresql",
29
- "encoding" => "unicode",
30
- "host" => ENV.fetch("DATABASE_HOST", "localhost"),
31
- "port" => ENV.fetch("DATABASE_PORT", "5432").to_i,
32
- "username" => ENV.fetch("DATABASE_USERNAME", "decidim"),
33
- "password" => ENV.fetch("DATABASE_PASSWORD", "TEST-baeGhi4Ohtahcee5eejoaxaiwaezaiGo"),
34
- "database" => "decidim_test"
35
- }
34
+ ENV["RAILS_ENV"] = "development"
35
+ common_db_config = {
36
+ "adapter" => "postgis",
37
+ "encoding" => "unicode",
38
+ "host" => ENV.fetch("DATABASE_HOST", "voca-pg"),
39
+ "port" => ENV.fetch("DATABASE_PORT", "5432").to_i,
40
+ "username" => ENV.fetch("DATABASE_USERNAME", "decidim"),
41
+ "password" => ENV.fetch("DATABASE_PASSWORD", "pleaseChangeMe"),
42
+ "database" => "#{base_app_name}_test_app"
36
43
  }
37
44
 
38
- config_file = File.expand_path("spec/dummy/config/database.yml", __dir__)
39
- File.open(config_file, "w") { |f| YAML.dump(databaseYml, f) }
40
- Dir.chdir("spec/dummy") do
41
- system("bundle exec rails db:migrate")
42
- end
45
+ database_yml = {
46
+ "test" => common_db_config,
47
+ "development" => common_db_config
48
+ }
49
+
50
+ config_file = File.expand_path("spec/decidim_dummy_app/config/database.yml", __dir__)
51
+ File.open(config_file, "w") { |f| YAML.dump(database_yml, f) }
52
+ Dir.chdir("spec/decidim_dummy_app") do
53
+ system("bundle exec rails db:drop")
54
+ system("bundle exec rails db:create")
55
+ system("bundle exec rails db:migrate")
56
+ end
43
57
  end
44
58
 
45
59
  desc "Generates a dummy app for testing"
46
60
  task :test_app do
47
61
  Bundler.with_original_env do
48
62
  generate_decidim_app(
49
- "spec/dummy",
50
- "--app_name",
51
- "decidim_test",
52
- "--path",
53
- "../..",
54
- "--skip_spring",
55
- "--demo",
56
- "--force_ssl",
57
- "false",
58
- "--locales",
59
- "en,fr,es"
63
+ "spec/decidim_dummy_app",
64
+ "--app_name",
65
+ "#{base_app_name}_test_app",
66
+ "--path",
67
+ "../..",
68
+ "--skip_spring",
69
+ "--demo",
70
+ "--force_ssl",
71
+ "false",
72
+ "--locales",
73
+ "en,fr,es"
60
74
  )
61
75
  end
62
- install_module("spec/dummy")
76
+ install_module("spec/decidim_dummy_app")
63
77
  Rake::Task["prepare_tests"].invoke
64
78
  end
65
79
 
@@ -77,10 +91,3 @@ task :development_app do
77
91
  )
78
92
  end
79
93
  end
80
-
81
- desc "Update protos for voca"
82
- task :update_voca_proto do
83
- %x(rm -rf ./lib/decidim/voca/rpc && mkdir -p ./lib/decidim/voca/rpc)
84
- %x(curl -H 'Cache-Control: no-cache, no-store' -H 'Pragma: no-cache' https://raw.githubusercontent.com/octree-gva/voca-protos/main/clients/decidim-ruby-client.tar.gz | tar -xz -C ./lib/decidim/voca/rpc)
85
- puts "✅ /lib/decidim/voca/rpc udpated"
86
- end
@@ -0,0 +1,8 @@
1
+ <nav role="navigation" aria-label="<%= t("layouts.decidim.footer.help_title") %>">
2
+ <h2 class="h4 mb-4"><%= t("layouts.decidim.footer.help_title") %></h2>
3
+ <ul class="space-y-4 break-inside-avoid">
4
+ <% topics.each do |topic| %>
5
+ <%= topic_item(topic, class: "font-semibold underline") %>
6
+ <% end %>
7
+ </ul>
8
+ </nav>
@@ -0,0 +1,23 @@
1
+ <div class="meeting__calendar-container">
2
+ <div class="meeting__calendar meeting__calendar__lg">
3
+ <div class="meeting__calendar-month">
4
+ <p><%= l(start_time, format: !same_month? ? "%b" : "%B") %></p>
5
+ <p class="meeting__calendar-separator"><%= "-" if !same_month? %></p>
6
+ <p><%= l(end_time, format: "%b") if !same_month? %></p>
7
+ </div>
8
+ <div class="meeting__calendar-day">
9
+ <p><%= l(start_time, format: "%d") %></p>
10
+ <p class="meeting__calendar-separator"><%= "-" if !same_day? || !same_month? %></p>
11
+ <p><%= l(end_time, format: "%d") if !same_day? || !same_month? %></p>
12
+ </div>
13
+ <div class="meeting__calendar-year">
14
+ <p><%= year %></p>
15
+ </div>
16
+ </div>
17
+
18
+ <% if online? %>
19
+ <%= cell("decidim/address", meeting, online: true) %>
20
+ <% else %>
21
+ <%= cell("decidim/address", meeting) %>
22
+ <% end %>
23
+ </div>
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Voca
5
+ module Admin
6
+ module CodeCensus
7
+ class SaveCodeList < Decidim::Command
8
+ def initialize(form, organization, current_user)
9
+ @form = form
10
+ @organization = organization
11
+ @current_user = current_user
12
+ end
13
+
14
+ def call
15
+ return broadcast(:invalid) unless @form.valid?
16
+
17
+ Decidim::Voca::ValidationCode.transaction do
18
+ Decidim::Voca::ValidationCode.where(organization: @organization).delete_all
19
+
20
+ @form.codes.each do |code|
21
+ Decidim::Voca::ValidationCode.create!(
22
+ code:,
23
+ decidim_organization_id: @organization.id
24
+ )
25
+ end
26
+ end
27
+
28
+ broadcast(:ok)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Voca
5
+ module CodeCensus
6
+ class ConfirmCodeAuthorization < ::Decidim::Verifications::ConfirmUserAuthorization
7
+ def call
8
+ return broadcast(:invalid) unless form.valid?
9
+
10
+ authorization.grant!
11
+ broadcast(:ok)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Voca
5
+ class CreateEditorFile < Command
6
+ # Creates a blueprint.
7
+ #
8
+ # form - The form with the data.
9
+ def initialize(form)
10
+ @form = form
11
+ end
12
+
13
+ # Executes the command. Broadcasts these events:
14
+ #
15
+ # - :ok when everything is valid
16
+ # - :invalid if the form wasn't valid and we couldn't proceed.
17
+ #
18
+ # Returns nothing.
19
+ def call
20
+ return broadcast(:invalid) if form.invalid?
21
+
22
+ image = EditorFile.new(
23
+ path: form.path,
24
+ decidim_author_id: form.current_user.id,
25
+ organization: form.organization,
26
+ file: form.file
27
+ )
28
+
29
+ image.save!
30
+ broadcast(:ok, image)
31
+ end
32
+
33
+ attr_reader :form
34
+ end
35
+ end
36
+ end