decidim-core 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim.js.es6 +2 -4
- data/app/assets/javascripts/decidim/append_elements.js.es6 +1 -1
- data/app/assets/javascripts/decidim/editor.js.es6 +33 -35
- data/app/assets/javascripts/decidim/filters.js.es6 +9 -15
- data/app/assets/javascripts/decidim/form_filter.component.js.es6 +5 -5
- data/app/assets/javascripts/decidim/form_filter.component.test.js +1 -1
- data/app/assets/javascripts/decidim/foundation.js.es6 +17 -0
- data/app/assets/javascripts/decidim/user_registrations.js.es6 +2 -3
- data/app/assets/stylesheets/decidim/_decidim.scss +9 -0
- data/app/assets/stylesheets/decidim/_variables.scss +5 -11
- data/app/assets/stylesheets/decidim/application.scss.erb +6 -0
- data/app/assets/stylesheets/decidim/extras/_leaflet.scss +13 -0
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +8 -2
- data/app/assets/stylesheets/decidim/modules/_cards.scss +0 -2
- data/app/assets/stylesheets/decidim/modules/_comments.scss +33 -8
- data/app/assets/stylesheets/decidim/modules/{_defintion-data.scss → _definition-data.scss} +0 -0
- data/app/assets/stylesheets/decidim/modules/_filter-tags.scss +24 -0
- data/app/assets/stylesheets/decidim/modules/_layout.scss +1 -9
- data/app/assets/stylesheets/decidim/modules/_list-docs.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_margins.scss +15 -0
- data/app/assets/stylesheets/decidim/modules/_modules.scss +56 -0
- data/app/assets/stylesheets/decidim/modules/_opinion-toggle.scss +25 -5
- data/app/assets/stylesheets/decidim/modules/_order-by.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_process-header.scss +2 -1
- data/app/assets/stylesheets/decidim/modules/_process-phase.scss +0 -4
- data/app/assets/stylesheets/decidim/modules/_status-labels.scss +7 -1
- data/app/assets/stylesheets/decidim/modules/_typography.scss +17 -0
- data/app/assets/stylesheets/decidim/utils/_fontface.scss +3 -3
- data/app/assets/stylesheets/decidim/utils/_settings.scss +10 -7
- data/app/commands/decidim/invite_user.rb +2 -2
- data/app/commands/decidim/update_account.rb +48 -0
- data/app/controllers/concerns/decidim/form_factory.rb +1 -1
- data/app/controllers/concerns/decidim/needs_authorization.rb +12 -1
- data/app/controllers/concerns/decidim/user_profile.rb +30 -0
- data/app/controllers/decidim/account_controller.rb +28 -10
- data/app/controllers/decidim/authorizations_controller.rb +21 -8
- data/app/controllers/decidim/devise/invitations_controller.rb +2 -0
- data/app/controllers/decidim/devise/sessions_controller.rb +1 -1
- data/app/controllers/decidim/own_user_groups_controller.rb +14 -0
- data/app/controllers/decidim/participatory_processes_controller.rb +1 -1
- data/app/forms/decidim/account_form.rb +41 -0
- data/app/helpers/decidim/aria_selected_link_to_helper.rb +26 -0
- data/app/helpers/decidim/attachments_helper.rb +15 -0
- data/app/helpers/decidim/filters_helper.rb +2 -3
- data/app/helpers/decidim/layout_helper.rb +29 -6
- data/app/helpers/decidim/resource_helper.rb +64 -0
- data/app/helpers/decidim/user_profile_helper.rb +23 -0
- data/app/mailers/decidim/decidim_devise_mailer.rb +1 -0
- data/app/models/decidim/abilities/everyone.rb +5 -1
- data/app/models/decidim/ability.rb +3 -4
- data/app/models/decidim/{participatory_process_attachment.rb → attachment.rb} +5 -5
- data/app/models/decidim/feature.rb +2 -0
- data/app/models/decidim/organization.rb +1 -0
- data/app/models/decidim/participatory_process.rb +2 -5
- data/app/models/decidim/resource_link.rb +28 -0
- data/app/models/decidim/user.rb +6 -0
- data/app/models/decidim/user_group.rb +10 -1
- data/app/services/decidim/resource_search.rb +1 -4
- data/app/types/decidim/session_type.rb +16 -0
- data/app/types/decidim/user_group_type.rb +20 -0
- data/app/types/decidim/user_type.rb +5 -1
- data/app/uploaders/decidim/attachment_uploader.rb +4 -1
- data/app/uploaders/decidim/avatar_uploader.rb +8 -0
- data/app/uploaders/decidim/banner_image_uploader.rb +1 -0
- data/app/uploaders/decidim/hero_image_uploader.rb +1 -0
- data/app/uploaders/decidim/homepage_image_uploader.rb +5 -1
- data/app/uploaders/decidim/image_uploader.rb +1 -1
- data/app/uploaders/decidim/organization_favicon_uploader.rb +17 -0
- data/app/uploaders/decidim/organization_logo_uploader.rb +2 -2
- data/app/validators/feature_validator.rb +23 -0
- data/app/views/decidim/account/_password_fields.html.erb +2 -0
- data/app/views/decidim/account/_user_groups.html.erb +0 -0
- data/app/views/decidim/account/show.html.erb +24 -29
- data/app/views/decidim/application/_attachments.html.erb +8 -0
- data/app/views/decidim/{participatory_processes → application}/_documents.html.erb +0 -0
- data/app/views/decidim/{participatory_processes → application}/_photos.html.erb +0 -0
- data/app/views/decidim/authorizations/first_login.html.erb +22 -0
- data/app/views/decidim/authorizations/index.html.erb +46 -19
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +1 -1
- data/app/views/decidim/devise/registrations/new.html.erb +1 -1
- data/app/views/decidim/own_user_groups/index.html.erb +24 -0
- data/app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb +1 -1
- data/app/views/decidim/participatory_process_steps/index.html.erb +3 -1
- data/app/views/decidim/participatory_processes/_participatory_process.html.erb +2 -2
- data/app/views/decidim/participatory_processes/_promoted_process.html.erb +1 -1
- data/app/views/decidim/participatory_processes/index.html.erb +2 -0
- data/app/views/decidim/participatory_processes/show.html.erb +37 -8
- data/app/views/decidim/shared/_comments.html.erb +0 -0
- data/app/views/layouts/decidim/_application.html.erb +5 -3
- data/app/views/layouts/decidim/_header.html.erb +4 -4
- data/app/views/layouts/decidim/_logo.html.erb +29 -17
- data/app/views/layouts/decidim/_process_header.html.erb +15 -3
- data/app/views/layouts/decidim/_process_header_steps.html.erb +1 -1
- data/app/views/layouts/decidim/_user_menu.html.erb +3 -0
- data/app/views/layouts/decidim/mailer.html.erb +1 -1
- data/app/views/layouts/decidim/user_profile.html.erb +35 -0
- data/app/views/pages/home.html.erb +5 -139
- data/app/views/pages/home/_extended.html.erb +48 -0
- data/app/views/pages/home/_hero.html.erb +20 -0
- data/app/views/pages/home/_highlighted_processes.html.erb +37 -0
- data/app/views/pages/home/_statistics.html.erb +22 -0
- data/app/views/pages/home/_sub_hero.html.erb +11 -0
- data/config/i18n-tasks.yml +1 -0
- data/config/initializers/foundation_rails_helper.rb +2 -0
- data/config/locales/ca.yml +69 -33
- data/config/locales/en.yml +86 -29
- data/config/locales/es.yml +68 -32
- data/config/routes.rb +8 -3
- data/db/migrate/20161116115156_create_attachments.rb +0 -2
- data/db/migrate/20170113150627_create_resource_links.rb +10 -0
- data/db/migrate/20170123134023_make_attachments_polymorphic.rb +18 -0
- data/db/migrate/20170123140857_add_avatar_to_user_groups.rb +5 -0
- data/db/migrate/20170125135937_rename_attachable_to_attached_to.rb +11 -0
- data/db/migrate/20170125152026_add_weight_to_features.rb +5 -0
- data/db/migrate/20170126151123_add_extra_info_to_processes.rb +8 -0
- data/db/migrate/20170128140553_add_timestamps_to_identities.rb +5 -0
- data/db/migrate/20170130132833_add_favicon_to_decidim_organizations.rb +5 -0
- data/db/seeds.rb +38 -6
- data/lib/decidim/authorable.rb +32 -0
- data/lib/decidim/core.rb +37 -0
- data/lib/decidim/core/engine.rb +2 -3
- data/lib/decidim/core/test.rb +6 -0
- data/lib/decidim/core/test/factories.rb +24 -3
- data/lib/decidim/core/test/shared_examples/authorable.rb +31 -0
- data/lib/decidim/core/test/shared_examples/has_attachments.rb +29 -0
- data/lib/decidim/core/test/shared_examples/has_category.rb +10 -0
- data/lib/decidim/core/test/shared_examples/has_feature.rb +20 -0
- data/lib/decidim/core/test/shared_examples/has_scope.rb +10 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/feature_manifest.rb +31 -1
- data/lib/decidim/features/base_controller.rb +10 -0
- data/lib/decidim/features/settings_manifest.rb +1 -0
- data/lib/decidim/has_attachment.rb +32 -0
- data/lib/decidim/has_attachments.rb +32 -0
- data/lib/decidim/has_category.rb +21 -0
- data/lib/decidim/has_feature.rb +20 -0
- data/lib/decidim/has_scope.rb +21 -0
- data/lib/decidim/query_extensions.rb +2 -2
- data/lib/decidim/resource_manifest.rb +80 -0
- data/lib/decidim/resourceable.rb +85 -0
- metadata +67 -40
- data/app/assets/javascripts/decidim/inline_svg.js.es6 +0 -12
- data/app/assets/stylesheets/decidim/application.sass +0 -12
- data/app/assets/stylesheets/decidim/extras/_turbolinks.scss +0 -3
- data/app/assets/stylesheets/decidim/modules/_popularity.scss +0 -74
- data/app/assets/stylesheets/decidim/utils/_variables.scss +0 -22
- data/app/views/decidim/account/_authorizations.html.erb +0 -52
- data/vendor/assets/javascripts/owl.carousel.min.js +0 -47
- data/vendor/assets/javascripts/svg-injector.js +0 -464
data/config/locales/es.yml
CHANGED
@@ -2,6 +2,10 @@ es:
|
|
2
2
|
activemodel:
|
3
3
|
attributes:
|
4
4
|
user:
|
5
|
+
email: Tu correo electrónico
|
6
|
+
name: Tu nombre
|
7
|
+
password: Nueva contraseña
|
8
|
+
password_confirmation: Confirme su nueva contraseña
|
5
9
|
user_group_document_number: Número de documento acreditativo
|
6
10
|
user_group_name: Nombre de la Organización
|
7
11
|
user_group_phone: Teléfono de la organización
|
@@ -12,11 +16,10 @@ es:
|
|
12
16
|
email: Correo electrónico
|
13
17
|
name: Nombre de usuario
|
14
18
|
password: Contraseña
|
15
|
-
password_confirmation: Confirmación de
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
decidim/user: Usuario
|
19
|
+
password_confirmation: Confirmación de contraseña
|
20
|
+
user_group_document_number: Número de documento acreditativo
|
21
|
+
user_group_name: Nombre de la Organización
|
22
|
+
user_group_phone: Teléfono de la organización
|
20
23
|
booleans:
|
21
24
|
'false': 'No'
|
22
25
|
'true': 'Sí'
|
@@ -25,11 +28,19 @@ es:
|
|
25
28
|
image_too_big: La imagen es demasiado grande
|
26
29
|
decidim:
|
27
30
|
account:
|
28
|
-
authorizations:
|
29
|
-
authorization_confirm_destroy: '¿Seguro que quieres eliminar esta autorización?'
|
30
31
|
show:
|
31
|
-
|
32
|
-
|
32
|
+
change_password: Cambia la contraseña
|
33
|
+
update_account: Actualizar cuenta
|
34
|
+
update:
|
35
|
+
error: Se ha producido un error al actualizar su cuenta.
|
36
|
+
success: Su cuenta se ha actualizado correctamente.
|
37
|
+
success_with_email_confirmation: Su cuenta se ha actualizado correctamente. Usted recibirá un correo electrónico para confirmar su nueva dirección de correo electrónico.
|
38
|
+
anonymous_user: Anónimo
|
39
|
+
application:
|
40
|
+
documents:
|
41
|
+
related_documents: Documentos relacionados
|
42
|
+
photos:
|
43
|
+
related_photos: Fotos relacionadas
|
33
44
|
authorization_handlers:
|
34
45
|
decidim/dummy_authorization_handler: Autorización de ejemplo
|
35
46
|
errors:
|
@@ -41,11 +52,13 @@ es:
|
|
41
52
|
current_participatory_processes: echar un vistazo a los procesos actuales
|
42
53
|
destroy:
|
43
54
|
success: Autorización destruida con éxito
|
44
|
-
|
55
|
+
first_login:
|
45
56
|
actions:
|
46
|
-
decidim/dummy_authorization_handler:
|
57
|
+
decidim/dummy_authorization_handler: Verificar ejemplo autorización en contra de la
|
47
58
|
title: Verifica tu identidad
|
48
|
-
verify_with_these_options: '
|
59
|
+
verify_with_these_options: 'Estas son las opciones disponibles para verificar su identidad:'
|
60
|
+
index:
|
61
|
+
authorization_confirm_destroy: '¿Está seguro de que quiere eliminar esta autorización?'
|
49
62
|
new:
|
50
63
|
authorize: Enviar
|
51
64
|
authorize_with: Verificarme con %{authorizer}
|
@@ -61,6 +74,7 @@ es:
|
|
61
74
|
complete_profile: Completar perfil
|
62
75
|
sign_up: Complete su perfil
|
63
76
|
subtitle: Por favor, rellene el siguiente formulario con el fin de completar la inscripción
|
77
|
+
username_help: Nombre público que aparece en tus mensajes. Con el objetivo de garantizar el anonimato, puede ser cualquier nombre.
|
64
78
|
registrations:
|
65
79
|
new:
|
66
80
|
already_have_an_account?: '¿Ya tienes una cuenta?'
|
@@ -84,21 +98,30 @@ es:
|
|
84
98
|
menu:
|
85
99
|
home: Inicio
|
86
100
|
processes: Procesos
|
101
|
+
own_user_groups:
|
102
|
+
index:
|
103
|
+
not_verified: No verificada
|
104
|
+
verified: Verificada
|
87
105
|
participatory_process_steps:
|
88
106
|
index:
|
89
107
|
process_steps: Las fases de proceso
|
90
|
-
|
91
|
-
info: Información
|
108
|
+
title: Fases del proceso participativo
|
92
109
|
participatory_processes:
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
110
|
+
index:
|
111
|
+
title: Procesos participativos
|
112
|
+
show:
|
113
|
+
developer_group: Grupo promotor
|
114
|
+
domain: Dominio
|
115
|
+
end_date: Fecha de finalización
|
116
|
+
scope: Ámbito
|
97
117
|
shared:
|
98
118
|
login_modal:
|
99
119
|
please_sign_in: Por favor, regístrese
|
100
120
|
sign_up: Regístrese
|
101
121
|
devise:
|
122
|
+
invitations:
|
123
|
+
edit:
|
124
|
+
header: Escribe tu contraseña
|
102
125
|
mailer:
|
103
126
|
invitation_instructions:
|
104
127
|
accept: Aceptar invitación
|
@@ -150,11 +173,19 @@ es:
|
|
150
173
|
take_part: Participa
|
151
174
|
process_header:
|
152
175
|
process_menu_item: El proceso
|
176
|
+
unfold: Desplegar
|
153
177
|
process_header_steps:
|
178
|
+
step: Fase %{current} de %{total}
|
154
179
|
view_steps: Ver las fases
|
155
180
|
user_menu:
|
181
|
+
admin_dashboard: Tablero de administración
|
156
182
|
profile: Mi cuenta
|
157
183
|
sign_out: Sal
|
184
|
+
user_profile:
|
185
|
+
account: Cuenta
|
186
|
+
authorizations: Autorizaciones
|
187
|
+
title: Ajustes de usuario
|
188
|
+
user_groups: Organizaciones
|
158
189
|
locales:
|
159
190
|
ca: Català
|
160
191
|
en: English
|
@@ -168,23 +199,28 @@ es:
|
|
168
199
|
title: Ha habido un problema con nuestro servidor
|
169
200
|
try_later: Por favor, vuelve a intentarlo más tarde.
|
170
201
|
home:
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
202
|
+
extended:
|
203
|
+
debates: Debates
|
204
|
+
debates_explanation: Vamos a conocer, debatir y compartir lo que pensamos que es importante para nuestra ciudad.
|
205
|
+
how_to_participate: '¿Cómo tomo parte en un proceso?'
|
206
|
+
meetings: Encuentros
|
207
|
+
meetings_explanation: Vamos a conocer, debatir y compartir lo que pensamos que es importante para nuestra ciudad.
|
208
|
+
more_info: Más información
|
209
|
+
proposals: Propuestas
|
210
|
+
proposals_explanation: Espacio abierto de propuestas de los ciudadanos sobre en qué tipo de ciudad queremos vivir.
|
211
|
+
hero:
|
212
|
+
register: Registro
|
213
|
+
welcome: Bienvenido a %{organization}!
|
214
|
+
highlighted_processes:
|
215
|
+
active_step: Fase activa
|
216
|
+
highlighted_processes: Procesos destacados
|
217
|
+
see_all_processes: Ver todos los procesos
|
218
|
+
statistics:
|
184
219
|
headline: Estado actual de %{organization}
|
185
220
|
processes: Procesos
|
186
221
|
users: Usuarios
|
187
|
-
|
222
|
+
sub_hero:
|
223
|
+
register: Registro
|
188
224
|
views:
|
189
225
|
pagination:
|
190
226
|
first: "« Primera"
|
data/config/routes.rb
CHANGED
@@ -33,12 +33,17 @@ Decidim::Core::Engine.routes.draw do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
get "/"
|
36
|
+
get "/", to: redirect("/404"), as: :feature
|
37
37
|
end
|
38
38
|
|
39
39
|
authenticate(:user) do
|
40
|
-
resources :authorizations, only: [:new, :create, :destroy, :index]
|
41
|
-
|
40
|
+
resources :authorizations, only: [:new, :create, :destroy, :index] do
|
41
|
+
collection do
|
42
|
+
get :first_login
|
43
|
+
end
|
44
|
+
end
|
45
|
+
resource :account, only: [:show, :update], controller: "account"
|
46
|
+
resources :own_user_groups, only: [:index]
|
42
47
|
end
|
43
48
|
|
44
49
|
get "/pages/*id" => "pages#show", as: :page, format: false
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class CreateResourceLinks < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :decidim_resource_links do |t|
|
4
|
+
t.references :from, null: false, polymorphic: true, index: true
|
5
|
+
t.references :to, null: false, polymorphic: true, index: true
|
6
|
+
t.string :name, null: false, index: true
|
7
|
+
t.jsonb :data
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class MakeAttachmentsPolymorphic < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
transaction do
|
4
|
+
remove_index :decidim_participatory_process_attachments, name: "index_decidim_processes_attachments_on_decidim_process_id"
|
5
|
+
rename_table :decidim_participatory_process_attachments, :decidim_attachments
|
6
|
+
|
7
|
+
add_column :decidim_attachments, :attachable_type, :string
|
8
|
+
ActiveRecord::Base.connection
|
9
|
+
.execute("UPDATE decidim_attachments SET attachable_type = 'Decidim::ParticipatoryProcess'")
|
10
|
+
|
11
|
+
rename_column :decidim_attachments, :decidim_participatory_process_id, :attachable_id
|
12
|
+
add_index :decidim_attachments, [:attachable_id, :attachable_type]
|
13
|
+
|
14
|
+
change_column_null(:decidim_attachments, :attachable_id, false)
|
15
|
+
change_column_null(:decidim_attachments, :attachable_type, false)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class RenameAttachableToAttachedTo < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
remove_index :decidim_attachments, name: "index_decidim_attachments_on_attachable_id_and_attachable_type"
|
4
|
+
remove_foreign_key :decidim_attachments, column: :attachable_id
|
5
|
+
|
6
|
+
rename_column :decidim_attachments, :attachable_id, :attached_to_id
|
7
|
+
rename_column :decidim_attachments, :attachable_type, :attached_to_type
|
8
|
+
|
9
|
+
add_index :decidim_attachments, [:attached_to_id, :attached_to_type], name: "index_decidim_attachments_on_attached_to"
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddExtraInfoToProcesses < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
add_column :decidim_participatory_processes, :domain, :jsonb
|
4
|
+
add_column :decidim_participatory_processes, :end_date, :date
|
5
|
+
add_column :decidim_participatory_processes, :developer_group, :string
|
6
|
+
add_column :decidim_participatory_processes, :scope, :jsonb
|
7
|
+
end
|
8
|
+
end
|
data/db/seeds.rb
CHANGED
@@ -45,6 +45,34 @@ if !Rails.env.production? || ENV["SEED"]
|
|
45
45
|
tos_agreement: true
|
46
46
|
)
|
47
47
|
|
48
|
+
3.times do
|
49
|
+
Decidim::User.all.each do |user|
|
50
|
+
user_group = Decidim::UserGroup.create!(
|
51
|
+
name: Faker::Company.name,
|
52
|
+
document_number: Faker::Number.number(10),
|
53
|
+
phone: Faker::PhoneNumber.phone_number,
|
54
|
+
verified_at: Time.current
|
55
|
+
)
|
56
|
+
|
57
|
+
Decidim::UserGroupMembership.create!(
|
58
|
+
user: user,
|
59
|
+
user_group: user_group
|
60
|
+
)
|
61
|
+
|
62
|
+
user_group = Decidim::UserGroup.create!(
|
63
|
+
name: Faker::Company.name,
|
64
|
+
document_number: Faker::Number.number(10),
|
65
|
+
phone: Faker::PhoneNumber.phone_number
|
66
|
+
)
|
67
|
+
|
68
|
+
Decidim::UserGroupMembership.create!(
|
69
|
+
user: user,
|
70
|
+
user_group: user_group
|
71
|
+
)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
|
48
76
|
3.times do
|
49
77
|
Decidim::ParticipatoryProcess.create!(
|
50
78
|
title: Decidim::Faker::Localized.sentence(5),
|
@@ -61,13 +89,17 @@ if !Rails.env.production? || ENV["SEED"]
|
|
61
89
|
banner_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city2.jpeg")),
|
62
90
|
promoted: true,
|
63
91
|
published_at: 2.weeks.ago,
|
64
|
-
organization: organization
|
92
|
+
organization: organization,
|
93
|
+
scope: Decidim::Faker::Localized.word,
|
94
|
+
domain: Decidim::Faker::Localized.word,
|
95
|
+
developer_group: Faker::Company.name,
|
96
|
+
end_date: 2.month.from_now.at_midnight
|
65
97
|
)
|
66
98
|
end
|
67
99
|
|
68
100
|
Decidim::ParticipatoryProcess.find_each do |process|
|
69
101
|
Decidim::ParticipatoryProcessStep.create!(
|
70
|
-
title: Decidim::Faker::Localized.sentence(
|
102
|
+
title: Decidim::Faker::Localized.sentence(1, false, 2),
|
71
103
|
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
72
104
|
Decidim::Faker::Localized.sentence(3)
|
73
105
|
end,
|
@@ -82,17 +114,17 @@ if !Rails.env.production? || ENV["SEED"]
|
|
82
114
|
end
|
83
115
|
|
84
116
|
Decidim::ParticipatoryProcess.find_each do |process|
|
85
|
-
Decidim::
|
117
|
+
Decidim::Attachment.create!(
|
86
118
|
title: Decidim::Faker::Localized.sentence(2),
|
87
119
|
description: Decidim::Faker::Localized.sentence(5),
|
88
120
|
file: File.new(File.join(File.dirname(__FILE__), "seeds", "city.jpeg")),
|
89
|
-
|
121
|
+
attached_to: process
|
90
122
|
)
|
91
|
-
Decidim::
|
123
|
+
Decidim::Attachment.create!(
|
92
124
|
title: Decidim::Faker::Localized.sentence(2),
|
93
125
|
description: Decidim::Faker::Localized.sentence(5),
|
94
126
|
file: File.new(File.join(File.dirname(__FILE__), "seeds", "Exampledocument.pdf")),
|
95
|
-
|
127
|
+
attached_to: process
|
96
128
|
)
|
97
129
|
2.times do
|
98
130
|
Decidim::Category.create!(
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
# This concern contains the logic related to authorship
|
4
|
+
module Authorable
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
belongs_to :author, foreign_key: "decidim_author_id", class_name: Decidim::User
|
9
|
+
belongs_to :user_group, foreign_key: "decidim_user_group_id", class_name: Decidim::UserGroup
|
10
|
+
|
11
|
+
validate :verified_user_group, :user_group_membership
|
12
|
+
validate :author_belongs_to_organization
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def verified_user_group
|
17
|
+
return unless user_group
|
18
|
+
errors.add :user_group, :invalid unless user_group.verified?
|
19
|
+
end
|
20
|
+
|
21
|
+
def user_group_membership
|
22
|
+
return unless user_group
|
23
|
+
errors.add :user_group, :invalid unless user_group.users.include? author
|
24
|
+
end
|
25
|
+
|
26
|
+
def author_belongs_to_organization
|
27
|
+
return if !author || !organization
|
28
|
+
errors.add(:author, :invalid) unless author.organization == organization
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/decidim/core.rb
CHANGED
@@ -10,7 +10,14 @@ module Decidim
|
|
10
10
|
autoload :FilterFormBuilder, "decidim/filter_form_builder"
|
11
11
|
autoload :DeviseFailureApp, "decidim/devise_failure_app"
|
12
12
|
autoload :FeatureManifest, "decidim/feature_manifest"
|
13
|
+
autoload :ResourceManifest, "decidim/resource_manifest"
|
14
|
+
autoload :Resourceable, "decidim/resourceable"
|
15
|
+
autoload :Authorable, "decidim/authorable"
|
13
16
|
autoload :Features, "decidim/features"
|
17
|
+
autoload :HasAttachments, "decidim/has_attachments"
|
18
|
+
autoload :HasFeature, "decidim/has_feature"
|
19
|
+
autoload :HasScope, "decidim/has_scope"
|
20
|
+
autoload :HasCategory, "decidim/has_category"
|
14
21
|
|
15
22
|
include ActiveSupport::Configurable
|
16
23
|
|
@@ -62,6 +69,17 @@ module Decidim
|
|
62
69
|
%w(en ca es)
|
63
70
|
end
|
64
71
|
|
72
|
+
# Exposes a configuration option: an object to configure geocoder
|
73
|
+
config_accessor :geocoder
|
74
|
+
|
75
|
+
# Exposes a configuration option: the currency unit
|
76
|
+
config_accessor :currency_unit { "€" }
|
77
|
+
|
78
|
+
# Exposes a configuration option: The maximum file size of an attachment.
|
79
|
+
config_accessor :maximum_attachment_size do
|
80
|
+
10.megabytes
|
81
|
+
end
|
82
|
+
|
65
83
|
# Public: Registers a feature, usually held in an external library or in a
|
66
84
|
# separate folder in the main repository. Exposes a DSL defined by
|
67
85
|
# `Decidim::FeatureManifest`.
|
@@ -96,4 +114,23 @@ module Decidim
|
|
96
114
|
name = name.to_sym
|
97
115
|
feature_manifests.find { |manifest| manifest.name == name }
|
98
116
|
end
|
117
|
+
|
118
|
+
# Public: Finds a resource manifest by the resource's name.
|
119
|
+
#
|
120
|
+
# resource_name_or_class - The String of the ResourceManifest name or the class of
|
121
|
+
# the ResourceManifest model_class to find.
|
122
|
+
#
|
123
|
+
# Returns a ResourceManifest if found, nil otherwise.
|
124
|
+
def self.find_resource_manifest(resource_name_or_klass)
|
125
|
+
resource_manifests.find do |manifest|
|
126
|
+
manifest.model_class == resource_name_or_klass || manifest.name.to_s == resource_name_or_klass.to_s
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Private: Stores all the resource manifest across all feature manifest.
|
131
|
+
#
|
132
|
+
# Returns an Array[ResourceManifest]
|
133
|
+
def self.resource_manifests
|
134
|
+
@resource_manifests ||= feature_manifests.flat_map(&:resource_manifests)
|
135
|
+
end
|
99
136
|
end
|