decidim-core 0.0.1.alpha9 → 0.0.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.
- checksums.yaml +4 -4
- data/Rakefile +0 -25
- data/app/assets/config/decidim_core_manifest.js +1 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.eot +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.svg +345 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.ttf +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.woff +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.woff2 +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.eot +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.svg +339 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.ttf +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.woff +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.woff2 +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.eot +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.svg +342 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.ttf +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.woff +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.woff2 +0 -0
- data/app/assets/images/decidim/default-avatar.svg +14 -0
- data/app/assets/javascripts/decidim.js.es6 +5 -5
- data/app/assets/javascripts/decidim/editor.js.es6 +46 -0
- data/app/assets/stylesheets/decidim/_variables.scss +12 -13
- data/app/assets/stylesheets/decidim/application.sass +4 -1
- data/app/assets/stylesheets/decidim/editor.sass +4 -0
- data/app/assets/stylesheets/decidim/modules/_card-grid.scss +4 -1
- data/app/assets/stylesheets/decidim/modules/_cards.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_process-header.scss +24 -75
- data/app/assets/stylesheets/decidim/modules/_process-nav.scss +0 -1
- data/app/assets/stylesheets/decidim/modules/_process-phase.scss +80 -0
- data/app/assets/stylesheets/decidim/utils/_fontface.scss +39 -1
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +25 -0
- data/app/assets/stylesheets/decidim/utils/_keyframes.scss +21 -0
- data/app/assets/stylesheets/decidim/utils/_mixins.scss +37 -0
- data/app/assets/stylesheets/decidim/utils/_settings.scss +11 -5
- data/app/commands/decidim/authorize_user.rb +2 -2
- data/app/constraints/decidim/current_feature.rb +48 -0
- data/app/controllers/concerns/decidim/form_factory.rb +80 -0
- data/app/controllers/concerns/decidim/locale_switcher.rb +17 -10
- data/app/controllers/concerns/decidim/needs_participatory_process.rb +33 -0
- data/app/controllers/decidim/application_controller.rb +1 -1
- data/app/controllers/decidim/devise/confirmations_controller.rb +1 -1
- data/app/controllers/decidim/devise/passwords_controller.rb +1 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
- data/app/controllers/decidim/devise/sessions_controller.rb +16 -2
- data/app/controllers/decidim/pages_controller.rb +14 -0
- data/app/controllers/decidim/participatory_processes_controller.rb +7 -0
- data/app/forms/decidim/form.rb +15 -0
- data/app/forms/translatable_presence_validator.rb +31 -0
- data/app/helpers/decidim/application_helper.rb +17 -2
- data/app/helpers/decidim/layout_helper.rb +8 -1
- data/app/helpers/decidim/localized_locales_helper.rb +43 -0
- data/app/helpers/decidim/participatory_process_helper.rb +16 -0
- data/app/helpers/decidim/translations_helper.rb +17 -0
- data/app/models/decidim/category.rb +35 -0
- data/app/models/decidim/component.rb +51 -0
- data/app/models/decidim/feature.rb +30 -0
- data/app/models/decidim/organization.rb +20 -1
- data/app/models/decidim/participatory_process.rb +43 -4
- data/app/models/decidim/participatory_process_attachment.rb +56 -0
- data/app/models/decidim/scope.rb +14 -0
- data/app/models/decidim/static_page.rb +56 -0
- data/app/models/decidim/user.rb +2 -0
- data/app/queries/decidim/organization_participatory_processes.rb +17 -0
- data/app/services/decidim/authorization_handler.rb +2 -2
- data/app/types/decidim/process_step_type.rb +24 -0
- data/app/types/decidim/process_type.rb +16 -0
- data/app/types/decidim/user_type.rb +14 -0
- data/app/uploaders/decidim/attachment_uploader.rb +70 -0
- data/app/uploaders/decidim/avatar_uploader.rb +14 -0
- data/app/uploaders/decidim/banner_image_uploader.rb +1 -1
- data/app/uploaders/decidim/hero_image_uploader.rb +1 -1
- data/app/uploaders/decidim/homepage_image_uploader.rb +11 -0
- data/app/uploaders/decidim/image_uploader.rb +46 -0
- data/app/uploaders/decidim/organization_logo_uploader.rb +9 -0
- data/app/views/decidim/devise/registrations/new.html.erb +1 -1
- data/app/views/decidim/participatory_processes/_documents.html.erb +26 -0
- data/app/views/decidim/participatory_processes/_photos.html.erb +16 -0
- data/app/views/decidim/participatory_processes/_promoted_process.html.erb +1 -1
- data/app/views/decidim/participatory_processes/show.html.erb +16 -11
- data/app/views/kaminari/decidim/_first_page.html.erb +11 -0
- data/app/views/kaminari/decidim/_gap.html.erb +8 -0
- data/app/views/kaminari/decidim/_last_page.html.erb +11 -0
- data/app/views/kaminari/decidim/_next_page.html.erb +11 -0
- data/app/views/kaminari/decidim/_page.html.erb +12 -0
- data/app/views/kaminari/decidim/_paginator.html.erb +25 -0
- data/app/views/kaminari/decidim/_prev_page.html.erb +11 -0
- data/app/views/layouts/decidim/_application.html.erb +17 -0
- data/app/views/layouts/decidim/_footer.html.erb +5 -3
- data/app/views/layouts/decidim/_header.html.erb +8 -21
- data/app/views/layouts/decidim/_language_chooser.html.erb +14 -0
- data/app/views/layouts/decidim/_logo.html.erb +17 -13
- data/app/views/layouts/decidim/_process_header.html.erb +34 -0
- data/app/views/layouts/decidim/_process_header_steps.html.erb +26 -0
- data/app/views/layouts/decidim/_user_menu.html.erb +2 -0
- data/app/views/layouts/decidim/application.html.erb +3 -0
- data/app/views/layouts/decidim/participatory_process.html.erb +15 -0
- data/app/views/pages/decidim_page.html.erb +12 -0
- data/app/views/pages/home.html.erb +106 -2
- data/config/i18n-tasks.yml +3 -1
- data/config/locales/ca.yml +40 -10
- data/config/locales/en.yml +39 -4
- data/config/locales/es.yml +44 -14
- data/config/routes.rb +14 -1
- data/db/migrate/20160919104837_create_decidim_organizations.rb +4 -0
- data/db/migrate/20161005153007_add_description_to_organizations.rb +1 -3
- data/db/migrate/20161010102356_translate_processes.rb +4 -4
- data/db/migrate/20161017085822_add_participatory_process_steps.rb +3 -3
- data/db/migrate/20161107152228_remove_not_null_on_step_position.rb +5 -0
- data/db/migrate/20161108093802_create_decidim_static_pages.rb +11 -0
- data/db/migrate/20161110092735_add_index_for_process_slug_organization.rb +8 -0
- data/db/migrate/20161110105712_create_decidim_features.rb +9 -0
- data/db/migrate/20161116115156_create_attachments.rb +18 -0
- data/db/migrate/20161123085134_add_categories.rb +10 -0
- data/db/migrate/20161130105257_create_decidim_scopes.rb +9 -0
- data/db/migrate/20161209134715_make_organization_description_optional.rb +5 -0
- data/db/migrate/20161213094244_add_avatar_to_users.rb +5 -0
- data/db/migrate/20161214152811_add_logo_to_organizations.rb +5 -0
- data/db/seeds.rb +36 -6
- data/db/seeds/Exampledocument.pdf +0 -0
- data/{app/assets/images/decidim/hero-home.jpg → db/seeds/homepage_image.jpg} +0 -0
- data/lib/decidim/core.rb +55 -2
- data/lib/decidim/core/engine.rb +16 -2
- data/lib/decidim/core/version.rb +11 -2
- data/lib/decidim/feature_manifest.rb +71 -0
- data/lib/decidim/features.rb +8 -0
- data/lib/decidim/features/base_controller.rb +32 -0
- data/lib/decidim/features/namer.rb +35 -0
- data/lib/decidim/form_builder.rb +140 -6
- data/lib/decidim/page_finder.rb +48 -0
- data/lib/decidim/query_extensions.rb +33 -0
- data/lib/decidim/translatable_attributes.rb +1 -24
- data/vendor/assets/javascripts/quill.min.js +14 -0
- data/vendor/assets/javascripts/quill.min.js.map +1 -0
- data/vendor/assets/stylesheets/quill.bubble.css +843 -0
- data/vendor/assets/stylesheets/quill.core.css +362 -0
- data/vendor/assets/stylesheets/quill.snow.css +881 -0
- metadata +164 -32
- data/LICENSE.txt +0 -619
- data/app/views/decidim/participatory_processes/_process_header_home.html.erb +0 -18
- data/app/views/pages/terms.ca.html.erb +0 -4
- data/app/views/pages/terms.en.html.erb +0 -4
- data/app/views/pages/terms.es.html.erb +0 -4
data/config/locales/es.yml
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
---
|
|
2
1
|
es:
|
|
3
2
|
activerecord:
|
|
4
3
|
attributes:
|
|
@@ -14,16 +13,19 @@ es:
|
|
|
14
13
|
decidim/user: Usuario
|
|
15
14
|
booleans:
|
|
16
15
|
'false': 'No'
|
|
17
|
-
'true': Sí
|
|
16
|
+
'true': 'Sí'
|
|
17
|
+
carrierwave:
|
|
18
|
+
errors:
|
|
19
|
+
image_too_big: La imagen es demasiado grande
|
|
18
20
|
decidim:
|
|
19
21
|
account:
|
|
20
22
|
authorizations:
|
|
21
|
-
authorization_confirm_destroy:
|
|
23
|
+
authorization_confirm_destroy: '¿Seguro que quieres eliminar esta autorización?'
|
|
22
24
|
show:
|
|
23
25
|
authorizations: Autorizaciones
|
|
24
26
|
title: Mi cuenta
|
|
25
27
|
authorization_handlers:
|
|
26
|
-
decidim/dummy_authorization_handler:
|
|
28
|
+
decidim/dummy_authorization_handler: Autorización de ejemplo
|
|
27
29
|
authorizations:
|
|
28
30
|
create:
|
|
29
31
|
error: Se ha producido un error al crear la autorización.
|
|
@@ -35,7 +37,7 @@ es:
|
|
|
35
37
|
actions:
|
|
36
38
|
decidim/dummy_authorization_handler: Verificarme con el ejemplo
|
|
37
39
|
title: Verifica tu identidad
|
|
38
|
-
verify_with_these_options: '
|
|
40
|
+
verify_with_these_options: 'Éstas son las opciones disponibles para verificar tu identidad:'
|
|
39
41
|
new:
|
|
40
42
|
authorize: Enviar
|
|
41
43
|
authorize_with: Verificarme con %{authorizer}
|
|
@@ -46,7 +48,7 @@ es:
|
|
|
46
48
|
devise:
|
|
47
49
|
registrations:
|
|
48
50
|
new:
|
|
49
|
-
already_have_an_account?:
|
|
51
|
+
already_have_an_account?: '¿Ya tienes una cuenta?'
|
|
50
52
|
sign_in: Entra
|
|
51
53
|
sign_up: Regístrate
|
|
52
54
|
subtitle: Crea una cuenta para poder participar en los debates y apoyar las propuestas.
|
|
@@ -55,11 +57,16 @@ es:
|
|
|
55
57
|
username_help: Nombre público que aparecerá en tus publicaciones. Con el objetivo de garantizar el anonimato puede ser cualquier nombre.
|
|
56
58
|
sessions:
|
|
57
59
|
new:
|
|
58
|
-
are_you_new?:
|
|
60
|
+
are_you_new?: '¿Eres nuevo en la plataforma?'
|
|
59
61
|
register: Créate una cuenta
|
|
60
62
|
menu:
|
|
61
63
|
home: Inicio
|
|
62
64
|
processes: Procesos
|
|
65
|
+
participatory_processes:
|
|
66
|
+
documents:
|
|
67
|
+
related_documents: Documentos relacionados
|
|
68
|
+
photos:
|
|
69
|
+
related_photos: Fotos relacionadas
|
|
63
70
|
devise:
|
|
64
71
|
mailer:
|
|
65
72
|
invitation_instructions:
|
|
@@ -73,21 +80,23 @@ es:
|
|
|
73
80
|
organization_admin_invitation_instructions:
|
|
74
81
|
subject: Te han invitado a administrar %{organization}
|
|
75
82
|
password_change:
|
|
76
|
-
greeting:
|
|
83
|
+
greeting: '¡Hola %{recipient}!'
|
|
77
84
|
message: Nos ponemos en contacto contigo para notificarte que tu contraseña ha sido cambiada correctamente.
|
|
78
85
|
subject: Contraseña cambiada
|
|
86
|
+
errors:
|
|
87
|
+
messages:
|
|
88
|
+
file_size_is_less_than_or_equal_to: el tamaño del archivo debe ser menor que o igual a %{count}
|
|
89
|
+
invalid_manifest: Manifiesto inválido
|
|
90
|
+
invalid_participatory_process: Proceso participativo inválido
|
|
91
|
+
nesting_too_deep: no puede estar dentro de una subcategoría
|
|
79
92
|
layouts:
|
|
80
93
|
decidim:
|
|
81
94
|
footer:
|
|
82
|
-
|
|
83
|
-
accessibility: Accesibilidad
|
|
84
|
-
made_with_open_source: Esta web está hecha con <a target="_blank" href="https://github.com/AjuntamentdeBarcelona/decidim">software libre</a>.
|
|
85
|
-
terms_of_use: Términos y condiciones
|
|
95
|
+
made_with_open_source: 'Esta web está hecha con <a target="_blank" href="https://github.com/AjuntamentdeBarcelona/decidim">software libre</a>.'
|
|
86
96
|
header:
|
|
87
97
|
close_menu: Cerrar menú
|
|
88
98
|
navigation: Navegación
|
|
89
99
|
sign_in: Entra
|
|
90
|
-
sign_out: Sale
|
|
91
100
|
sign_up: Regístrate
|
|
92
101
|
participatory_processes:
|
|
93
102
|
index:
|
|
@@ -105,6 +114,9 @@ es:
|
|
|
105
114
|
active_step: 'Fase actual:'
|
|
106
115
|
more_info: Más información
|
|
107
116
|
take_part: Participa
|
|
117
|
+
user_menu:
|
|
118
|
+
profile: Mi cuenta
|
|
119
|
+
sign_out: Sal
|
|
108
120
|
locales:
|
|
109
121
|
ca: Català
|
|
110
122
|
en: English
|
|
@@ -113,10 +125,28 @@ es:
|
|
|
113
125
|
'404':
|
|
114
126
|
back_home: Volver al inicio
|
|
115
127
|
content_doesnt_exist: Esta dirección es incorrecta o ha sido eliminada.
|
|
116
|
-
title:
|
|
128
|
+
title: '¡No se ha encontrado la página que buscas!'
|
|
117
129
|
'500':
|
|
118
130
|
title: Ha habido un problema con nuestro servidor
|
|
119
131
|
try_later: Por favor, vuelve a intentarlo más tarde.
|
|
120
132
|
home:
|
|
133
|
+
active_step: Fase activa
|
|
134
|
+
debates: Debates
|
|
135
|
+
debates_explanation: Vamos a conocer, debatir y compartir lo que pensamos que es importante para nuestra ciudad.
|
|
136
|
+
highlighted_processes: Procesos resaltados
|
|
137
|
+
how_to_participate: '¿Cómo tomo parte en un proceso?'
|
|
138
|
+
meetings: Lista de encuentros
|
|
139
|
+
meetings_explanation: Vamos a conocer, debatir y compartir lo que pensamos que es importante para nuestra ciudad.
|
|
140
|
+
more_info: Más información
|
|
141
|
+
proposals: Propuestas
|
|
142
|
+
proposals_explanation: Espacio abierto de propuestas de los ciudadanos sobre en qué tipo de ciudad queremos vivir.
|
|
121
143
|
register: Regístrate
|
|
144
|
+
see_all_processes: Ver todos los procesos
|
|
122
145
|
welcome: Bienvenido/da %{organization}!
|
|
146
|
+
views:
|
|
147
|
+
pagination:
|
|
148
|
+
first: "« Primera"
|
|
149
|
+
last: Última »
|
|
150
|
+
next: Siguiente ›
|
|
151
|
+
previous: "‹ Anterior"
|
|
152
|
+
truncate: "…"
|
data/config/routes.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
3
2
|
Decidim::Core::Engine.routes.draw do
|
|
3
|
+
mount Decidim::Api::Engine => "/api"
|
|
4
|
+
|
|
4
5
|
devise_for :users,
|
|
5
6
|
class_name: "Decidim::User",
|
|
6
7
|
module: :devise,
|
|
@@ -16,6 +17,18 @@ Decidim::Core::Engine.routes.draw do
|
|
|
16
17
|
resource :locale, only: [:create]
|
|
17
18
|
resources :participatory_processes, only: [:index, :show]
|
|
18
19
|
|
|
20
|
+
scope "/participatory_processes/:participatory_process_id/features/:feature_id" do
|
|
21
|
+
Decidim.feature_manifests.each do |manifest|
|
|
22
|
+
next unless manifest.engine
|
|
23
|
+
|
|
24
|
+
constraints Decidim::CurrentFeature.new(manifest) do
|
|
25
|
+
mount manifest.engine, at: "/", as: "decidim_#{manifest.name}"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
get "/" => proc { raise "Feature not found" }, as: :feature
|
|
30
|
+
end
|
|
31
|
+
|
|
19
32
|
authenticate(:user) do
|
|
20
33
|
resources :authorizations, only: [:new, :create, :destroy, :index]
|
|
21
34
|
resource :account, only: [:show], controller: "account"
|
|
@@ -3,6 +3,10 @@ class CreateDecidimOrganizations < ActiveRecord::Migration[5.0]
|
|
|
3
3
|
create_table :decidim_organizations do |t|
|
|
4
4
|
t.string :name, null: false
|
|
5
5
|
t.string :host, null: false
|
|
6
|
+
t.string :default_locale, null: false
|
|
7
|
+
t.string :available_locales, array: true, default: []
|
|
8
|
+
t.jsonb :welcome_text, null: false
|
|
9
|
+
t.string :homepage_image
|
|
6
10
|
|
|
7
11
|
t.timestamps
|
|
8
12
|
end
|
|
@@ -6,10 +6,10 @@ class TranslateProcesses < ActiveRecord::Migration[5.0]
|
|
|
6
6
|
remove_column :decidim_participatory_processes, :short_description
|
|
7
7
|
|
|
8
8
|
change_table :decidim_participatory_processes do |t|
|
|
9
|
-
t.
|
|
10
|
-
t.
|
|
11
|
-
t.
|
|
12
|
-
t.
|
|
9
|
+
t.jsonb :title, null: false
|
|
10
|
+
t.jsonb :subtitle, null: false
|
|
11
|
+
t.jsonb :short_description, null: false
|
|
12
|
+
t.jsonb :description, null: false
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
class AddParticipatoryProcessSteps < ActiveRecord::Migration[5.0]
|
|
2
2
|
def change
|
|
3
3
|
create_table :decidim_participatory_process_steps do |t|
|
|
4
|
-
t.
|
|
5
|
-
t.
|
|
6
|
-
t.
|
|
4
|
+
t.jsonb :title, null: false
|
|
5
|
+
t.jsonb :short_description, null: false
|
|
6
|
+
t.jsonb :description, null: false
|
|
7
7
|
t.datetime :start_date
|
|
8
8
|
t.datetime :end_date
|
|
9
9
|
t.references :decidim_participatory_process,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
class CreateDecidimStaticPages < ActiveRecord::Migration[5.0]
|
|
2
|
+
def change
|
|
3
|
+
create_table :decidim_static_pages do |t|
|
|
4
|
+
t.jsonb :title, null: false
|
|
5
|
+
t.string :slug, null: false
|
|
6
|
+
t.jsonb :content, null: false
|
|
7
|
+
t.references :decidim_organization, foreign_key: true, index: true
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class CreateAttachments < ActiveRecord::Migration[5.0]
|
|
2
|
+
def change
|
|
3
|
+
create_table :attachments do |t|
|
|
4
|
+
end
|
|
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
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class AddCategories < ActiveRecord::Migration[5.0]
|
|
2
|
+
def change
|
|
3
|
+
create_table :decidim_categories do |t|
|
|
4
|
+
t.jsonb :name, null: false
|
|
5
|
+
t.jsonb :description, null: false
|
|
6
|
+
t.integer :parent_id, index: true
|
|
7
|
+
t.integer :decidim_participatory_process_id, index: true
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
data/db/seeds.rb
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
if !Rails.env.production? || ENV["SEED"]
|
|
2
3
|
require "decidim/faker/localized"
|
|
3
4
|
|
|
4
|
-
puts "Creating Decidim::Core seeds..."
|
|
5
|
-
|
|
6
5
|
staging_organization = Decidim::Organization.create!(
|
|
7
6
|
name: Faker::Company.name,
|
|
8
|
-
host: ENV["DECIDIM_HOST"] || "localhost"
|
|
7
|
+
host: ENV["DECIDIM_HOST"] || "localhost",
|
|
8
|
+
welcome_text: Decidim::Faker::Localized.sentence(5),
|
|
9
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
|
10
|
+
Decidim::Faker::Localized.sentence(15)
|
|
11
|
+
end,
|
|
12
|
+
homepage_image: File.new(File.join(File.dirname(__FILE__), "seeds", "homepage_image.jpg")),
|
|
13
|
+
default_locale: I18n.default_locale,
|
|
14
|
+
available_locales: Decidim.available_locales
|
|
9
15
|
)
|
|
10
16
|
|
|
11
17
|
Decidim::User.create!(
|
|
@@ -33,7 +39,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
|
33
39
|
|
|
34
40
|
participatory_process1 = Decidim::ParticipatoryProcess.create!(
|
|
35
41
|
title: Decidim::Faker::Localized.sentence(5),
|
|
36
|
-
slug: Faker::Internet.slug(nil,
|
|
42
|
+
slug: Faker::Internet.slug(nil, "-"),
|
|
37
43
|
subtitle: Decidim::Faker::Localized.sentence(2),
|
|
38
44
|
hashtag: "##{Faker::Lorem.word}",
|
|
39
45
|
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
|
@@ -51,7 +57,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
|
51
57
|
|
|
52
58
|
Decidim::ParticipatoryProcess.create!(
|
|
53
59
|
title: Decidim::Faker::Localized.sentence(5),
|
|
54
|
-
slug: Faker::Internet.slug(nil,
|
|
60
|
+
slug: Faker::Internet.slug(nil, "-"),
|
|
55
61
|
subtitle: Decidim::Faker::Localized.sentence(2),
|
|
56
62
|
hashtag: "##{Faker::Lorem.word}",
|
|
57
63
|
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
|
@@ -68,7 +74,7 @@ if !Rails.env.production? || ENV["SEED"]
|
|
|
68
74
|
|
|
69
75
|
Decidim::ParticipatoryProcess.create!(
|
|
70
76
|
title: Decidim::Faker::Localized.sentence(5),
|
|
71
|
-
slug: Faker::Internet.slug(nil,
|
|
77
|
+
slug: Faker::Internet.slug(nil, "-"),
|
|
72
78
|
subtitle: Decidim::Faker::Localized.sentence(2),
|
|
73
79
|
hashtag: "##{Faker::Lorem.word}",
|
|
74
80
|
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
|
@@ -108,4 +114,28 @@ if !Rails.env.production? || ENV["SEED"]
|
|
|
108
114
|
end_date: 3.months.from_now.at_midnight,
|
|
109
115
|
participatory_process: participatory_process1
|
|
110
116
|
)
|
|
117
|
+
|
|
118
|
+
Decidim::ParticipatoryProcess.find_each do |process|
|
|
119
|
+
Decidim::ParticipatoryProcessAttachment.create!(
|
|
120
|
+
title: Decidim::Faker::Localized.sentence(2),
|
|
121
|
+
description: Decidim::Faker::Localized.sentence(5),
|
|
122
|
+
file: File.new(File.join(File.dirname(__FILE__), "seeds", "city.jpeg")),
|
|
123
|
+
participatory_process: process
|
|
124
|
+
)
|
|
125
|
+
Decidim::ParticipatoryProcessAttachment.create!(
|
|
126
|
+
title: Decidim::Faker::Localized.sentence(2),
|
|
127
|
+
description: Decidim::Faker::Localized.sentence(5),
|
|
128
|
+
file: File.new(File.join(File.dirname(__FILE__), "seeds", "Exampledocument.pdf")),
|
|
129
|
+
participatory_process: process
|
|
130
|
+
)
|
|
131
|
+
2.times do
|
|
132
|
+
Decidim::Category.create!(
|
|
133
|
+
name: Decidim::Faker::Localized.sentence(5),
|
|
134
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
|
135
|
+
Decidim::Faker::Localized.paragraph(3)
|
|
136
|
+
end,
|
|
137
|
+
participatory_process: process
|
|
138
|
+
)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
111
141
|
end
|
|
Binary file
|
|
File without changes
|
data/lib/decidim/core.rb
CHANGED
|
@@ -8,13 +8,26 @@ module Decidim
|
|
|
8
8
|
autoload :FormBuilder, "decidim/form_builder"
|
|
9
9
|
autoload :AuthorizationFormBuilder, "decidim/authorization_form_builder"
|
|
10
10
|
autoload :DeviseFailureApp, "decidim/devise_failure_app"
|
|
11
|
+
autoload :FeatureManifest, "decidim/feature_manifest"
|
|
12
|
+
autoload :Features, "decidim/features"
|
|
13
|
+
|
|
11
14
|
include ActiveSupport::Configurable
|
|
12
15
|
|
|
13
16
|
# Loads seeds from all engines.
|
|
14
17
|
def self.seed!
|
|
15
|
-
Rails.application.railties.select do |railtie|
|
|
18
|
+
railties = Rails.application.railties.to_a.uniq.select do |railtie|
|
|
16
19
|
railtie.respond_to?(:load_seed) && railtie.class.name.include?("Decidim::")
|
|
17
|
-
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
railties.each do |railtie|
|
|
23
|
+
puts "Creating #{railtie.class.name} seeds..."
|
|
24
|
+
railtie.load_seed
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Decidim.feature_manifests.each do |feature|
|
|
28
|
+
puts "Creating Feature (#{feature.name}) seeds..."
|
|
29
|
+
feature.seed!
|
|
30
|
+
end
|
|
18
31
|
end
|
|
19
32
|
|
|
20
33
|
# Exposes a configuration option: The application name String.
|
|
@@ -35,4 +48,44 @@ module Decidim
|
|
|
35
48
|
config_accessor :authorization_handlers do
|
|
36
49
|
[]
|
|
37
50
|
end
|
|
51
|
+
|
|
52
|
+
# Exposes a configuration option: The application name String.
|
|
53
|
+
config_accessor :available_locales do
|
|
54
|
+
%w(en ca es)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Public: Registers a feature, usually held in an external library or in a
|
|
58
|
+
# separate folder in the main repository. Exposes a DSL defined by
|
|
59
|
+
# `Decidim::FeatureManifest`.
|
|
60
|
+
#
|
|
61
|
+
# Feature manifests are held in a global registry and are used in all kinds of
|
|
62
|
+
# places to figure out what new components or functionalities the feature provides.
|
|
63
|
+
#
|
|
64
|
+
# name - A Symbol with the feature's unique name.
|
|
65
|
+
#
|
|
66
|
+
# Returns nothing.
|
|
67
|
+
def self.register_feature(name)
|
|
68
|
+
manifest = FeatureManifest.new(name: name.to_sym)
|
|
69
|
+
yield(manifest)
|
|
70
|
+
manifest.validate!
|
|
71
|
+
feature_manifests << manifest
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Public: Finds all the registered feature manifest's via the
|
|
75
|
+
# `register_feature` method.
|
|
76
|
+
#
|
|
77
|
+
# Returns an Array[FeatureManifest].
|
|
78
|
+
def self.feature_manifests
|
|
79
|
+
@feature_manifests ||= Set.new
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Public: Finds a feature manifest by the feature's name.
|
|
83
|
+
#
|
|
84
|
+
# name - The name of the FeatureManifest to find.
|
|
85
|
+
#
|
|
86
|
+
# Returns a FeatureManifest if found, nil otherwise.
|
|
87
|
+
def self.find_feature_manifest(name)
|
|
88
|
+
name = name.to_sym
|
|
89
|
+
feature_manifests.find { |manifest| manifest.name == name }
|
|
90
|
+
end
|
|
38
91
|
end
|