decidim-initiatives 0.24.3 → 0.25.0.rc4
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/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/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 +5 -6
- 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 +5 -6
- data/config/locales/pt-BR.yml +187 -5
- data/config/locales/pt.yml +2 -5
- data/config/locales/ro-RO.yml +45 -6
- data/config/locales/ru.yml +2 -5
- data/config/locales/sk.yml +2 -5
- data/config/locales/sv.yml +4 -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 +40 -54
- 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: c927baed9a96bb28e27c886146aa0ea8898b6d4729166c832baf289bde717191
|
4
|
+
data.tar.gz: 034ec1df03c41335e1632806ae10de796589009576c1bba421cc443214162165
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8709718cfdee060429d7947b94d06257c00fce9252f957e1d421f1853df53d3b1756134dab2fb064cdd09a3161d207eec940b50691b8c5d01598db4827f7c8c9
|
7
|
+
data.tar.gz: 6f29603c5ecd85827f4ed35d411bca11c092c22bcee35af41b92dd54e8390dd85fae1b07e16d8825a796aaff696d9a3f9012787386efa4240bc433384fc001c6
|
@@ -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
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Initiatives
|
5
5
|
module Admin
|
6
|
-
# A class used to find the admins for an initiative.
|
6
|
+
# A class used to find the admins for an initiative or an organization initiatives.
|
7
7
|
class AdminUsers < Rectify::Query
|
8
8
|
# Syntactic sugar to initialize the class and return the queried objects.
|
9
9
|
#
|
@@ -12,27 +12,32 @@ module Decidim
|
|
12
12
|
new(initiative).query
|
13
13
|
end
|
14
14
|
|
15
|
+
# Syntactic sugar to initialize the class and return the queried objects.
|
16
|
+
#
|
17
|
+
# organization - an organization that needs to find its initiative admins
|
18
|
+
def self.for_organization(organization)
|
19
|
+
new(nil, organization).query
|
20
|
+
end
|
21
|
+
|
15
22
|
# Initializes the class.
|
16
23
|
#
|
17
24
|
# initiative - Decidim::Initiative
|
18
|
-
|
25
|
+
# organization - an organization that needs to find its initiative admins
|
26
|
+
def initialize(initiative, organization = nil)
|
19
27
|
@initiative = initiative
|
28
|
+
@organization = initiative&.organization || organization
|
20
29
|
end
|
21
30
|
|
22
31
|
# Finds organization admins and the users with role admin for the given initiative.
|
23
32
|
#
|
24
33
|
# Returns an ActiveRecord::Relation.
|
25
34
|
def query
|
26
|
-
|
35
|
+
organization.admins
|
27
36
|
end
|
28
37
|
|
29
38
|
private
|
30
39
|
|
31
|
-
attr_reader :initiative
|
32
|
-
|
33
|
-
def organization_admins
|
34
|
-
initiative.organization.admins
|
35
|
-
end
|
40
|
+
attr_reader :initiative, :organization
|
36
41
|
end
|
37
42
|
end
|
38
43
|
end
|
@@ -1,8 +1,24 @@
|
|
1
|
-
<span class="exports dropdown tiny button button--simple" data-toggle="
|
2
|
-
|
1
|
+
<span class="exports dropdown tiny button button--simple" data-toggle="<%= dropdown_id(collection_ids) %>">
|
2
|
+
<% if collection_ids.present? %>
|
3
|
+
<%= t("actions.export-selection", scope: "decidim.admin") %>
|
4
|
+
<% else %>
|
5
|
+
<%= t("actions.export", scope: "decidim.admin") %>
|
6
|
+
<% end %>
|
7
|
+
</span>
|
8
|
+
<div class="dropdown-pane"
|
9
|
+
id="<%= dropdown_id(collection_ids) %>"
|
10
|
+
data-dropdown
|
11
|
+
data-position=bottom
|
12
|
+
data-alignment=right
|
13
|
+
data-auto-focus="true"
|
14
|
+
data-close-on-click="true">
|
3
15
|
<ul class="vertical menu add-components">
|
4
16
|
<% %w{CSV JSON}.each do |format| %>
|
5
|
-
<li class="exports--format--<%= format.downcase %> exports--initiatives"
|
17
|
+
<li class="exports--format--<%= format.downcase %> exports--initiatives">
|
18
|
+
<%= link_to t("decidim.admin.exports.export_as", name: t("decidim.initiatives.admin.exports.initiatives"),
|
19
|
+
export_format: format.upcase),
|
20
|
+
export_initiatives_path(format: format, collection_ids: collection_ids) %>
|
21
|
+
</li>
|
6
22
|
<% end %>
|
7
23
|
</ul>
|
8
24
|
</div>
|
@@ -3,7 +3,9 @@
|
|
3
3
|
<h2 class="card-title">
|
4
4
|
<%= t "decidim.admin.titles.initiatives" %>
|
5
5
|
<div class="button--title">
|
6
|
-
|
6
|
+
<% if allowed_to? :export, :initiatives %>
|
7
|
+
<%= export_dropdowns(query) %>
|
8
|
+
<% end %>
|
7
9
|
</div>
|
8
10
|
</h2>
|
9
11
|
</div>
|
@@ -12,18 +14,18 @@
|
|
12
14
|
<div class="table-scroll">
|
13
15
|
<table class="table-list">
|
14
16
|
<thead>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
<tr>
|
18
|
+
<th><%= t("models.initiatives.fields.id", scope: "decidim.admin") %></th>
|
19
|
+
<th><%= t("models.initiatives.fields.title", scope: "decidim.admin") %></th>
|
20
|
+
<th><%= t("models.initiatives.fields.state", scope: "decidim.admin") %></th>
|
21
|
+
<th><%= sort_link(query, :supports_count, t("models.initiatives.fields.supports_count", scope: "decidim.admin"), default_order: :desc) %></th>
|
22
|
+
<th><%= sort_link(query, :created_at, t("models.initiatives.fields.created_at", scope: "decidim.admin"), default_order: :desc) %></th>
|
23
|
+
<th><%= sort_link(query, :published_at, t("models.initiatives.fields.published_at", scope: "decidim.admin"), default_order: :desc) %></th>
|
24
|
+
<th class="actions"><%= t ".actions_title" %></th>
|
25
|
+
</tr>
|
24
26
|
</thead>
|
25
27
|
<tbody>
|
26
|
-
|
28
|
+
<% @initiatives.each do |initiative| %>
|
27
29
|
<tr>
|
28
30
|
<td><%= initiative.id %></td>
|
29
31
|
<td>
|
@@ -46,7 +48,7 @@
|
|
46
48
|
class: "action-icon--preview",
|
47
49
|
target: "_blank" %>
|
48
50
|
<% else %>
|
49
|
-
|
51
|
+
<span class="action-space icon"></span>
|
50
52
|
<% end %>
|
51
53
|
|
52
54
|
<% if allowed_to? :edit, :initiative, initiative: initiative %>
|
@@ -55,7 +57,7 @@
|
|
55
57
|
t("actions.configure", scope: "decidim.admin"),
|
56
58
|
class: "action-icon--edit" %>
|
57
59
|
<% else %>
|
58
|
-
|
60
|
+
<span class="action-space icon"></span>
|
59
61
|
<% end %>
|
60
62
|
|
61
63
|
<% if allowed_to?(:answer, :initiative, initiative: initiative) %>
|
@@ -72,8 +74,9 @@
|
|
72
74
|
<% else %>
|
73
75
|
<span class="action-space icon"></span>
|
74
76
|
<% end %>
|
77
|
+
<%= free_resource_permissions_link(initiative) || content_tag(:span, nil, class: "action-space icon") %>
|
75
78
|
</td>
|
76
|
-
|
79
|
+
<% end %>
|
77
80
|
</tbody>
|
78
81
|
</table>
|
79
82
|
<%= paginate @initiatives, theme: "decidim" %>
|
@@ -177,4 +177,4 @@ rectificació, cancel·lació i oposició, tal com estableix l'article 5 de l'es
|
|
177
177
|
</p>
|
178
178
|
|
179
179
|
<a href="#" onclick="window.print();return false;" class="button expanded"><%= t ".print" %></a>
|
180
|
-
<%=
|
180
|
+
<%= stylesheet_pack_tag "decidim_initiatives_print", media: "all" %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% add_decidim_meta_tags({
|
2
|
-
image_url: current_initiative.type.banner_image.
|
2
|
+
image_url: current_initiative.type.attached_uploader(:banner_image).path,
|
3
3
|
description: translated_attribute(current_initiative.description),
|
4
4
|
title: translated_attribute(current_initiative.title),
|
5
5
|
url: initiative_url(current_initiative.id),
|
@@ -7,7 +7,7 @@
|
|
7
7
|
}) %>
|
8
8
|
|
9
9
|
<% add_decidim_page_title(translated_attribute(current_initiative.title)) %>
|
10
|
-
<% provide :meta_image_url, current_initiative.type.banner_image.
|
10
|
+
<% provide :meta_image_url, current_initiative.type.attached_uploader(:banner_image).path %>
|
11
11
|
|
12
12
|
<br><br>
|
13
13
|
<div class="row column">
|