decidim-core 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/decidim_core_manifest.js +1 -0
  3. data/app/assets/javascripts/decidim/notifications.js.es6 +33 -0
  4. data/app/assets/stylesheets/decidim/extras/_meeting-registrations.scss +11 -0
  5. data/app/assets/stylesheets/decidim/modules/_extra.scss +4 -0
  6. data/app/assets/stylesheets/decidim/modules/_process-nav.scss +14 -0
  7. data/app/commands/decidim/create_follow.rb +40 -0
  8. data/app/commands/decidim/create_omniauth_registration.rb +0 -2
  9. data/app/commands/decidim/create_registration.rb +1 -3
  10. data/app/commands/decidim/create_report.rb +7 -7
  11. data/app/commands/decidim/delete_follow.rb +37 -0
  12. data/app/commands/decidim/invite_user.rb +1 -3
  13. data/app/commands/decidim/update_notifications_settings.rb +1 -2
  14. data/app/constraints/decidim/current_feature.rb +3 -4
  15. data/app/controllers/concerns/decidim/settings.rb +1 -1
  16. data/app/controllers/decidim/features/base_controller.rb +5 -6
  17. data/app/controllers/decidim/follows_controller.rb +45 -0
  18. data/app/controllers/decidim/notifications_controller.rb +39 -0
  19. data/app/controllers/decidim/pages_controller.rb +2 -2
  20. data/app/controllers/decidim/scopes_controller.rb +2 -0
  21. data/app/controllers/decidim/widgets_controller.rb +3 -3
  22. data/app/forms/decidim/follow_form.rb +20 -0
  23. data/app/forms/decidim/invite_user_form.rb +1 -1
  24. data/app/forms/decidim/notifications_settings_form.rb +2 -4
  25. data/app/helpers/decidim/action_authorization_helper.rb +2 -1
  26. data/app/helpers/decidim/decidim_form_helper.rb +4 -0
  27. data/app/helpers/decidim/feature_path_helper.rb +2 -13
  28. data/app/helpers/decidim/icon_helper.rb +26 -8
  29. data/app/helpers/decidim/paginate_helper.rb +1 -1
  30. data/app/helpers/decidim/scopes_helper.rb +1 -1
  31. data/app/jobs/decidim/email_notification_generator_job.rb +12 -0
  32. data/app/jobs/decidim/export_job.rb +1 -3
  33. data/app/jobs/decidim/notification_generator_for_recipient_job.rb +14 -0
  34. data/app/jobs/decidim/notification_generator_job.rb +12 -0
  35. data/app/mailers/decidim/export_mailer.rb +6 -7
  36. data/app/mailers/decidim/notification_mailer.rb +20 -0
  37. data/app/mailers/decidim/reported_mailer.rb +3 -3
  38. data/app/models/decidim/abilities/admin_ability.rb +0 -1
  39. data/app/models/decidim/abilities/base_ability.rb +8 -0
  40. data/app/models/decidim/abilities/everyone_ability.rb +0 -2
  41. data/app/models/decidim/abilities/participatory_process_admin_ability.rb +1 -1
  42. data/app/models/decidim/abilities/participatory_process_collaborator_ability.rb +1 -1
  43. data/app/models/decidim/category.rb +4 -4
  44. data/app/models/decidim/feature.rb +29 -4
  45. data/app/models/decidim/follow.rb +10 -0
  46. data/app/models/decidim/moderation.rb +1 -1
  47. data/app/models/decidim/notification.rb +12 -0
  48. data/app/models/decidim/scope.rb +8 -8
  49. data/app/models/decidim/user.rb +11 -1
  50. data/app/presenters/decidim/home_stats_presenter.rb +1 -1
  51. data/app/presenters/decidim/resource_locator_presenter.rb +3 -18
  52. data/app/queries/decidim/participatory_processes_with_user_role.rb +1 -1
  53. data/app/services/decidim/email_notification_generator.rb +63 -0
  54. data/app/services/decidim/events_manager.rb +41 -0
  55. data/app/services/decidim/notification_generator.rb +51 -0
  56. data/app/services/decidim/notification_generator_for_recipient.rb +50 -0
  57. data/app/uploaders/decidim/attachment_uploader.rb +1 -1
  58. data/app/views/decidim/authorizations/first_login.html.erb +2 -2
  59. data/app/views/decidim/follows/update_button.js.erb +3 -0
  60. data/app/views/decidim/notification_mailer/event_received.html.erb +9 -0
  61. data/app/views/decidim/notifications/_notification.html.erb +18 -0
  62. data/app/views/decidim/notifications/index.html.erb +32 -0
  63. data/app/views/decidim/notifications_settings/show.html.erb +3 -10
  64. data/app/views/decidim/shared/_follow_button.html.erb +19 -0
  65. data/app/views/layouts/decidim/_head.html.erb +1 -0
  66. data/app/views/layouts/decidim/_head_extra.html.erb +7 -0
  67. data/app/views/layouts/decidim/_user_menu.html.erb +1 -0
  68. data/app/views/layouts/decidim/_wrapper.html.erb +3 -0
  69. data/app/views/layouts/decidim/widget.html.erb +3 -3
  70. data/app/views/pages/home/_hero.html.erb +1 -1
  71. data/app/views/pages/home/_highlighted_processes.html.erb +3 -3
  72. data/config/locales/ca.yml +29 -74
  73. data/config/locales/en.yml +23 -71
  74. data/config/locales/es.yml +31 -78
  75. data/config/locales/eu.yml +61 -65
  76. data/config/locales/fi.yml +91 -51
  77. data/config/locales/fr.yml +40 -83
  78. data/config/locales/it.yml +129 -54
  79. data/config/locales/nl.yml +90 -51
  80. data/config/locales/pl.yml +319 -10
  81. data/config/locales/uk.yml +400 -0
  82. data/config/routes.rb +8 -14
  83. data/db/migrate/20170720120231_make_moderations_polymorphic.rb +29 -0
  84. data/db/migrate/20170726145242_make_categories_polymorphic.rb +27 -0
  85. data/db/migrate/20170807123535_create_decidim_follows.rb +20 -0
  86. data/db/migrate/20170808071019_create_decidim_notifications.rb +13 -0
  87. data/db/migrate/20170906091718_add_extra_to_notifications.rb +7 -0
  88. data/db/migrate/20170912082054_add_emails_on_notifications_flag_to_user.rb +7 -0
  89. data/db/migrate/20170913092351_add_header_snippets_to_organizations.rb +7 -0
  90. data/db/migrate/20170914075721_remove_followable_index_from_follows.rb +7 -0
  91. data/db/migrate/20170914092116_remove_comment_and_replies_notifications_from_users.rb +8 -0
  92. data/db/seeds.rb +2 -108
  93. data/lib/decidim/core.rb +46 -8
  94. data/lib/decidim/core/engine.rb +20 -6
  95. data/lib/decidim/core/test.rb +3 -0
  96. data/lib/decidim/core/test/factories.rb +37 -75
  97. data/lib/decidim/core/test/shared_examples/comments_examples.rb +0 -26
  98. data/lib/decidim/core/test/shared_examples/follows_examples.rb +37 -0
  99. data/lib/decidim/core/test/shared_examples/manage_moderations_examples.rb +1 -1
  100. data/lib/decidim/core/test/shared_examples/process_announcements_examples.rb +1 -1
  101. data/lib/decidim/core/test/shared_examples/reportable.rb +4 -4
  102. data/lib/decidim/core/test/shared_examples/reports_examples.rb +1 -1
  103. data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +41 -0
  104. data/lib/decidim/core/test/shared_examples/user_localised_email_examples.rb +25 -0
  105. data/lib/decidim/core/version.rb +1 -1
  106. data/lib/decidim/engine_router.rb +54 -0
  107. data/lib/decidim/events.rb +9 -0
  108. data/lib/decidim/events/base_event.rb +70 -0
  109. data/lib/decidim/events/email_event.rb +39 -0
  110. data/lib/decidim/events/notification_event.rb +32 -0
  111. data/lib/decidim/exporters.rb +7 -0
  112. data/lib/decidim/exporters/export_data.rb +14 -0
  113. data/lib/decidim/feature_manifest.rb +2 -2
  114. data/lib/decidim/features/namer.rb +1 -1
  115. data/lib/decidim/followable.rb +13 -0
  116. data/lib/decidim/form_builder.rb +1 -1
  117. data/lib/decidim/has_feature.rb +1 -1
  118. data/lib/decidim/has_settings.rb +19 -15
  119. data/lib/decidim/manifest_registry.rb +1 -3
  120. data/lib/decidim/participable.rb +80 -0
  121. data/lib/decidim/participatory_space_manifest.rb +40 -0
  122. data/lib/decidim/query_extensions.rb +1 -1
  123. data/lib/decidim/resource_manifest.rb +1 -1
  124. data/lib/decidim/settings_manifest.rb +0 -4
  125. data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.uk.js +14 -0
  126. data/vendor/assets/javascripts/morphdom.js +14 -5
  127. metadata +70 -79
  128. data/app/assets/images/decidim/process.svg +0 -10
  129. data/app/constraints/decidim/current_participatory_process.rb +0 -35
  130. data/app/controllers/concerns/decidim/needs_participatory_process.rb +0 -46
  131. data/app/controllers/decidim/participatory_process_groups_controller.rb +0 -26
  132. data/app/controllers/decidim/participatory_process_steps_controller.rb +0 -18
  133. data/app/controllers/decidim/participatory_process_widgets_controller.rb +0 -19
  134. data/app/controllers/decidim/participatory_processes_controller.rb +0 -49
  135. data/app/helpers/decidim/participatory_process_helper.rb +0 -17
  136. data/app/helpers/decidim/participatory_process_steps_helper.rb +0 -18
  137. data/app/models/decidim/participatory_process.rb +0 -61
  138. data/app/models/decidim/participatory_process_group.rb +0 -15
  139. data/app/models/decidim/participatory_process_step.rb +0 -39
  140. data/app/presenters/decidim/participatory_process_stats_presenter.rb +0 -50
  141. data/app/queries/decidim/highlighted_participatory_processes.rb +0 -10
  142. data/app/queries/decidim/organization_participatory_process_groups.rb +0 -14
  143. data/app/queries/decidim/organization_participatory_processes.rb +0 -14
  144. data/app/queries/decidim/organization_prioritized_participatory_processes.rb +0 -18
  145. data/app/queries/decidim/organization_published_participatory_processes.rb +0 -17
  146. data/app/queries/decidim/prioritized_participatory_processes.rb +0 -11
  147. data/app/queries/decidim/promoted_participatory_processes.rb +0 -10
  148. data/app/queries/decidim/published_participatory_processes.rb +0 -10
  149. data/app/views/decidim/participatory_process_groups/_participatory_process_group.html.erb +0 -22
  150. data/app/views/decidim/participatory_process_groups/show.html.erb +0 -11
  151. data/app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb +0 -16
  152. data/app/views/decidim/participatory_process_steps/_timeline.html.erb +0 -7
  153. data/app/views/decidim/participatory_process_steps/index.html.erb +0 -14
  154. data/app/views/decidim/participatory_process_widgets/show.html.erb +0 -17
  155. data/app/views/decidim/participatory_processes/_no_processes_yet.html.erb +0 -3
  156. data/app/views/decidim/participatory_processes/_order_by_processes.html.erb +0 -3
  157. data/app/views/decidim/participatory_processes/_participatory_process.html.erb +0 -28
  158. data/app/views/decidim/participatory_processes/_promoted_process.html.erb +0 -32
  159. data/app/views/decidim/participatory_processes/_statistics.html.erb +0 -10
  160. data/app/views/decidim/participatory_processes/index.html.erb +0 -17
  161. data/app/views/decidim/participatory_processes/show.html.erb +0 -85
  162. data/app/views/layouts/decidim/_process_header.html.erb +0 -65
  163. data/app/views/layouts/decidim/_process_header_steps.html.erb +0 -27
  164. data/app/views/layouts/decidim/participatory_process.html.erb +0 -30
  165. data/config/i18n-tasks.yml +0 -138
  166. data/db/migrate/20161005130108_add_participatory_processes.rb +0 -19
  167. data/db/migrate/20161010102356_translate_processes.rb +0 -17
  168. data/db/migrate/20161011125616_add_hero_image_to_processes.rb +0 -7
  169. data/db/migrate/20161011141033_add_banner_image_to_processes.rb +0 -7
  170. data/db/migrate/20161013134732_add_promoted_flag_to_processes.rb +0 -7
  171. data/db/migrate/20161017085822_add_participatory_process_steps.rb +0 -18
  172. data/db/migrate/20161019072016_add_active_flag_to_step.rb +0 -13
  173. data/db/migrate/20161020080756_add_position_to_steps.rb +0 -9
  174. data/db/migrate/20161025125300_add_published_at_to_processes.rb +0 -7
  175. data/db/migrate/20161107152228_remove_not_null_on_step_position.rb +0 -7
  176. data/db/migrate/20161110092735_add_index_for_process_slug_organization.rb +0 -10
  177. data/db/migrate/20161116115156_create_attachments.rb +0 -18
  178. data/db/migrate/20170116135237_loosen_step_requirements.rb +0 -8
  179. data/db/migrate/20170123134023_make_attachments_polymorphic.rb +0 -20
  180. data/db/migrate/20170125135937_rename_attachable_to_attached_to.rb +0 -13
  181. data/db/migrate/20170126151123_add_extra_info_to_processes.rb +0 -10
  182. data/db/migrate/20170206083118_rename_extra_info_on_processes.rb +0 -14
  183. data/db/migrate/20170220110740_remove_steps_short_description.rb +0 -23
  184. data/db/migrate/20170221094835_add_scopes_to_processes.rb +0 -8
  185. data/db/migrate/20170228142440_add_participatory_process_groups.rb +0 -17
  186. data/db/migrate/20170404132616_change_steps_end_and_start_date_to_date.rb +0 -8
  187. data/db/migrate/20170725085104_add_show_statistics_to_participatory_processes.rb +0 -7
  188. data/db/migrate/20170804125402_attachment_description_nullable.rb +0 -7
  189. data/db/migrate/20170808080905_add_announcement_to_participatory_processes.rb +0 -7
  190. data/db/migrate/20170809084005_add_scopes_enabled_to_participatory_processes.rb +0 -7
  191. data/db/seeds/Exampledocument.pdf +0 -0
  192. data/db/seeds/city.jpeg +0 -0
  193. data/db/seeds/city2.jpeg +0 -0
  194. data/lib/decidim/notifiable.rb +0 -22
