decidim-proposals 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/config/admin/decidim_proposals_manifest.js +1 -0
- data/app/assets/images/decidim/gamification/badges/accepted_proposals.svg +1 -234
- data/app/assets/images/decidim/gamification/badges/proposal_votes.svg +1 -95
- data/app/assets/images/decidim/gamification/badges/proposals.svg +1 -229
- data/app/assets/images/decidim/proposals/icon.svg +1 -3
- data/app/assets/javascripts/decidim/proposals/admin/proposals_form.js.es6 +0 -5
- data/app/assets/javascripts/decidim/proposals/admin/proposals_picker.js.es6 +35 -0
- data/app/cells/decidim/proposals/collaborative_draft_link_to_proposal_cell.rb +1 -1
- data/app/cells/decidim/proposals/collaborative_draft_m/footer.erb +1 -1
- data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +1 -1
- data/app/cells/decidim/proposals/highlighted_proposals_for_component/show.erb +3 -3
- data/app/cells/decidim/proposals/highlighted_proposals_for_component_cell.rb +1 -1
- data/app/cells/decidim/proposals/irreversible_action_modal/show.erb +2 -2
- data/app/cells/decidim/proposals/irreversible_action_modal_cell.rb +1 -1
- data/app/cells/decidim/proposals/participatory_text_proposal/buttons.erb +1 -1
- data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +1 -1
- data/app/cells/decidim/proposals/proposal_m/footer.erb +4 -1
- data/app/cells/decidim/proposals/proposal_m_cell.rb +28 -8
- data/app/cells/decidim/proposals/proposal_tags/show.erb +8 -2
- data/app/cells/decidim/proposals/proposals_picker/proposals.erb +12 -0
- data/app/cells/decidim/proposals/proposals_picker/show.erb +14 -0
- data/app/cells/decidim/proposals/proposals_picker_cell.rb +72 -0
- data/app/commands/decidim/proposals/admin/create_proposal.rb +1 -1
- data/app/commands/decidim/proposals/admin/create_proposal_note.rb +15 -0
- data/app/commands/decidim/proposals/admin/update_proposal.rb +1 -1
- data/app/commands/decidim/proposals/create_collaborative_draft.rb +1 -1
- data/app/commands/decidim/proposals/create_proposal.rb +1 -1
- data/app/commands/decidim/proposals/gallery_methods.rb +2 -51
- data/app/commands/decidim/proposals/update_proposal.rb +1 -1
- data/app/controllers/concerns/decidim/proposals/admin/picker.rb +21 -0
- data/app/controllers/concerns/decidim/proposals/orderable.rb +1 -1
- data/app/controllers/decidim/proposals/proposals_controller.rb +4 -5
- data/app/controllers/decidim/proposals/versions_controller.rb +8 -18
- data/app/events/decidim/proposals/admin/proposal_note_created_event.rb +27 -0
- data/app/forms/decidim/proposals/admin/participatory_text_proposal_form.rb +13 -0
- data/app/forms/decidim/proposals/admin/preview_participatory_text_form.rb +2 -2
- data/app/forms/decidim/proposals/admin/proposal_base_form.rb +129 -0
- data/app/forms/decidim/proposals/admin/proposal_form.rb +2 -120
- data/app/forms/decidim/proposals/proposal_form.rb +4 -0
- data/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb +5 -1
- data/app/helpers/decidim/proposals/admin/filterable_helper.rb +2 -2
- data/app/helpers/decidim/proposals/admin/proposal_rankings_helper.rb +2 -2
- data/app/helpers/decidim/proposals/admin/proposals_picker_helper.rb +30 -0
- data/app/helpers/decidim/proposals/application_helper.rb +6 -6
- data/app/helpers/decidim/proposals/control_version_helper.rb +1 -37
- data/app/helpers/decidim/proposals/proposal_endorsements_helper.rb +0 -145
- data/app/helpers/decidim/proposals/proposal_votes_helper.rb +2 -2
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +24 -7
- data/app/helpers/decidim/proposals/proposals_helper.rb +6 -0
- data/app/models/decidim/proposals/proposal.rb +4 -14
- data/app/permissions/decidim/proposals/permissions.rb +1 -22
- data/app/presenters/decidim/proposals/proposal_presenter.rb +14 -2
- data/app/queries/decidim/proposals/metrics/accepted_proposals_metric_manage.rb +1 -2
- data/app/queries/decidim/proposals/metrics/endorsements_metric_manage.rb +15 -12
- data/app/queries/decidim/proposals/metrics/proposal_participants_metric_measure.rb +5 -4
- data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +2 -8
- data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +3 -9
- data/app/services/decidim/proposals/diff_renderer.rb +2 -0
- data/app/services/decidim/proposals/proposal_builder.rb +1 -1
- data/app/services/decidim/proposals/proposal_search.rb +2 -2
- data/app/types/decidim/proposals/proposal_input_sort.rb +1 -7
- data/app/types/decidim/proposals/proposal_type.rb +1 -11
- data/app/types/decidim/proposals/proposals_type.rb +10 -0
- data/app/validators/proposal_length_validator.rb +38 -0
- data/app/views/decidim/proposals/admin/participatory_texts/index.html.erb +9 -1
- data/app/views/decidim/proposals/admin/proposal_notes/_proposal_notes.html.erb +2 -2
- data/app/views/decidim/proposals/admin/proposals/_form.html.erb +3 -23
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/show.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +6 -4
- data/app/views/decidim/proposals/collaborative_drafts/_filters.html.erb +9 -7
- data/app/views/decidim/proposals/collaborative_drafts/_new_collaborative_draft_button.html.erb +4 -4
- data/app/views/decidim/proposals/collaborative_drafts/_reject_request_access_form.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +4 -2
- data/app/views/decidim/proposals/collaborative_drafts/compare.html.erb +2 -0
- data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +2 -0
- data/app/views/decidim/proposals/collaborative_drafts/edit.html.erb +3 -1
- data/app/views/decidim/proposals/collaborative_drafts/index.html.erb +4 -2
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +4 -0
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +29 -30
- data/app/views/decidim/proposals/proposals/_edit_form_fields.html.erb +5 -3
- data/app/views/decidim/proposals/proposals/_endorsements_card_row.html.erb +0 -16
- data/app/views/decidim/proposals/proposals/_filters.html.erb +12 -10
- data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +1 -11
- data/app/views/decidim/proposals/proposals/_proposal_similar.html.erb +2 -2
- data/app/views/decidim/proposals/proposals/_proposals.html.erb +14 -0
- data/app/views/decidim/proposals/proposals/_vote_button.html.erb +13 -6
- data/app/views/decidim/proposals/proposals/_wizard_aside.html.erb +4 -2
- data/app/views/decidim/proposals/proposals/_wizard_header.html.erb +4 -3
- data/app/views/decidim/proposals/proposals/compare.html.erb +2 -0
- data/app/views/decidim/proposals/proposals/complete.html.erb +2 -0
- data/app/views/decidim/proposals/proposals/edit.html.erb +3 -1
- data/app/views/decidim/proposals/proposals/edit_draft.html.erb +2 -0
- data/app/views/decidim/proposals/proposals/index.html.erb +5 -10
- data/app/views/decidim/proposals/proposals/new.html.erb +5 -1
- data/app/views/decidim/proposals/proposals/participatory_texts/_index.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +10 -3
- data/app/views/decidim/proposals/proposals/participatory_texts/_view_index.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/preview.html.erb +7 -8
- data/app/views/decidim/proposals/proposals/show.html.erb +52 -34
- data/app/views/decidim/proposals/versions/index.html.erb +14 -32
- data/app/views/decidim/proposals/versions/show.html.erb +16 -34
- data/config/locales/ar.yml +8 -64
- data/config/locales/bg-BG.yml +237 -0
- data/config/locales/ca.yml +68 -61
- data/config/locales/cs.yml +78 -68
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/de.yml +142 -58
- data/config/locales/el.yml +875 -0
- data/config/locales/en.yml +74 -67
- data/config/locales/es-MX.yml +68 -61
- data/config/locales/es-PY.yml +68 -61
- data/config/locales/es.yml +68 -61
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/eu.yml +5 -43
- data/config/locales/fi-plain.yml +68 -61
- data/config/locales/fi.yml +109 -102
- data/config/locales/fr-CA.yml +876 -0
- data/config/locales/fr.yml +128 -60
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +5 -43
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hu.yml +38 -61
- data/config/locales/id-ID.yml +5 -42
- data/config/locales/is-IS.yml +1 -27
- data/config/locales/it.yml +136 -76
- data/config/locales/ja-JP.yml +886 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lv-LV.yml +858 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/nl.yml +114 -59
- data/config/locales/no.yml +11 -64
- data/config/locales/pl.yml +170 -60
- data/config/locales/pt-BR.yml +6 -47
- data/config/locales/pt.yml +419 -331
- data/config/locales/ro-RO.yml +840 -0
- data/config/locales/ru.yml +1 -40
- data/config/locales/sk-SK.yml +896 -0
- data/config/locales/sk.yml +869 -0
- data/config/locales/sl.yml +26 -0
- data/config/locales/sr-CS.yml +126 -0
- data/config/locales/sv.yml +228 -156
- data/config/locales/tr-TR.yml +5 -43
- data/config/locales/uk.yml +1 -40
- data/db/migrate/20181003074440_fix_user_groups_ids_in_proposals_endorsements.rb +4 -0
- data/db/migrate/20191206154128_add_endorsements_counter_cache_to_proposals.rb +7 -0
- data/db/migrate/20200120215928_move_proposal_endorsements_to_core_endorsements.rb +52 -0
- data/db/migrate/20200730131631_move_proposal_endorsed_event_notifications_to_resource_endorsed_event.rb +20 -0
- data/lib/decidim/proposals/component.rb +8 -4
- data/lib/decidim/proposals/engine.rb +1 -5
- data/lib/decidim/proposals/test/capybara_proposals_picker.rb +49 -0
- data/lib/decidim/proposals/test/factories.rb +3 -12
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +55 -34
- data/app/assets/javascripts/decidim/proposals/identity_selector_dialog.js.es6 +0 -56
- data/app/cells/decidim/proposals/endorsers_list/show.erb +0 -17
- data/app/cells/decidim/proposals/endorsers_list_cell.rb +0 -31
- data/app/commands/decidim/proposals/attachment_methods.rb +0 -43
- data/app/commands/decidim/proposals/endorse_proposal.rb +0 -59
- data/app/commands/decidim/proposals/unendorse_proposal.rb +0 -40
- data/app/controllers/decidim/proposals/proposal_endorsements_controller.rb +0 -60
- data/app/models/decidim/proposals/proposal_endorsement.rb +0 -37
- data/app/views/decidim/proposals/proposal_endorsements/_identity.html.erb +0 -9
- data/app/views/decidim/proposals/proposal_endorsements/identities.html.erb +0 -12
- data/app/views/decidim/proposals/proposal_endorsements/update_buttons_and_counters.js.erb +0 -20
- data/app/views/decidim/proposals/proposals/_endorsement_button.html.erb +0 -11
- data/app/views/decidim/proposals/proposals/_endorsement_identities_cabin.html.erb +0 -13
- data/app/views/decidim/proposals/versions/_version.html.erb +0 -20
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Proposals
|
5
|
-
# A module with all the attachment common methods for proposals
|
6
|
-
# and collaborative draft commands.
|
7
|
-
module AttachmentMethods
|
8
|
-
private
|
9
|
-
|
10
|
-
def build_attachment
|
11
|
-
@attachment = Attachment.new(
|
12
|
-
title: @form.attachment.title,
|
13
|
-
file: @form.attachment.file,
|
14
|
-
attached_to: @attached_to
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
def attachment_invalid?
|
19
|
-
if attachment.invalid? && attachment.errors.has_key?(:file)
|
20
|
-
@form.attachment.errors.add :file, attachment.errors[:file]
|
21
|
-
true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def attachment_present?
|
26
|
-
@form.attachment.file.present?
|
27
|
-
end
|
28
|
-
|
29
|
-
def create_attachment
|
30
|
-
attachment.attached_to = @attached_to
|
31
|
-
attachment.save!
|
32
|
-
end
|
33
|
-
|
34
|
-
def attachments_allowed?
|
35
|
-
@form.current_component.settings.attachments_allowed?
|
36
|
-
end
|
37
|
-
|
38
|
-
def process_attachments?
|
39
|
-
attachments_allowed? && attachment_present?
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Proposals
|
5
|
-
# A command with all the business logic when a user endorses a proposal.
|
6
|
-
class EndorseProposal < Rectify::Command
|
7
|
-
# Public: Initializes the command.
|
8
|
-
#
|
9
|
-
# proposal - A Decidim::Proposals::Proposal object.
|
10
|
-
# current_user - The current user.
|
11
|
-
# current_group_id- (optional) The current_grup that is endorsing the Proposal.
|
12
|
-
def initialize(proposal, current_user, current_group_id = nil)
|
13
|
-
@proposal = proposal
|
14
|
-
@current_user = current_user
|
15
|
-
@current_group_id = current_group_id
|
16
|
-
end
|
17
|
-
|
18
|
-
# Executes the command. Broadcasts these events:
|
19
|
-
#
|
20
|
-
# - :ok when everything is valid, together with the proposal vote.
|
21
|
-
# - :invalid if the form wasn't valid and we couldn't proceed.
|
22
|
-
#
|
23
|
-
# Returns nothing.
|
24
|
-
def call
|
25
|
-
endorsement = build_proposal_endorsement
|
26
|
-
if endorsement.save
|
27
|
-
notify_endorser_followers
|
28
|
-
broadcast(:ok, endorsement)
|
29
|
-
else
|
30
|
-
broadcast(:invalid)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def build_proposal_endorsement
|
37
|
-
endorsement = @proposal.endorsements.build(author: @current_user)
|
38
|
-
endorsement.user_group = user_groups.find(@current_group_id) if @current_group_id.present?
|
39
|
-
endorsement
|
40
|
-
end
|
41
|
-
|
42
|
-
def user_groups
|
43
|
-
Decidim::UserGroups::ManageableUserGroups.for(@current_user).verified
|
44
|
-
end
|
45
|
-
|
46
|
-
def notify_endorser_followers
|
47
|
-
Decidim::EventsManager.publish(
|
48
|
-
event: "decidim.events.proposals.proposal_endorsed",
|
49
|
-
event_class: Decidim::Proposals::ProposalEndorsedEvent,
|
50
|
-
resource: @proposal,
|
51
|
-
followers: @current_user.followers,
|
52
|
-
extra: {
|
53
|
-
endorser_id: @current_user.id
|
54
|
-
}
|
55
|
-
)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Proposals
|
5
|
-
# A command with all the business logic when a user or organization unendorses a proposal.
|
6
|
-
class UnendorseProposal < Rectify::Command
|
7
|
-
# Public: Initializes the command.
|
8
|
-
#
|
9
|
-
# proposal - A Decidim::Proposals::Proposal object.
|
10
|
-
# current_user - The current user.
|
11
|
-
# current_group- (optional) The current_group that is unendorsing from the Proposal.
|
12
|
-
def initialize(proposal, current_user, current_group = nil)
|
13
|
-
@proposal = proposal
|
14
|
-
@current_user = current_user
|
15
|
-
@current_group = current_group
|
16
|
-
end
|
17
|
-
|
18
|
-
# Executes the command. Broadcasts these events:
|
19
|
-
#
|
20
|
-
# - :ok when everything is valid, together with the proposal.
|
21
|
-
# - :invalid if the form wasn't valid and we couldn't proceed.
|
22
|
-
#
|
23
|
-
# Returns nothing.
|
24
|
-
def call
|
25
|
-
destroy_proposal_endorsement
|
26
|
-
broadcast(:ok, @proposal)
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
def destroy_proposal_endorsement
|
32
|
-
query = @proposal.endorsements.where(
|
33
|
-
author: @current_user,
|
34
|
-
decidim_user_group_id: @current_group&.id
|
35
|
-
)
|
36
|
-
query.destroy_all
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Proposals
|
5
|
-
# Exposes the proposal endorsement resource so that users can endorse proposals.
|
6
|
-
class ProposalEndorsementsController < Decidim::Proposals::ApplicationController
|
7
|
-
helper_method :proposal
|
8
|
-
|
9
|
-
before_action :authenticate_user!
|
10
|
-
|
11
|
-
def create
|
12
|
-
enforce_permission_to :endorse, :proposal, proposal: proposal
|
13
|
-
@from_proposals_list = params[:from_proposals_list] == "true"
|
14
|
-
user_group_id = params[:user_group_id]
|
15
|
-
|
16
|
-
EndorseProposal.call(proposal, current_user, user_group_id) do
|
17
|
-
on(:ok) do
|
18
|
-
proposal.reload
|
19
|
-
render :update_buttons_and_counters
|
20
|
-
end
|
21
|
-
|
22
|
-
on(:invalid) do
|
23
|
-
render json: { error: I18n.t("proposal_endorsements.create.error", scope: "decidim.proposals") }, status: :unprocessable_entity
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def destroy
|
29
|
-
enforce_permission_to :unendorse, :proposal, proposal: proposal
|
30
|
-
@from_proposals_list = params[:from_proposals_list] == "true"
|
31
|
-
user_group_id = params[:user_group_id]
|
32
|
-
user_group = user_groups.find(user_group_id) if user_group_id
|
33
|
-
|
34
|
-
UnendorseProposal.call(proposal, current_user, user_group) do
|
35
|
-
on(:ok) do
|
36
|
-
proposal.reload
|
37
|
-
render :update_buttons_and_counters
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def identities
|
43
|
-
enforce_permission_to :endorse, :proposal, proposal: proposal
|
44
|
-
|
45
|
-
@user_verified_groups = Decidim::UserGroups::ManageableUserGroups.for(current_user).verified
|
46
|
-
render :identities, layout: false
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def user_groups
|
52
|
-
Decidim::UserGroups::ManageableUserGroups.for(current_user).verified
|
53
|
-
end
|
54
|
-
|
55
|
-
def proposal
|
56
|
-
@proposal ||= Proposal.where(component: current_component).find(params[:proposal_id])
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Proposals
|
5
|
-
# A proposal can include an endorsement per user or group.
|
6
|
-
class ProposalEndorsement < ApplicationRecord
|
7
|
-
include Decidim::Authorable
|
8
|
-
|
9
|
-
belongs_to :proposal, foreign_key: "decidim_proposal_id", class_name: "Decidim::Proposals::Proposal", counter_cache: true
|
10
|
-
|
11
|
-
validates :proposal, uniqueness: { scope: [:author, :user_group] }
|
12
|
-
validate :author_and_proposal_same_organization
|
13
|
-
validate :proposal_not_rejected
|
14
|
-
|
15
|
-
scope :for_listing, -> { order(:decidim_user_group_id, :created_at) }
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def organization
|
20
|
-
proposal&.component&.organization
|
21
|
-
end
|
22
|
-
|
23
|
-
# Private: check if the proposal and the author have the same organization
|
24
|
-
def author_and_proposal_same_organization
|
25
|
-
return if !proposal || !author
|
26
|
-
|
27
|
-
errors.add(:proposal, :invalid) unless author.organization == proposal.organization
|
28
|
-
end
|
29
|
-
|
30
|
-
def proposal_not_rejected
|
31
|
-
return unless proposal
|
32
|
-
|
33
|
-
errors.add(:proposal, :invalid) if proposal.rejected?
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<li class="<%= selected ? "selected" : "" %>" data-method="<%= http_method.to_s.upcase %>" data-url="<%= current_endorsement_url %>">
|
2
|
-
<div class="author-data author-data--small">
|
3
|
-
<div class="author-data__main">
|
4
|
-
<%== cell("decidim/author", identity, skip_profile_link: true).profile %>
|
5
|
-
</div>
|
6
|
-
</div>
|
7
|
-
|
8
|
-
<%= icon("circle-check", class: "icon--big #{selected ? '' : 'invisible'}") %>
|
9
|
-
</li>
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<div class="reveal__header reveal__header--nomargin reveal__bg p-s">
|
2
|
-
<h6 class="heading6 m-none"><%= t ".select_identity" %></h6>
|
3
|
-
</div>
|
4
|
-
<ul class="reveal__list">
|
5
|
-
<%= render_endorsement_identity(proposal, current_user) %>
|
6
|
-
<% @user_verified_groups.each do |user_group| %>
|
7
|
-
<%= render_endorsement_identity(proposal, current_user, user_group) %>
|
8
|
-
<% end %>
|
9
|
-
</ul>
|
10
|
-
<div class="reveal__footer reveal__bg text-right p-s">
|
11
|
-
<button class="button button--nomargin button--sc" type="button" data-close><%= t(".done") %></button>
|
12
|
-
</div>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<% if Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.empty? %>
|
2
|
-
update_main_page_button();
|
3
|
-
<% end %>
|
4
|
-
update_identities_rows();
|
5
|
-
|
6
|
-
function update_main_page_button() {
|
7
|
-
var $proposalEndorsementButton = $('#proposal-<%= proposal.id %>-endorsement-button');
|
8
|
-
morphdom($proposalEndorsementButton[0], '<%= j(endorsement_button(proposal, false)).strip.html_safe %>');
|
9
|
-
}
|
10
|
-
function update_identities_rows() {
|
11
|
-
<% fully_endorsed= fully_endorsed?(proposal, current_user) %>
|
12
|
-
var $proposalEndorsementsRowCount = $('#proposal-<%= proposal.id %>-endorsements-count');
|
13
|
-
morphdom($proposalEndorsementsRowCount[0], '<%= j(render_endorsements_count_card_part(proposal, fully_endorsed)).strip.html_safe %>');
|
14
|
-
var $proposalEndorsementsRowButton = $($('#select-identity-button')[0]);
|
15
|
-
<% if fully_endorsed %>
|
16
|
-
$proposalEndorsementsRowButton.addClass('success')
|
17
|
-
<% else %>
|
18
|
-
$proposalEndorsementsRowButton.removeClass('success')
|
19
|
-
<% end %>
|
20
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<div id="proposal-<%= proposal.id %>-endorsement-button<%= user_group&.id ? "-#{user_group.id}" : "" %>">
|
2
|
-
<% if !current_user %>
|
3
|
-
<%= action_authorized_button_to :endorse, endorse_label, current_endorsement_url, resource: proposal, class: "button #{endorsement_button_classes(from_proposals_list)} secondary" %>
|
4
|
-
<% else %>
|
5
|
-
<% if proposal.endorsed_by?(current_user, user_group) %>
|
6
|
-
<%= action_authorized_button_to :endorse, unendorse_label, current_endorsement_url, resource: proposal, method: :delete, remote: true, class: "button #{endorsement_button_classes(from_proposals_list)} success", id: "endorsement_button" %>
|
7
|
-
<% else %>
|
8
|
-
<%= action_authorized_button_to :endorse, endorse_label, current_endorsement_url, resource: proposal, remote: true, data: {}, class: "button #{endorsement_button_classes(from_proposals_list)} secondary" %>
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
11
|
-
</div>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<%= javascript_include_tag "decidim/proposals/identity_selector_dialog" %>
|
2
|
-
<% if current_user && Decidim::UserGroups::ManageableUserGroups.for(current_user).verified.any? %>
|
3
|
-
<button id="select-identity-button" type="button" name="button" class="button small compact light button--sc <%= fully_endorsed ? "success": "secondary" %>">
|
4
|
-
<%= t(".endorse") %>
|
5
|
-
</button>
|
6
|
-
|
7
|
-
<div class="reveal collapse"
|
8
|
-
id="user-identities"
|
9
|
-
data-reveal data-refresh-url="<%= identities_proposal_proposal_endorsement_path(proposal) %>">
|
10
|
-
</div>
|
11
|
-
<% else %>
|
12
|
-
<%= endorsement_button(proposal, false) %>
|
13
|
-
<% end %>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<div class="card--list__item">
|
2
|
-
<div class="card--list__text">
|
3
|
-
<div>
|
4
|
-
<%= link_to resource_version_path(index) do %>
|
5
|
-
<h6 class="card--list__heading heading6">
|
6
|
-
<%= t(".version_index", index: index + 1) %>
|
7
|
-
</h6>
|
8
|
-
<% end %>
|
9
|
-
<div class="author-data">
|
10
|
-
<%= render_resource_editor(version) %>
|
11
|
-
<%= l version.created_at, format: :decidim_short %>
|
12
|
-
</div>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
<div class="card--list__data">
|
16
|
-
<%= link_to resource_version_path(index), class: "card--list__data__icon" do %>
|
17
|
-
<%= icon "chevron-right" %>
|
18
|
-
<% end %>
|
19
|
-
</div>
|
20
|
-
</div>
|