decidim-assemblies 0.26.2 → 0.27.0.rc2
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/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies/show.erb +2 -2
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb +2 -4
- data/app/commands/decidim/assemblies/admin/copy_assembly.rb +10 -7
- data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +1 -1
- data/app/commands/decidim/assemblies/admin/create_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +12 -12
- data/app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb +1 -1
- data/app/commands/decidim/assemblies/admin/destroy_assembly_admin.rb +1 -1
- data/app/commands/decidim/assemblies/admin/destroy_assembly_member.rb +1 -1
- data/app/commands/decidim/assemblies/admin/import_assembly.rb +11 -7
- data/app/commands/decidim/assemblies/admin/notify_role_assigned_to_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/publish_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/unpublish_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assemblies_setting.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assembly_member.rb +11 -11
- data/app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb +1 -1
- data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +1 -1
- data/app/controllers/decidim/assemblies/admin/reminders_controller.rb +14 -0
- data/app/controllers/decidim/assemblies/assemblies_controller.rb +6 -6
- data/app/events/decidim/role_assigned_to_assembly_event.rb +1 -1
- data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +5 -6
- data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +10 -6
- data/app/models/decidim/assembly.rb +10 -4
- data/app/packs/src/decidim/assemblies/orgchart.js +52 -46
- data/app/permissions/decidim/assemblies/permissions.rb +45 -11
- data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -1
- data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +4 -1
- data/app/presenters/decidim/assembly_member_presenter.rb +3 -5
- data/app/queries/decidim/assemblies/admin/admin_users.rb +1 -1
- data/app/queries/decidim/assemblies/admin/assembly_members.rb +1 -1
- data/app/queries/decidim/assemblies/assemblies_with_user_role.rb +1 -1
- data/app/queries/decidim/assemblies/filtered_assemblies.rb +1 -1
- data/app/queries/decidim/assemblies/organization_assemblies.rb +1 -1
- data/app/queries/decidim/assemblies/organization_prioritized_assemblies.rb +2 -2
- data/app/queries/decidim/assemblies/organization_published_assemblies.rb +2 -2
- data/app/queries/decidim/assemblies/parent_assemblies.rb +1 -1
- data/app/queries/decidim/assemblies/parent_assemblies_for_select.rb +1 -1
- data/app/queries/decidim/assemblies/prioritized_assemblies.rb +1 -1
- data/app/queries/decidim/assemblies/promoted_assemblies.rb +1 -1
- data/app/queries/decidim/assemblies/published_assemblies.rb +1 -1
- data/app/queries/decidim/assemblies/visible_assemblies.rb +1 -1
- data/app/serializers/decidim/assemblies/assembly_importer.rb +4 -3
- data/app/views/decidim/assemblies/_filter_by_type.html.erb +1 -1
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +2 -2
- data/app/views/decidim/assemblies/assemblies/_promoted_assembly.html.erb +1 -1
- data/app/views/decidim/assemblies/assemblies/index.html.erb +3 -1
- data/app/views/decidim/assemblies/assemblies/show.html.erb +3 -1
- data/app/views/layouts/decidim/_assembly_header.html.erb +1 -1
- data/config/locales/ar.yml +1 -1
- data/config/locales/bg.yml +1 -0
- data/config/locales/ca.yml +6 -2
- data/config/locales/cs.yml +6 -2
- data/config/locales/de.yml +6 -2
- data/config/locales/el.yml +1 -7
- data/config/locales/en.yml +5 -2
- data/config/locales/es-MX.yml +6 -2
- data/config/locales/es-PY.yml +6 -2
- data/config/locales/es.yml +6 -2
- data/config/locales/eu.yml +1 -7
- data/config/locales/fi-plain.yml +6 -2
- data/config/locales/fi.yml +6 -2
- data/config/locales/fr-CA.yml +6 -2
- data/config/locales/fr.yml +11 -7
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +2 -7
- data/config/locales/hu.yml +43 -3
- data/config/locales/id-ID.yml +1 -1
- data/config/locales/is-IS.yml +4 -1
- data/config/locales/it.yml +1 -7
- data/config/locales/ja.yml +6 -2
- data/config/locales/lb.yml +1 -6
- data/config/locales/lt.yml +473 -0
- data/config/locales/lv.yml +1 -1
- data/config/locales/nl.yml +27 -18
- data/config/locales/no.yml +1 -7
- data/config/locales/pl.yml +3 -2
- data/config/locales/pt-BR.yml +1 -7
- data/config/locales/pt.yml +1 -7
- data/config/locales/ro-RO.yml +1 -7
- data/config/locales/ru.yml +3 -1
- data/config/locales/sk.yml +3 -0
- data/config/locales/sl.yml +3 -6
- data/config/locales/sr-CS.yml +1 -0
- data/config/locales/sv.yml +2 -7
- data/config/locales/tr-TR.yml +1 -7
- data/config/locales/uk.yml +3 -1
- data/config/locales/zh-CN.yml +1 -7
- data/lib/decidim/assemblies/admin_engine.rb +4 -1
- data/lib/decidim/assemblies/participatory_space.rb +9 -9
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +13 -13
- data/app/services/decidim/assemblies/assembly_search.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31a016c68a9d41b155abf0a0721914f066f31fa0b595bd4ce373060232130704
|
|
4
|
+
data.tar.gz: efbe5019c838b198376dc38bb3ebe17be24f19d99898ca279848e6e22e299822
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5c692fc2fdd10a237a7d9e3c5e2c31f2840d054e4838eb159a5df9566eb1475e6560d27401f00f288696737bd2bd96fbcf490bb901a3a5b3fabd33bc237e2386
|
|
7
|
+
data.tar.gz: 8f3f1d07319b8fa61f60e8c195c3ad0914d392d28836220800e51b2a8d623ce3cf0dd2a81005c6258f42bb0964e103c9341a89b305b58cb86a89e9cc5258e80a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<section class="wrapper-home home-section" xmlns="http://www.w3.org/1999/xhtml">
|
|
1
|
+
<section id="highlighted_assemblies" class="wrapper-home home-section" xmlns="http://www.w3.org/1999/xhtml">
|
|
2
2
|
<div class="row" id="highlighted-assemblies">
|
|
3
3
|
<h3 class="section-heading"><%= t("active_assemblies", scope: i18n_scope) %></h3>
|
|
4
4
|
<div class="row collapse">
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<div class="column">
|
|
9
9
|
<%= link_to decidim_assemblies.assembly_path(assembly), class: "card card--assembly card--mini" do %>
|
|
10
10
|
<div aria-hidden="true" class="card__image-top"
|
|
11
|
-
style="background-image:url(<%= assembly.attached_uploader(:hero_image).path %>)"></div>
|
|
11
|
+
style="background-image:url('<%= assembly.attached_uploader(:hero_image).path %>')"></div>
|
|
12
12
|
<div class="card__content">
|
|
13
13
|
<span class="card__title card__link"><%= translated_attribute assembly.title %></span>
|
|
14
14
|
</div>
|
|
@@ -6,10 +6,6 @@ module Decidim
|
|
|
6
6
|
class HighlightedAssembliesCell < Decidim::ViewModel
|
|
7
7
|
delegate :current_user, to: :controller
|
|
8
8
|
|
|
9
|
-
cache :show, expires_in: 10.minutes, if: :perform_caching? do
|
|
10
|
-
cache_hash
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
def show
|
|
14
10
|
render if highlighted_assemblies.any?
|
|
15
11
|
end
|
|
@@ -22,6 +18,7 @@ module Decidim
|
|
|
22
18
|
@highlighted_assemblies ||= OrganizationPrioritizedAssemblies
|
|
23
19
|
.new(current_organization, current_user)
|
|
24
20
|
.query
|
|
21
|
+
.with_attached_hero_image
|
|
25
22
|
.includes([:organization])
|
|
26
23
|
.limit(max_results)
|
|
27
24
|
end
|
|
@@ -39,6 +36,7 @@ module Decidim
|
|
|
39
36
|
def cache_hash
|
|
40
37
|
hash = []
|
|
41
38
|
hash.push(I18n.locale)
|
|
39
|
+
hash.push(highlighted_assemblies.map(&:cache_key_with_version))
|
|
42
40
|
hash.join(Decidim.cache_key_separator)
|
|
43
41
|
end
|
|
44
42
|
end
|
|
@@ -5,14 +5,15 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when copying a new participatory
|
|
7
7
|
# assembly in the system.
|
|
8
|
-
class CopyAssembly <
|
|
8
|
+
class CopyAssembly < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# form - A form object with the params.
|
|
12
12
|
# assembly - An assembly we want to duplicate
|
|
13
|
-
def initialize(form, assembly)
|
|
13
|
+
def initialize(form, assembly, user)
|
|
14
14
|
@form = form
|
|
15
15
|
@assembly = assembly
|
|
16
|
+
@user = user
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
# Executes the command. Broadcasts these events:
|
|
@@ -24,11 +25,13 @@ module Decidim
|
|
|
24
25
|
def call
|
|
25
26
|
return broadcast(:invalid) if form.invalid?
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
Decidim.traceability.perform_action!("duplicate", @assembly, @user) do
|
|
29
|
+
Assembly.transaction do
|
|
30
|
+
copy_assembly
|
|
31
|
+
copy_assembly_attachments
|
|
32
|
+
copy_assembly_categories if @form.copy_categories?
|
|
33
|
+
copy_assembly_components if @form.copy_components?
|
|
34
|
+
end
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
broadcast(:ok, @copied_assembly)
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when creating a new assembly
|
|
7
7
|
# type in the system.
|
|
8
|
-
class CreateAssembliesType <
|
|
8
|
+
class CreateAssembliesType < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# form - A form object with the params.
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when creating a new participatory
|
|
7
7
|
# assembly in the system.
|
|
8
|
-
class CreateAssembly <
|
|
8
|
+
class CreateAssembly < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# form - A form object with the params.
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when creating a new assembly
|
|
7
7
|
# member in the system.
|
|
8
|
-
class CreateAssemblyMember <
|
|
8
|
+
class CreateAssemblyMember < Decidim::Command
|
|
9
9
|
include ::Decidim::AttachmentAttributesMethods
|
|
10
10
|
|
|
11
11
|
# Public: Initializes the command.
|
|
@@ -53,16 +53,16 @@ module Decidim
|
|
|
53
53
|
|
|
54
54
|
def assembly_member_attributes
|
|
55
55
|
form.attributes.slice(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
).merge(
|
|
56
|
+
"full_name",
|
|
57
|
+
"gender",
|
|
58
|
+
"birthday",
|
|
59
|
+
"birthplace",
|
|
60
|
+
"ceased_date",
|
|
61
|
+
"designation_date",
|
|
62
|
+
"position",
|
|
63
|
+
"position_other",
|
|
64
|
+
"weight"
|
|
65
|
+
).symbolize_keys.merge(
|
|
66
66
|
assembly: assembly,
|
|
67
67
|
user: form.user
|
|
68
68
|
).merge(
|
|
@@ -99,7 +99,7 @@ module Decidim
|
|
|
99
99
|
resource: assembly,
|
|
100
100
|
followers: followers
|
|
101
101
|
}
|
|
102
|
-
Decidim::EventsManager.publish(data)
|
|
102
|
+
Decidim::EventsManager.publish(**data)
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
end
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when destroying an assembly
|
|
7
7
|
# type in the system.
|
|
8
|
-
class DestroyAssembliesType <
|
|
8
|
+
class DestroyAssembliesType < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# assemblies_type - the AssemblyMember to destroy
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when destroying an assembly
|
|
7
7
|
# admin in the system.
|
|
8
|
-
class DestroyAssemblyAdmin <
|
|
8
|
+
class DestroyAssemblyAdmin < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# role - the AssemblyUserRole to destroy
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when destroying an assembly
|
|
7
7
|
# member in the system.
|
|
8
|
-
class DestroyAssemblyMember <
|
|
8
|
+
class DestroyAssemblyMember < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# assembly_member - the AssemblyMember to destroy
|
|
@@ -5,13 +5,14 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic to import a new assembly
|
|
7
7
|
# in the system.
|
|
8
|
-
class ImportAssembly <
|
|
8
|
+
class ImportAssembly < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# form - A form object with the params.
|
|
12
12
|
# assembly - An assembly we want to duplicate
|
|
13
|
-
def initialize(form)
|
|
13
|
+
def initialize(form, user)
|
|
14
14
|
@form = form
|
|
15
|
+
@user = user
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
# Executes the command. Broadcasts these events:
|
|
@@ -38,11 +39,14 @@ module Decidim
|
|
|
38
39
|
def import_assembly
|
|
39
40
|
importer = Decidim::Assemblies::AssemblyImporter.new(form.current_organization, form.current_user)
|
|
40
41
|
assemblies.each do |original_assembly|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
Decidim.traceability.perform_action!("import", Assembly, @user) do
|
|
43
|
+
@imported_assembly = importer.import(original_assembly, form.current_user, title: form.title, slug: form.slug)
|
|
44
|
+
importer.import_assemblies_type(original_assembly["decidim_assemblies_type_id"])
|
|
45
|
+
importer.import_categories(original_assembly["assembly_categories"]) if form.import_categories?
|
|
46
|
+
importer.import_folders_and_attachments(original_assembly["attachments"]) if form.import_attachments?
|
|
47
|
+
importer.import_components(original_assembly["components"]) if form.import_components?
|
|
48
|
+
@imported_assembly
|
|
49
|
+
end
|
|
46
50
|
end
|
|
47
51
|
end
|
|
48
52
|
|
|
@@ -4,7 +4,7 @@ module Decidim
|
|
|
4
4
|
module Assemblies
|
|
5
5
|
module Admin
|
|
6
6
|
# A command to notify users when a role is assigned for an assembly
|
|
7
|
-
class NotifyRoleAssignedToAssembly <
|
|
7
|
+
class NotifyRoleAssignedToAssembly < Decidim::Command
|
|
8
8
|
def send_notification(user)
|
|
9
9
|
Decidim::EventsManager.publish(
|
|
10
10
|
event: "decidim.events.assembly.role_assigned",
|
|
@@ -4,7 +4,7 @@ module Decidim
|
|
|
4
4
|
module Assemblies
|
|
5
5
|
module Admin
|
|
6
6
|
# A command that sets an assembly as published.
|
|
7
|
-
class PublishAssembly <
|
|
7
|
+
class PublishAssembly < Decidim::Command
|
|
8
8
|
# Public: Initializes the command.
|
|
9
9
|
#
|
|
10
10
|
# assembly - A Assembly that will be published
|
|
@@ -4,7 +4,7 @@ module Decidim
|
|
|
4
4
|
module Assemblies
|
|
5
5
|
module Admin
|
|
6
6
|
# A command that sets an assembly as unpublished.
|
|
7
|
-
class UnpublishAssembly <
|
|
7
|
+
class UnpublishAssembly < Decidim::Command
|
|
8
8
|
# Public: Initializes the command.
|
|
9
9
|
#
|
|
10
10
|
# assembly - A Assembly that will be published
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when updating assemblies
|
|
7
7
|
# settings in admin area.
|
|
8
|
-
class UpdateAssembliesSetting <
|
|
8
|
+
class UpdateAssembliesSetting < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# assemblies_setting - A assemblies_setting object to update.
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when updating a new assembly
|
|
7
7
|
# type in the system.
|
|
8
|
-
class UpdateAssembliesType <
|
|
8
|
+
class UpdateAssembliesType < Decidim::Command
|
|
9
9
|
# Public: Initializes the command.
|
|
10
10
|
#
|
|
11
11
|
# assemblies_type - A assemblies_type object to update.
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when creating a new participatory
|
|
7
7
|
# assembly in the system.
|
|
8
|
-
class UpdateAssembly <
|
|
8
|
+
class UpdateAssembly < Decidim::Command
|
|
9
9
|
include ::Decidim::AttachmentAttributesMethods
|
|
10
10
|
|
|
11
11
|
# Public: Initializes the command.
|
|
@@ -5,7 +5,7 @@ module Decidim
|
|
|
5
5
|
module Admin
|
|
6
6
|
# A command with all the business logic when updating an assembly
|
|
7
7
|
# member in the system.
|
|
8
|
-
class UpdateAssemblyMember <
|
|
8
|
+
class UpdateAssemblyMember < Decidim::Command
|
|
9
9
|
include ::Decidim::AttachmentAttributesMethods
|
|
10
10
|
|
|
11
11
|
# Public: Initializes the command.
|
|
@@ -51,16 +51,16 @@ module Decidim
|
|
|
51
51
|
|
|
52
52
|
def attributes
|
|
53
53
|
form.attributes.slice(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
).merge(
|
|
54
|
+
"full_name",
|
|
55
|
+
"gender",
|
|
56
|
+
"birthday",
|
|
57
|
+
"birthplace",
|
|
58
|
+
"ceased_date",
|
|
59
|
+
"designation_date",
|
|
60
|
+
"position",
|
|
61
|
+
"position_other",
|
|
62
|
+
"weight"
|
|
63
|
+
).symbolize_keys.merge(
|
|
64
64
|
user: form.user
|
|
65
65
|
).merge(
|
|
66
66
|
attachment_attributes(:non_user_avatar)
|
|
@@ -17,7 +17,7 @@ module Decidim
|
|
|
17
17
|
enforce_permission_to :create, :assembly
|
|
18
18
|
@form = form(AssemblyCopyForm).from_params(params)
|
|
19
19
|
|
|
20
|
-
CopyAssembly.call(@form, current_assembly) do
|
|
20
|
+
CopyAssembly.call(@form, current_assembly, current_user) do
|
|
21
21
|
on(:ok) do
|
|
22
22
|
flash[:notice] = I18n.t("assemblies_copies.create.success", scope: "decidim.admin")
|
|
23
23
|
redirect_to assemblies_path(parent_id: current_assembly.parent_id)
|
|
@@ -13,7 +13,7 @@ module Decidim
|
|
|
13
13
|
enforce_permission_to :import, :assembly
|
|
14
14
|
@form = form(AssemblyImportForm).from_params(params)
|
|
15
15
|
|
|
16
|
-
ImportAssembly.call(@form) do
|
|
16
|
+
ImportAssembly.call(@form, current_user) do
|
|
17
17
|
on(:ok) do
|
|
18
18
|
flash[:notice] = I18n.t("assembly_imports.create.success", scope: "decidim.admin")
|
|
19
19
|
redirect_to assemblies_path
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module Assemblies
|
|
5
|
+
module Admin
|
|
6
|
+
# This controller allows to send reminders.
|
|
7
|
+
# It is targeted for customizations for reminder things that lives under
|
|
8
|
+
# an assembly.
|
|
9
|
+
class RemindersController < Decidim::Admin::RemindersController
|
|
10
|
+
include Concerns::AssemblyAdmin
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -48,15 +48,15 @@ module Decidim
|
|
|
48
48
|
|
|
49
49
|
private
|
|
50
50
|
|
|
51
|
-
def
|
|
52
|
-
|
|
51
|
+
def search_collection
|
|
52
|
+
Assembly.where(organization: current_organization).published.visible_for(current_user)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def default_filter_params
|
|
56
56
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
with_scope: nil,
|
|
58
|
+
with_area: nil,
|
|
59
|
+
type_id_eq: nil
|
|
60
60
|
}
|
|
61
61
|
end
|
|
62
62
|
|
|
@@ -77,7 +77,7 @@ module Decidim
|
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
def parent_assemblies
|
|
80
|
-
search.
|
|
80
|
+
search.result.parent_assemblies.order(weight: :asc, promoted: :desc)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
def stats
|
|
@@ -30,10 +30,9 @@ module Decidim
|
|
|
30
30
|
attribute :import_categories, Boolean, default: true
|
|
31
31
|
attribute :import_attachments, Boolean, default: true
|
|
32
32
|
attribute :import_components, Boolean, default: true
|
|
33
|
-
attribute :document
|
|
34
|
-
|
|
35
|
-
validates :document, presence: true
|
|
33
|
+
attribute :document, Decidim::Attributes::Blob
|
|
36
34
|
|
|
35
|
+
validates :document, file_content_type: { allow: ACCEPTED_TYPES.values }
|
|
37
36
|
validates :slug, presence: true, format: { with: Decidim::Assembly.slug_format }
|
|
38
37
|
validates :title, translatable_presence: true
|
|
39
38
|
validate :slug_uniqueness
|
|
@@ -41,7 +40,7 @@ module Decidim
|
|
|
41
40
|
validate :document_type_must_be_valid, if: :document
|
|
42
41
|
|
|
43
42
|
def document_text
|
|
44
|
-
@document_text ||= document&.
|
|
43
|
+
@document_text ||= document&.download
|
|
45
44
|
end
|
|
46
45
|
|
|
47
46
|
def document_type_must_be_valid
|
|
@@ -60,9 +59,9 @@ module Decidim
|
|
|
60
59
|
end
|
|
61
60
|
|
|
62
61
|
def i18n_invalid_document_type_text
|
|
63
|
-
I18n.t("
|
|
62
|
+
I18n.t("allowed_file_content_types",
|
|
64
63
|
scope: "activemodel.errors.models.assembly.attributes.document",
|
|
65
|
-
|
|
64
|
+
types: i18n_valid_mime_types_text)
|
|
66
65
|
end
|
|
67
66
|
|
|
68
67
|
def i18n_valid_mime_types_text
|
|
@@ -7,7 +7,9 @@ module Decidim
|
|
|
7
7
|
# `filter` returns a Filter object from Decidim::FilterResource
|
|
8
8
|
module FilterAssembliesHelper
|
|
9
9
|
def available_filters
|
|
10
|
-
|
|
10
|
+
return if organization_assembly_types.blank?
|
|
11
|
+
|
|
12
|
+
[t("all", scope: "decidim.assemblies.filter")] + organization_assembly_types
|
|
11
13
|
end
|
|
12
14
|
|
|
13
15
|
def filter_link(type_id)
|
|
@@ -16,9 +18,9 @@ module Decidim
|
|
|
16
18
|
.url_helpers
|
|
17
19
|
.assemblies_path(
|
|
18
20
|
filter: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
with_scope: filter.with_scope,
|
|
22
|
+
with_area: filter.with_area,
|
|
23
|
+
type_id_eq: type_id
|
|
22
24
|
}
|
|
23
25
|
)
|
|
24
26
|
end
|
|
@@ -28,14 +30,16 @@ module Decidim
|
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
def current_filter_name
|
|
31
|
-
type = AssembliesType.find_by(id:
|
|
33
|
+
type = AssembliesType.find_by(id: filter_params[:type_id_eq])
|
|
32
34
|
return translated_attribute type.title if type
|
|
33
35
|
|
|
34
36
|
t("all", scope: "decidim.assemblies.filter")
|
|
35
37
|
end
|
|
36
38
|
|
|
37
39
|
def organization_assembly_types
|
|
38
|
-
AssembliesType.where(organization: current_organization)
|
|
40
|
+
@organization_assembly_types ||= AssembliesType.where(organization: current_organization).joins(:assemblies).where(
|
|
41
|
+
decidim_assemblies: { id: search.result.unscope(where: :decidim_assemblies_type_id).parent_assemblies }
|
|
42
|
+
).distinct&.map { |type| [translated_attribute(type.title), type.id] }
|
|
39
43
|
end
|
|
40
44
|
end
|
|
41
45
|
end
|
|
@@ -34,6 +34,8 @@ module Decidim
|
|
|
34
34
|
include Decidim::Searchable
|
|
35
35
|
include Decidim::HasUploadValidations
|
|
36
36
|
include Decidim::TranslatableResource
|
|
37
|
+
include Decidim::HasArea
|
|
38
|
+
include Decidim::FilterableResource
|
|
37
39
|
|
|
38
40
|
SOCIAL_HANDLERS = [:twitter, :facebook, :instagram, :youtube, :github].freeze
|
|
39
41
|
CREATED_BY = %w(city_council public others).freeze
|
|
@@ -146,7 +148,7 @@ module Decidim
|
|
|
146
148
|
end
|
|
147
149
|
|
|
148
150
|
def user_roles(role_name = nil)
|
|
149
|
-
roles = Decidim::AssemblyUserRole.where(assembly:
|
|
151
|
+
roles = Decidim::AssemblyUserRole.where(assembly: self_and_ancestors)
|
|
150
152
|
return roles if role_name.blank?
|
|
151
153
|
|
|
152
154
|
roles.where(role: role_name)
|
|
@@ -156,6 +158,10 @@ module Decidim
|
|
|
156
158
|
:admin
|
|
157
159
|
end
|
|
158
160
|
|
|
161
|
+
def self.ransackable_scopes(_auth_object = nil)
|
|
162
|
+
[:with_area, :with_scope]
|
|
163
|
+
end
|
|
164
|
+
|
|
159
165
|
private
|
|
160
166
|
|
|
161
167
|
# When an assembly changes their parent, we need to update the parents_path attribute
|
|
@@ -208,8 +214,8 @@ module Decidim
|
|
|
208
214
|
# rubocop:enable Rails/SkipsModelValidations
|
|
209
215
|
|
|
210
216
|
# Allow ransacker to search for a key in a hstore column (`title`.`en`)
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
217
|
+
ransacker_i18n :title
|
|
218
|
+
|
|
219
|
+
ransack_alias :type_id, :decidim_assemblies_type_id
|
|
214
220
|
end
|
|
215
221
|
end
|