@@ -1,30 +0,0 @@
1
- <% add_decidim_page_title(translated_attribute(current_feature.name)) if try(:current_feature) %>
2
- <% add_decidim_page_title(translated_attribute(current_participatory_process.title)) %>
3
- <% add_decidim_meta_tags(
4
- image_url: current_participatory_process.banner_image.url,
5
- description: translated_attribute(current_participatory_process.short_description),
6
- ) %>
7
-
8
- <%= render "layouts/decidim/application" do %>
9
- <div class="wrapper">
10
- <%= render partial: "layouts/decidim/process_header" %>
11
- <%= yield %>
12
- </div>
13
- <% if content_for? :expanded %>
14
- <div class="expanded">
15
- <div class="wrapper wrapper--inner">
16
- <div class="row">
17
- <%= yield :expanded %>
18
- </div>
19
- </div>
20
- </div>
21
- <% end %>
22
- <% end %>
23
-
24
- <% if try(:current_feature) %>
25
- <% current_feature.manifest.actions.each do |action| %>
26
- <%= action_authorization_modal(action) %>
27
- <% end %>
28
- <% end %>
29
-
30
- <% provide :meta_image_url, current_participatory_process.banner_image.url %>
@@ -1,138 +0,0 @@
1
- # i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
2
-
3
- # The "main" locale.
4
- base_locale: en
5
-
6
- ## Reporting locale, default: en. Available: en, ru.
7
- # internal_locale: en
8
-
9
- # Read and write translations.
10
- data:
11
- ## Translations are read from the file system. Supported format: YAML, JSON.
12
- ## Provide a custom adapter:
13
- # adapter: I18n::Tasks::Data::FileSystem
14
-
15
- # Locale files or `File.find` patterns where translations are read from:
16
- read:
17
- ## Default:
18
- # - config/locales/%{locale}.yml
19
- ## More files:
20
- # - config/locales/**/*.%{locale}.yml
21
- ## Another gem (replace %#= with %=):
22
- # - "<%#= %x[bundle show vagrant].chomp %>/templates/locales/%{locale}.yml"
23
-
24
- # Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
25
- # `i18n-tasks normalize -p` will force move the keys according to these rules
26
- write:
27
- ## For example, write devise and simple form keys to their respective files:
28
- # - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
29
- ## Catch-all default:
30
- # - config/locales/%{locale}.yml
31
-
32
- ## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class.
33
- # router: convervative_router
34
-
35
- yaml:
36
- write:
37
- # do not wrap lines at 80 characters
38
- line_width: -1
39
-
40
- ## Pretty-print JSON:
41
- # json:
42
- # write:
43
- # indent: ' '
44
- # space: ' '
45
- # object_nl: "\n"
46
- # array_nl: "\n"
47
-
48
- # Find translate calls
49
- search:
50
- ## Paths or `File.find` patterns to search in:
51
- paths:
52
- - app/
53
- - lib/
54
-
55
- ## Root directories for relative keys resolution.
56
- # relative_roots:
57
- # - app/controllers
58
- # - app/helpers
59
- # - app/mailers
60
- # - app/presenters
61
- # - app/views
62
-
63
- ## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
64
- ## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json)
65
- exclude:
66
- - app/assets/images
67
- - app/assets/fonts
68
-
69
- ## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
70
- ## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
71
- # only: ["*.rb", "*.html.slim"]
72
-
73
- ## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
74
- strict: false
75
-
76
- ## Multiple scanners can be used. Their results are merged.
77
- ## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
78
- ## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
79
-
80
- ## Google Translate
81
- # translation:
82
- # # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
83
- # api_key: "AbC-dEf5"
84
-
85
- ## Do not consider these keys missing:
86
- ignore_missing:
87
- - '{devise,simple_form}.*'
88
-
89
- ## Consider these keys used:
90
- ignore_unused:
91
- - '{time.formats}.*'
92
- - devise.mailer.password_change.subject
93
- - activerecord.attributes.decidim/user.*
94
- - activerecord.models.decidim/user
95
- - activemodel.attributes.user.*
96
- - activemodel.attributes.report.*
97
- - booleans.*
98
- - errors.messages.*
99
- - social_share_button.*
100
- - decidim.filters.linked_classes.*
101
- - decidim.forms.errors.*
102
- - decidim.authorizations.first_login.actions.*
103
- - decidim.features.dummy.*
104
- - invisible_captcha.*
105
- - decidim.participatory_processes.scopes.global
106
- - decidim.participatory_processes.participatory_process_groups.none
107
- - pages.home.statistics.*
108
- - decidim.participatory_processes.statistics.*
109
- - forms.*
110
- # - 'activerecord.attributes.*'
111
- # - '{devise,kaminari,will_paginate}.*'
112
- # - 'simple_form.{yes,no}'
113
- # - 'simple_form.{placeholders,hints,labels}.*'
114
- # - 'simple_form.{error_notification,required}.:'
115
-
116
- ## Exclude these keys from the `i18n-tasks eq-base' report:
117
- # ignore_eq_base:
118
- # all:
119
- # - common.ok
120
- # fr,es:
121
- # - common.brand
122
-
123
- ## Ignore these keys completely:
124
- # ignore:
125
- # - kaminari.*
126
-
127
- ## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
128
- ## e.g. in case of a relative key defined in a helper method.
129
- ## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
130
- #
131
- # <%#= I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
132
- # only: %w(*.html.haml *.html.slim),
133
- # patterns: [['= title\b', '.page_title']] %>
134
- #
135
- # The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
136
- #
137
- # <%#= I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
138
- # patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddParticipatoryProcesses < ActiveRecord::Migration[5.0]
4
- def change
5
- create_table :decidim_participatory_processes do |t|
6
- t.string :title, null: false
7
- t.string :slug, null: false, unique: true
8
- t.string :hashtag, unique: true
9
- t.string :subtitle, null: false
10
- t.text :short_description, null: false
11
- t.text :description, null: false
12
- t.references :decidim_organization,
13
- foreign_key: true,
14
- index: { name: "index_decidim_processes_on_decidim_organization_id" }
15
-
16
- t.timestamps
17
- end
18
- end
19
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class TranslateProcesses < ActiveRecord::Migration[5.0]
4
- def change
5
- remove_column :decidim_participatory_processes, :title
6
- remove_column :decidim_participatory_processes, :subtitle
7
- remove_column :decidim_participatory_processes, :description
8
- remove_column :decidim_participatory_processes, :short_description
9
-
10
- change_table :decidim_participatory_processes do |t|
11
- t.jsonb :title, null: false
12
- t.jsonb :subtitle, null: false
13
- t.jsonb :short_description, null: false
14
- t.jsonb :description, null: false
15
- end
16
- end
17
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddHeroImageToProcesses < ActiveRecord::Migration[5.0]
4
- def change
5
- add_column :decidim_participatory_processes, :hero_image, :string
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddBannerImageToProcesses < ActiveRecord::Migration[5.0]
4
- def change
5
- add_column :decidim_participatory_processes, :banner_image, :string
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddPromotedFlagToProcesses < ActiveRecord::Migration[5.0]
4
- def change
5
- add_column :decidim_participatory_processes, :promoted, :boolean, default: false, index: true
6
- end
7
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddParticipatoryProcessSteps < ActiveRecord::Migration[5.0]
4
- def change
5
- create_table :decidim_participatory_process_steps do |t|
6
- t.jsonb :title, null: false
7
- t.jsonb :short_description, null: false
8
- t.jsonb :description, null: false
9
- t.datetime :start_date
10
- t.datetime :end_date
11
- t.references :decidim_participatory_process,
12
- foreign_key: true,
13
- index: { name: "index_decidim_processes_steps__on_decidim_process_id" }
14
-
15
- t.timestamps
16
- end
17
- end
18
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddActiveFlagToStep < ActiveRecord::Migration[5.0]
4
- def change
5
- add_column :decidim_participatory_process_steps, :active, :boolean, default: false
6
-
7
- add_index :decidim_participatory_process_steps,
8
- [:decidim_participatory_process_id, :active],
9
- unique: true,
10
- where: "active = 't'",
11
- name: "unique_index_to_avoid_duplicate_active_steps"
12
- end
13
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddPositionToSteps < ActiveRecord::Migration[5.0]
4
- def change
5
- add_column :decidim_participatory_process_steps, :position, :integer, null: false
6
- add_index :decidim_participatory_process_steps, :position, order: { position: :asc }, name: "index_order_by_position_for_steps"
7
- add_index :decidim_participatory_process_steps, [:decidim_participatory_process_id, :position], unique: true, name: "index_unique_position_for_process"
8
- end
9
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddPublishedAtToProcesses < ActiveRecord::Migration[5.0]
4
- def change
5
- add_column :decidim_participatory_processes, :published_at, :datetime, index: true
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RemoveNotNullOnStepPosition < ActiveRecord::Migration[5.0]
4
- def change
5
- change_column :decidim_participatory_process_steps, :position, :integer, null: true
6
- end
7
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddIndexForProcessSlugOrganization < ActiveRecord::Migration[5.0]
4
- def change
5
- add_index :decidim_participatory_processes,
6
- [:decidim_organization_id, :slug],
7
- unique: true,
8
- name: "index_unique_process_slug_and_organization"
9
- end
10
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreateAttachments < ActiveRecord::Migration[5.0]
4
- def change
5
- create_table :decidim_participatory_process_attachments do |t|
6
- t.jsonb :title, null: false
7
- t.jsonb :description, null: false
8
- t.string :file, null: false
9
- t.string :content_type, null: false
10
- t.string :file_size, null: false
11
- t.references :decidim_participatory_process,
12
- foreign_key: true,
13
- index: { name: "index_decidim_processes_attachments_on_decidim_process_id" }
14
-
15
- t.timestamps
16
- end
17
- end
18
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class LoosenStepRequirements < ActiveRecord::Migration[5.0]
4
- def change
5
- change_column_null(:decidim_participatory_process_steps, :short_description, true)
6
- change_column_null(:decidim_participatory_process_steps, :description, true)
7
- end
8
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class MakeAttachmentsPolymorphic < ActiveRecord::Migration[5.0]
4
- def change
5
- transaction do
6
- remove_index :decidim_participatory_process_attachments, name: "index_decidim_processes_attachments_on_decidim_process_id"
7
- rename_table :decidim_participatory_process_attachments, :decidim_attachments
8
-
9
- add_column :decidim_attachments, :attachable_type, :string
10
- ActiveRecord::Base.connection
11
- .execute("UPDATE decidim_attachments SET attachable_type = 'Decidim::ParticipatoryProcess'")
12
-
13
- rename_column :decidim_attachments, :decidim_participatory_process_id, :attachable_id
14
- add_index :decidim_attachments, [:attachable_id, :attachable_type]
15
-
16
- change_column_null(:decidim_attachments, :attachable_id, false)
17
- change_column_null(:decidim_attachments, :attachable_type, false)
18
- end
19
- end
20
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RenameAttachableToAttachedTo < ActiveRecord::Migration[5.0]
4
- def change
5
- remove_index :decidim_attachments, name: "index_decidim_attachments_on_attachable_id_and_attachable_type"
6
- remove_foreign_key :decidim_attachments, column: :attachable_id
7
-
8
- rename_column :decidim_attachments, :attachable_id, :attached_to_id
9
- rename_column :decidim_attachments, :attachable_type, :attached_to_type
10
-
11
- add_index :decidim_attachments, [:attached_to_id, :attached_to_type], name: "index_decidim_attachments_on_attached_to"
12
- end
13
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddExtraInfoToProcesses < ActiveRecord::Migration[5.0]
4
- def change
5
- add_column :decidim_participatory_processes, :domain, :jsonb
6
- add_column :decidim_participatory_processes, :end_date, :date
7
- add_column :decidim_participatory_processes, :developer_group, :string
8
- add_column :decidim_participatory_processes, :scope, :jsonb
9
- end
10
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RenameExtraInfoOnProcesses < ActiveRecord::Migration[5.0]
4
- def change
5
- remove_column :decidim_participatory_processes, :developer_group
6
-
7
- rename_column :decidim_participatory_processes, :domain, :developer_group
8
-
9
- add_column :decidim_participatory_processes, :local_area, :jsonb
10
- add_column :decidim_participatory_processes, :target, :jsonb
11
- add_column :decidim_participatory_processes, :participatory_scope, :jsonb
12
- add_column :decidim_participatory_processes, :participatory_structure, :jsonb
13
- end
14
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class RemoveStepsShortDescription < ActiveRecord::Migration[5.0]
4
- def change
5
- Decidim::ParticipatoryProcessStep.transaction do
6
- Decidim::ParticipatoryProcessStep.find_each do |step|
7
- step.update_attributes!(
8
- description: new_description_for(step)
9
- )
10
- end
11
-
12
- remove_column :decidim_participatory_process_steps, :short_description
13
- end
14
- end
15
-
16
- def new_description_for(step)
17
- desc = {}
18
- step.description.keys.each do |locale|
19
- desc[locale] = step.short_description[locale] + step.description[locale]
20
- end
21
- desc
22
- end
23
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddScopesToProcesses < ActiveRecord::Migration[5.0]
4
- def change
5
- rename_column :decidim_participatory_processes, :scope, :meta_scope
6
- add_column :decidim_participatory_processes, :decidim_scope_id, :integer
7
- end
8
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class AddParticipatoryProcessGroups < ActiveRecord::Migration[5.0]
4
- def change
5
- create_table :decidim_participatory_process_groups do |t|
6
- t.jsonb :name, null: false
7
- t.jsonb :description, null: false
8
- t.string :hero_image
9
-
10
- t.references :decidim_organization, index: { name: "decidim_participatory_process_group_organization" }
11
-
12
- t.timestamps
13
- end
14
-
15
- add_column :decidim_participatory_processes, :decidim_participatory_process_group_id, :integer
16
- end
17
- end