decidim-initiatives 0.24.0 → 0.25.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +2 -0
- data/app/cells/decidim/initiatives/initiative_m_cell.rb +1 -3
- data/app/commands/decidim/initiatives/attachment_methods.rb +2 -1
- data/app/controllers/concerns/decidim/initiatives/admin/initiative_admin.rb +7 -0
- data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +7 -1
- data/app/controllers/decidim/initiatives/admin/initiatives_permissions_controller.rb +27 -0
- data/app/controllers/decidim/initiatives/admin/initiatives_types_controller.rb +0 -2
- data/app/controllers/decidim/initiatives/initiatives_controller.rb +4 -0
- data/app/controllers/decidim/initiatives/versions_controller.rb +6 -0
- data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +5 -1
- data/app/forms/decidim/initiatives/initiative_form.rb +2 -1
- data/app/helpers/decidim/initiatives/admin/initiatives_helper.rb +25 -0
- data/app/jobs/decidim/initiatives/export_initiatives_job.rb +12 -5
- data/app/models/decidim/initiative.rb +21 -15
- data/app/models/decidim/initiatives_type.rb +3 -1
- data/app/packs/entrypoints/decidim_initiatives.js +6 -0
- data/app/packs/entrypoints/decidim_initiatives_admin.js +3 -0
- data/app/packs/entrypoints/decidim_initiatives_initiatives_votes.js +1 -0
- data/app/packs/entrypoints/decidim_initiatives_initiatives_votes.scss +1 -0
- data/app/packs/entrypoints/decidim_initiatives_print.js +1 -0
- data/app/packs/entrypoints/decidim_initiatives_print.scss +1 -0
- data/app/{assets/images/decidim/gamification/badges/initiatives.svg → packs/images/decidim/gamification/badges/decidim_gamification_badges_initiatives.svg} +0 -0
- data/app/{assets/images/decidim/initiatives/icon.svg → packs/images/decidim/initiatives/decidim_initiatives.svg} +0 -0
- data/app/{assets/javascripts/decidim/initiatives/admin/initiatives_types.js.es6 → packs/src/decidim/initiatives/admin/initiatives_types.js} +0 -0
- data/app/{assets/javascripts → packs/src}/decidim/initiatives/admin/invite_users.js +2 -2
- data/app/packs/src/decidim/initiatives/application.js +3 -0
- data/app/{assets/javascripts → packs/src}/decidim/initiatives/identity_selector_dialog.js +2 -2
- data/app/{assets/javascripts → packs/src}/decidim/initiatives/scoped_type.js +2 -2
- data/app/{assets/stylesheet/decidim/initiatives/admin.css.scss → packs/stylesheets/decidim/initiatives/admin.scss} +0 -0
- data/app/{assets/stylesheet/decidim/initiatives/initiatives-votes.css.scss → packs/stylesheets/decidim/initiatives/initiatives-votes.scss} +0 -0
- data/app/{assets/stylesheet → packs/stylesheets}/decidim/initiatives/initiatives.scss +3 -3
- data/app/{assets/stylesheet/decidim/initiatives/popularity_item.css.scss → packs/stylesheets/decidim/initiatives/popularity_item.scss} +0 -0
- data/app/{assets/stylesheet/decidim/initiatives/print-initiative.css.scss → packs/stylesheets/decidim/initiatives/print-initiative.scss} +0 -0
- data/app/{assets/stylesheet/decidim/initiatives/statistics.css.scss → packs/stylesheets/decidim/initiatives/statistics.scss} +0 -0
- data/app/permissions/decidim/initiatives/permissions.rb +22 -16
- data/app/queries/decidim/initiatives/admin/admin_users.rb +13 -8
- data/app/views/decidim/initiatives/admin/committee_requests/index.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/exports/_dropdown.html.erb +19 -3
- data/app/views/decidim/initiatives/admin/initiatives/_form.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +17 -14
- data/app/views/decidim/initiatives/admin/initiatives/show.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/_form.html.erb +1 -1
- data/app/views/decidim/initiatives/admin/initiatives_types/index.html.erb +1 -1
- data/app/views/decidim/initiatives/committee_requests/new.html.erb +2 -2
- data/app/views/decidim/initiatives/create_initiative/_share_committee_link.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_author.html.erb +4 -4
- data/app/views/decidim/initiatives/initiatives/_committee_members.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_filters.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/_form.html.erb +2 -2
- data/app/views/decidim/initiatives/initiatives/index.html.erb +0 -3
- data/app/views/decidim/initiatives/initiatives/print.html.erb +1 -1
- data/app/views/decidim/initiatives/initiatives/show.html.erb +2 -2
- data/app/views/layouts/decidim/_initiative_header.html.erb +1 -1
- data/app/views/layouts/decidim/admin/initiative.html.erb +4 -51
- data/app/views/layouts/decidim/admin/initiatives.html.erb +1 -1
- data/app/views/layouts/decidim/admin/initiatives_votes.pdf.erb +1 -1
- data/app/views/layouts/decidim/initiative_creation.html.erb +1 -1
- data/app/views/layouts/decidim/initiative_signature_creation.html.erb +1 -1
- data/config/assets.rb +12 -0
- data/config/locales/ar.yml +2 -5
- data/config/locales/ca.yml +5 -6
- data/config/locales/cs.yml +29 -30
- data/config/locales/de.yml +5 -6
- data/config/locales/el.yml +2 -5
- data/config/locales/en.yml +8 -6
- data/config/locales/es-MX.yml +5 -6
- data/config/locales/es-PY.yml +5 -6
- data/config/locales/es.yml +5 -6
- data/config/locales/eu.yml +2 -5
- data/config/locales/fi-plain.yml +5 -6
- data/config/locales/fi.yml +5 -6
- data/config/locales/fr-CA.yml +2 -6
- data/config/locales/fr-LU.yml +613 -0
- data/config/locales/fr.yml +2 -6
- data/config/locales/gl.yml +5 -5
- data/config/locales/hu.yml +2 -6
- data/config/locales/id-ID.yml +2 -5
- data/config/locales/is-IS.yml +2 -5
- data/config/locales/it.yml +120 -5
- data/config/locales/ja.yml +112 -20
- data/config/locales/lb-LU.yml +1 -0
- data/config/locales/lv.yml +2 -5
- data/config/locales/nl.yml +5 -6
- data/config/locales/no.yml +2 -6
- data/config/locales/pl.yml +6 -7
- data/config/locales/pt-BR.yml +187 -5
- data/config/locales/pt.yml +2 -5
- data/config/locales/ro-RO.yml +117 -6
- data/config/locales/ru.yml +2 -5
- data/config/locales/sk.yml +2 -5
- data/config/locales/sv.yml +57 -6
- data/config/locales/tr-TR.yml +2 -6
- data/config/locales/uk.yml +2 -5
- data/config/locales/zh-CN.yml +2 -6
- data/db/migrate/20191002082220_move_signature_type_to_initative_type.rb +1 -1
- data/lib/decidim/api/initiative_api_type.rb +4 -0
- data/lib/decidim/initiatives/admin_engine.rb +70 -25
- data/lib/decidim/initiatives/engine.rb +5 -11
- data/lib/decidim/initiatives/participatory_space.rb +16 -3
- data/lib/decidim/initiatives/version.rb +1 -1
- metadata +41 -55
- data/app/assets/config/admin_decidim_initiatives_manifest.js +0 -4
- data/app/assets/config/decidim_initiatives_manifest.css +0 -3
- data/app/assets/config/decidim_initiatives_manifest.js +0 -5
- data/app/assets/javascripts/decidim/initiatives/application.js +0 -1
- data/app/helpers/decidim/initiatives/admin/initiative_admin_menu_helper.rb +0 -15
- data/config/locales/ja-JP.yml +0 -529
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 030de12860861c98798c28592807e837e9069eab51efba83f1d84f646361f66a
|
4
|
+
data.tar.gz: aeb989682d1c94cae4b9d702d45626ee5aa9ac79897a6d5b1259f91def3cbfb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a065f653e0aa5a170cbbda2c2f361c1f4dbd960b611458a40acf2f33653038ecd985800c684314050b79a35cf2d1fbe57b892883c692c8230a4434be3e58c194
|
7
|
+
data.tar.gz: 7ece21753bd0f8579465ccbad6808597e35a5edd2381da73f49696931cb50792f45892eecdb5e244ec99ed35fc2211d106b8b781d02648fb7ebd73da9d4f4c37
|
@@ -6,6 +6,8 @@
|
|
6
6
|
<% highlighted_initiatives.each do |initiative| %>
|
7
7
|
<div class="column">
|
8
8
|
<%= link_to decidim_initiatives.initiative_path(initiative), class: "card card--initiative card--mini" do %>
|
9
|
+
<div aria-hidden="true" class="card__image-top"
|
10
|
+
style="background-image:url(<%= initiative.banner_image.path %>)"></div>
|
9
11
|
<span class="show-for-sr"><%= translated_attribute initiative.title %></span>
|
10
12
|
<div class="card__content">
|
11
13
|
<span class="card__title card__link"><%= decidim_html_escape(translated_attribute(initiative.title)) %></span>
|
@@ -12,7 +12,8 @@ module Decidim
|
|
12
12
|
@attachment = Attachment.new(
|
13
13
|
title: { I18n.locale => @form.attachment.title },
|
14
14
|
attached_to: attached_to,
|
15
|
-
file: @form.attachment.file # Define attached_to before this
|
15
|
+
file: @form.attachment.file, # Define attached_to before this
|
16
|
+
content_type: @form.attachment.file.content_type
|
16
17
|
)
|
17
18
|
end
|
18
19
|
|
@@ -19,6 +19,13 @@ module Decidim
|
|
19
19
|
participatory_space_admin_layout
|
20
20
|
|
21
21
|
alias_method :current_participatory_space, :current_initiative
|
22
|
+
alias_method :current_participatory_space_manifest, :initiatives_manifest
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def initiatives_manifest
|
28
|
+
@initiatives_manifest ||= Decidim.find_participatory_space_manifest(:initiatives)
|
22
29
|
end
|
23
30
|
end
|
24
31
|
end
|
@@ -12,6 +12,7 @@ module Decidim
|
|
12
12
|
include Decidim::Initiatives::TypeSelectorOptions
|
13
13
|
include Decidim::Initiatives::Admin::Filterable
|
14
14
|
|
15
|
+
helper ::Decidim::Admin::ResourcePermissionsHelper
|
15
16
|
helper Decidim::Initiatives::InitiativeHelper
|
16
17
|
helper Decidim::Initiatives::CreateInitiativeHelper
|
17
18
|
|
@@ -125,7 +126,12 @@ module Decidim
|
|
125
126
|
def export
|
126
127
|
enforce_permission_to :export, :initiatives
|
127
128
|
|
128
|
-
Decidim::Initiatives::ExportInitiativesJob.perform_later(
|
129
|
+
Decidim::Initiatives::ExportInitiativesJob.perform_later(
|
130
|
+
current_user,
|
131
|
+
current_organization,
|
132
|
+
params[:format] || default_format,
|
133
|
+
params[:collection_ids].presence&.map(&:to_i)
|
134
|
+
)
|
129
135
|
|
130
136
|
flash[:notice] = t("decidim.admin.exports.notice")
|
131
137
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
module Admin
|
6
|
+
# Controller that allows managing initiatives
|
7
|
+
# permissions in the admin panel.
|
8
|
+
class InitiativesPermissionsController < Decidim::Admin::ResourcePermissionsController
|
9
|
+
include Decidim::Initiatives::NeedsInitiative
|
10
|
+
|
11
|
+
layout "decidim/admin/initiatives"
|
12
|
+
|
13
|
+
register_permissions(::Decidim::Initiatives::Admin::InitiativesPermissionsController,
|
14
|
+
::Decidim::Initiatives::Permissions,
|
15
|
+
::Decidim::Admin::Permissions)
|
16
|
+
|
17
|
+
def resource
|
18
|
+
current_initiative
|
19
|
+
end
|
20
|
+
|
21
|
+
def permission_class_chain
|
22
|
+
::Decidim.permissions_registry.chain_for(::Decidim::Initiatives::Admin::InitiativesPermissionsController)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -114,6 +114,10 @@ module Decidim
|
|
114
114
|
@current_participatory_space ||= Initiative.find_by(id: id_from_slug(params[:slug]))
|
115
115
|
end
|
116
116
|
|
117
|
+
def current_participatory_space_manifest
|
118
|
+
@current_participatory_space_manifest ||= Decidim.find_participatory_space_manifest(:initiatives)
|
119
|
+
end
|
120
|
+
|
117
121
|
def initiatives
|
118
122
|
@initiatives = search.results.includes(:scoped_type)
|
119
123
|
@initiatives = reorder(@initiatives)
|
@@ -15,6 +15,12 @@ module Decidim
|
|
15
15
|
def versioned_resource
|
16
16
|
current_initiative
|
17
17
|
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def current_participatory_space_manifest
|
22
|
+
@current_participatory_space_manifest ||= Decidim.find_participatory_space_manifest(:initiatives)
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
@@ -32,9 +32,13 @@ module Decidim
|
|
32
32
|
validates :attachments_enabled, :undo_online_signatures_enabled, :custom_signature_end_date_enabled,
|
33
33
|
:area_enabled, :promoting_committee_enabled, inclusion: { in: [true, false] }
|
34
34
|
validates :minimum_committee_members, numericality: { only_integer: true }, allow_nil: true
|
35
|
-
validates :banner_image, presence: true, if: ->(form) { form.context.initiative_type.nil? }
|
35
|
+
validates :banner_image, presence: true, if: ->(form) { !form.persisted? && form.context.initiative_type.nil? }
|
36
36
|
validates :document_number_authorization_handler, presence: true, if: ->(form) { form.collect_user_extra_fields? }
|
37
37
|
|
38
|
+
validates :banner_image, passthru: { to: Decidim::InitiativesType }
|
39
|
+
|
40
|
+
alias organization current_organization
|
41
|
+
|
38
42
|
def minimum_committee_members=(value)
|
39
43
|
super(value.presence)
|
40
44
|
end
|
@@ -115,7 +115,8 @@ module Decidim
|
|
115
115
|
|
116
116
|
attachment = Attachment.new(
|
117
117
|
attached_to: attachment.try(:attached_to),
|
118
|
-
file: attachment.try(:file)
|
118
|
+
file: attachment.try(:file),
|
119
|
+
content_type: attachment.try(:file)&.content_type
|
119
120
|
)
|
120
121
|
|
121
122
|
errors.add(:attachment, :file) if !attachment.save && attachment.errors.has_key?(:file)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Initiatives
|
5
|
+
module Admin
|
6
|
+
module InitiativesHelper
|
7
|
+
def export_dropdown(collection_ids = nil)
|
8
|
+
render partial: "decidim/initiatives/admin/exports/dropdown", locals: { collection_ids: collection_ids }
|
9
|
+
end
|
10
|
+
|
11
|
+
def export_dropdowns(query)
|
12
|
+
return export_dropdown if query.conditions.empty?
|
13
|
+
|
14
|
+
export_dropdown.concat(export_dropdown(query.result.map(&:id)))
|
15
|
+
end
|
16
|
+
|
17
|
+
def dropdown_id(collection_ids)
|
18
|
+
return "export-dropdown" if collection_ids.blank?
|
19
|
+
|
20
|
+
"export-selection-dropdown"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -3,18 +3,25 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
5
|
class ExportInitiativesJob < ApplicationJob
|
6
|
-
queue_as :
|
6
|
+
queue_as :exports
|
7
7
|
|
8
|
-
def perform(user, format)
|
9
|
-
export_data = Decidim::Exporters.find_exporter(format).new(
|
8
|
+
def perform(user, organization, format, collection_ids = nil)
|
9
|
+
export_data = Decidim::Exporters.find_exporter(format).new(
|
10
|
+
collection_to_export(collection_ids, organization),
|
11
|
+
serializer
|
12
|
+
).export
|
10
13
|
|
11
14
|
ExportMailer.export(user, "initiatives", export_data).deliver_now
|
12
15
|
end
|
13
16
|
|
14
17
|
private
|
15
18
|
|
16
|
-
def
|
17
|
-
Decidim::Initiative.
|
19
|
+
def collection_to_export(ids, organization)
|
20
|
+
collection = Decidim::Initiative.where(organization: organization)
|
21
|
+
|
22
|
+
collection = collection.where(id: ids) if ids.present?
|
23
|
+
|
24
|
+
collection.order(id: :asc)
|
18
25
|
end
|
19
26
|
|
20
27
|
def serializer
|
@@ -21,6 +21,7 @@ module Decidim
|
|
21
21
|
include Decidim::Searchable
|
22
22
|
include Decidim::Initiatives::HasArea
|
23
23
|
include Decidim::TranslatableResource
|
24
|
+
include Decidim::HasResourcePermission
|
24
25
|
|
25
26
|
translatable_fields :title, :description, :answer
|
26
27
|
|
@@ -124,15 +125,18 @@ module Decidim
|
|
124
125
|
Decidim::Initiatives::AdminLog::InitiativePresenter
|
125
126
|
end
|
126
127
|
|
128
|
+
delegate :document_number_authorization_handler, :promoting_committee_enabled?, to: :type
|
129
|
+
delegate :type, :scope, :scope_name, to: :scoped_type, allow_nil: true
|
130
|
+
|
127
131
|
# PUBLIC banner image
|
128
132
|
#
|
129
133
|
# Overrides participatory space's banner image with the banner image defined
|
130
134
|
# for the initiative type.
|
131
135
|
#
|
132
|
-
# RETURNS
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
+
# RETURNS Decidim::BannerImageUploader
|
137
|
+
def banner_image
|
138
|
+
type.attached_uploader(:banner_image)
|
139
|
+
end
|
136
140
|
|
137
141
|
# PUBLIC
|
138
142
|
#
|
@@ -177,17 +181,6 @@ module Decidim
|
|
177
181
|
user_group&.name || author.name
|
178
182
|
end
|
179
183
|
|
180
|
-
# PUBLIC author_avatar_url
|
181
|
-
#
|
182
|
-
# Returns the author's avatar URL. In case it is not defined the method
|
183
|
-
# falls back to decidim/default-avatar.svg
|
184
|
-
#
|
185
|
-
# RETURNS STRING
|
186
|
-
def author_avatar_url
|
187
|
-
author.avatar&.url ||
|
188
|
-
ActionController::Base.helpers.asset_path("decidim/default-avatar.svg")
|
189
|
-
end
|
190
|
-
|
191
184
|
def votes_enabled?
|
192
185
|
published? &&
|
193
186
|
signature_start_date <= Date.current &&
|
@@ -410,6 +403,10 @@ module Decidim
|
|
410
403
|
committee_members.approved.count >= minimum_committee_members
|
411
404
|
end
|
412
405
|
|
406
|
+
def component
|
407
|
+
nil
|
408
|
+
end
|
409
|
+
|
413
410
|
# PUBLIC
|
414
411
|
#
|
415
412
|
# Checks if the type the initiative belongs to enables SMS code
|
@@ -428,6 +425,15 @@ module Decidim
|
|
428
425
|
Decidim::ParticipatorySpaceRoleConfig::Base.new(:empty_role_name)
|
429
426
|
end
|
430
427
|
|
428
|
+
# Public: Overrides the `allow_resource_permissions?` Resourceable concern method.
|
429
|
+
def allow_resource_permissions?
|
430
|
+
true
|
431
|
+
end
|
432
|
+
|
433
|
+
def user_allowed_to_comment?(user)
|
434
|
+
ActionAuthorizer.new(user, "comment", self, nil).authorize.ok?
|
435
|
+
end
|
436
|
+
|
431
437
|
private
|
432
438
|
|
433
439
|
# Private: This is just an alias because the naming on InitiativeTypeScope
|
@@ -5,6 +5,7 @@ module Decidim
|
|
5
5
|
class InitiativesType < ApplicationRecord
|
6
6
|
include Decidim::HasResourcePermission
|
7
7
|
include Decidim::TranslatableResource
|
8
|
+
include Decidim::HasUploadValidations
|
8
9
|
|
9
10
|
translatable_fields :title, :description, :extra_fields_legal_information
|
10
11
|
|
@@ -27,7 +28,8 @@ module Decidim
|
|
27
28
|
validates :title, :description, :signature_type, presence: true
|
28
29
|
validates :document_number_authorization_handler, presence: true, if: ->(form) { form.collect_user_extra_fields? }
|
29
30
|
|
30
|
-
|
31
|
+
has_one_attached :banner_image
|
32
|
+
validates_upload :banner_image, uploader: Decidim::BannerImageUploader
|
31
33
|
|
32
34
|
def allowed_signature_types_for_initiatives
|
33
35
|
return %w(online offline any) if any_signature_type?
|
@@ -0,0 +1 @@
|
|
1
|
+
import "entrypoints/decidim_initiatives_initiatives_votes.scss"
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "stylesheets/decidim/initiatives/initiatives-votes.scss";
|
@@ -0,0 +1 @@
|
|
1
|
+
import "entrypoints/decidim_initiatives_print.scss"
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "stylesheets/decidim/initiatives/print-initiative";
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* eslint-disable no-empty */
|
2
2
|
|
3
|
-
(
|
3
|
+
$(() => {
|
4
4
|
let inviteUsersButton = document.querySelector(".invite-users-link");
|
5
5
|
|
6
6
|
if (inviteUsersButton !== null) {
|
@@ -20,4 +20,4 @@
|
|
20
20
|
window.getSelection().removeAllRanges();
|
21
21
|
});
|
22
22
|
}
|
23
|
-
}
|
23
|
+
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* eslint-disable camelcase */
|
2
|
-
|
2
|
+
const controlSelector = function(source, prefix, currentValueKey) {
|
3
3
|
if (source.length) {
|
4
4
|
let currentValue = source.data(currentValueKey),
|
5
5
|
searchUrl = source.data(`${prefix}-search-url`),
|
@@ -27,7 +27,7 @@ let controlSelector = function(source, prefix, currentValueKey) {
|
|
27
27
|
}
|
28
28
|
};
|
29
29
|
|
30
|
-
$(
|
30
|
+
$(() => {
|
31
31
|
let typeSelector = $("[data-scope-selector]");
|
32
32
|
controlSelector(typeSelector, "scope", "scope-id");
|
33
33
|
controlSelector(typeSelector, "signature-types", "signature-type");
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
|
-
@import "popularity_item";
|
2
|
-
@import "statistics";
|
3
|
-
@import "admin";
|
1
|
+
@import "stylesheets/decidim/initiatives/popularity_item";
|
2
|
+
@import "stylesheets/decidim/initiatives/statistics";
|
3
|
+
@import "stylesheets/decidim/initiatives/admin";
|
4
4
|
|
5
5
|
.ql-formats{
|
6
6
|
.ql-video{
|
File without changes
|
File without changes
|
File without changes
|
@@ -53,7 +53,7 @@ module Decidim
|
|
53
53
|
permission_action.action == :read
|
54
54
|
|
55
55
|
return allow! if initiative.published? || initiative.rejected? || initiative.accepted?
|
56
|
-
return allow! if user &&
|
56
|
+
return allow! if user && authorship_or_admin?
|
57
57
|
|
58
58
|
disallow!
|
59
59
|
end
|
@@ -73,23 +73,25 @@ module Decidim
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def edit_public_initiative?
|
76
|
-
|
77
|
-
|
76
|
+
return unless permission_action.subject == :initiative &&
|
77
|
+
permission_action.action == :edit
|
78
|
+
|
79
|
+
toggle_allow(initiative&.created? && authorship_or_admin?)
|
78
80
|
end
|
79
81
|
|
80
82
|
def update_public_initiative?
|
81
83
|
return unless permission_action.subject == :initiative &&
|
82
84
|
permission_action.action == :update
|
83
85
|
|
84
|
-
toggle_allow(initiative
|
86
|
+
toggle_allow(initiative&.created? && authorship_or_admin?)
|
85
87
|
end
|
86
88
|
|
87
89
|
def creation_enabled?
|
88
90
|
Decidim::Initiatives.creation_enabled && (
|
89
|
-
|
91
|
+
Decidim::Initiatives.do_not_require_authorization ||
|
90
92
|
UserAuthorizations.for(user).any? ||
|
91
93
|
Decidim::UserGroups::ManageableUserGroups.for(user).verified.any?
|
92
|
-
|
94
|
+
)
|
93
95
|
end
|
94
96
|
|
95
97
|
def request_membership?
|
@@ -114,10 +116,10 @@ module Decidim
|
|
114
116
|
initiative.promoting_committee_enabled? &&
|
115
117
|
!initiative.has_authorship?(user) &&
|
116
118
|
(
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
119
|
+
Decidim::Initiatives.do_not_require_authorization ||
|
120
|
+
UserAuthorizations.for(user).any? ||
|
121
|
+
Decidim::UserGroups::ManageableUserGroups.for(user).verified.any?
|
122
|
+
)
|
121
123
|
end
|
122
124
|
|
123
125
|
def vote_initiative?
|
@@ -182,9 +184,9 @@ module Decidim
|
|
182
184
|
|
183
185
|
def can_user_support?(initiative)
|
184
186
|
!initiative.offline_signature_type? && (
|
185
|
-
|
186
|
-
|
187
|
-
|
187
|
+
Decidim::Initiatives.do_not_require_authorization ||
|
188
|
+
UserAuthorizations.for(user).any?
|
189
|
+
)
|
188
190
|
end
|
189
191
|
|
190
192
|
def initiative_committee_action?
|
@@ -212,9 +214,13 @@ module Decidim
|
|
212
214
|
|
213
215
|
def allowed_to_send_to_technical_validation?
|
214
216
|
initiative.created? && (
|
215
|
-
|
216
|
-
|
217
|
-
|
217
|
+
!initiative.created_by_individual? ||
|
218
|
+
initiative.enough_committee_members?
|
219
|
+
)
|
220
|
+
end
|
221
|
+
|
222
|
+
def authorship_or_admin?
|
223
|
+
initiative&.has_authorship?(user) || user.admin?
|
218
224
|
end
|
219
225
|
end
|
220
226
|
end
|