Skip to content

Commit

Permalink
Merge pull request #52 from OpenSourcePolitics/develop
Browse files Browse the repository at this point in the history
Release develop > master
  • Loading branch information
luciegrau authored Aug 21, 2024
2 parents db99865 + 4650660 commit c4db7f0
Show file tree
Hide file tree
Showing 33 changed files with 5,432 additions and 3,484 deletions.
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ ENV RAILS_ENV=production \

RUN apt update && \
apt install -y postgresql-client imagemagick libproj-dev proj-bin libjemalloc2 && \
curl -sL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y nodejs && \
apt-get install -y npm && \
npm install --global yarn && \
gem install bundler:2.4.9

WORKDIR /app
Expand Down
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ gem "decidim", "~> #{DECIDIM_VERSION}.0"

# External Decidim gems
gem "decidim-cache_cleaner"
gem "decidim-decidim_awesome", "~> 0.9.1"
gem "decidim-decidim_awesome", git: "https://github.com/octree-gva/decidim-module-decidim_awesome.git", branch: "feat/awesome_decidim_private_fields"
gem "decidim-extra_user_fields", git: "https://github.com/OpenSourcePolitics/decidim-module-extra_user_fields.git", branch: DECIDIM_BRANCH
gem "decidim-friendly_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-friendly_signup.git"
gem "decidim-spam_detection"
gem "decidim-term_customizer", git: "https://github.com/opensourcepolitics/decidim-module-term_customizer.git", branch: "fix/multi-threading-compliant"
Expand All @@ -35,14 +36,14 @@ gem "nokogiri", "1.13.4"
gem "omniauth-rails_csrf_protection", "~> 1.0"
gem "puma", ">= 5.5.1"

gem "activerecord-session_store"
gem "letter_opener_web", "~> 1.3"
gem "rack-attack", "~> 6.6"
gem "ruby-progressbar"
gem "sidekiq", "~> 6.0"
gem "sidekiq_alive", "~> 2.2"
gem "sidekiq-scheduler", "~> 5.0"
gem "sys-filesystem"
gem "uglifier", "~> 4.1"

group :development do
gem "listen", "~> 3.1"
Expand Down
44 changes: 36 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
GIT
remote: https://github.com/OpenSourcePolitics/decidim-module-extra_user_fields.git
revision: 25f5a7843a38a5f9360f9bd42eb7e246d997bc7b
branch: release/0.27-stable
specs:
decidim-extra_user_fields (0.27.2)
country_select (~> 9.0)
decidim-core (>= 0.27.0, < 0.28)
deface (~> 1.5)

GIT
remote: https://github.com/OpenSourcePolitics/decidim-module-friendly_signup.git
revision: 1c91e024ae4467c097b39673e5d78b06afd206d1
specs:
decidim-friendly_signup (0.4.5)
decidim-core (~> 0.27)

GIT
remote: https://github.com/octree-gva/decidim-module-decidim_awesome.git
revision: afa824a79faa42f99eee5c0dcb4944e3a78b4a1d
branch: feat/awesome_decidim_private_fields
specs:
decidim-decidim_awesome (0.9.2)
decidim-admin (>= 0.26.0, < 0.28)
decidim-core (>= 0.26.0, < 0.28)
sassc (~> 2.3)

GIT
remote: https://github.com/opensourcepolitics/decidim-module-term_customizer.git
revision: 8a6b73e58fbdd7f38daf983a310d37c510ec9baf
Expand Down Expand Up @@ -79,6 +99,13 @@ GEM
activerecord (6.1.7.7)
activemodel (= 6.1.7.7)
activesupport (= 6.1.7.7)
activerecord-session_store (2.1.0)
actionpack (>= 6.1)
activerecord (>= 6.1)
cgi (>= 0.3.6)
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 4)
railties (>= 6.1)
activestorage (6.1.7.7)
actionpack (= 6.1.7.7)
activejob (= 6.1.7.7)
Expand Down Expand Up @@ -171,6 +198,7 @@ GEM
cells-rails (0.1.5)
actionpack (>= 5.0)
cells (>= 4.1.6, < 5.0.0)
cgi (0.4.1)
charlock_holmes (0.7.7)
chef-utils (18.4.2)
concurrent-ruby
Expand All @@ -188,6 +216,10 @@ GEM
commonmarker (0.23.10)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
countries (6.0.1)
unaccent (~> 0.3)
country_select (9.0.0)
countries (> 5.0, < 7.0)
crack (1.0.0)
bigdecimal
rexml
Expand Down Expand Up @@ -304,10 +336,6 @@ GEM
decidim-debates (0.27.5)
decidim-comments (= 0.27.5)
decidim-core (= 0.27.5)
decidim-decidim_awesome (0.9.3)
decidim-admin (>= 0.26.0, < 0.28)
decidim-core (>= 0.26.0, < 0.28)
sassc (~> 2.3)
decidim-dev (0.27.5)
axe-core-rspec (~> 4.1.0)
byebug (~> 11.0)
Expand Down Expand Up @@ -874,8 +902,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uber (0.1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unaccent (0.4.0)
unicode-display_width (2.5.0)
uri (0.13.0)
valid_email2 (2.3.1)
Expand Down Expand Up @@ -935,6 +962,7 @@ PLATFORMS

DEPENDENCIES
activejob-uniqueness
activerecord-session_store
aws-sdk-s3
bootsnap (~> 1.4)
brakeman (~> 5.1)
Expand All @@ -943,8 +971,9 @@ DEPENDENCIES
dalli
decidim (~> 0.27.0)
decidim-cache_cleaner
decidim-decidim_awesome (~> 0.9.1)
decidim-decidim_awesome!
decidim-dev (~> 0.27.0)
decidim-extra_user_fields!
decidim-friendly_signup!
decidim-spam_detection
decidim-term_customizer!
Expand Down Expand Up @@ -975,7 +1004,6 @@ DEPENDENCIES
spring (~> 2.0)
spring-watcher-listen (~> 2.0)
sys-filesystem
uglifier (~> 4.1)
web-console (= 4.0.4)

RUBY VERSION
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# frozen_string_literal: true

require "active_support/concern"

module Decidim
module ExtraUserFields
# Changes in methods to store extra fields in user profile
module CreateRegistrationsCommandsOverrides
extend ActiveSupport::Concern

def call
return broadcast(:invalid) if same_email_representative?

if form.invalid?

user = User.has_pending_invitations?(form.current_organization.id, form.email)
user.invite!(user.invited_by) if user
return broadcast(:invalid)
end

create_user
send_email_to_statutory_representative

broadcast(:ok, @user)
rescue ActiveRecord::RecordInvalid
broadcast(:invalid)
end

private

def create_user
@user = User.create!(
email: form.email,
name: form.name,
nickname: form.nickname,
password: form.password,
password_confirmation: form.password_confirmation,
password_updated_at: Time.current,
organization: form.current_organization,
tos_agreement: form.tos_agreement,
newsletter_notifications_at: form.newsletter_at,
accepted_tos_version: form.current_organization.tos_version,
locale: form.current_locale,
extended_data: extended_data
)
end

def extended_data
@extended_data ||= (@user&.extended_data || {}).merge(
country: form.country,
postal_code: form.postal_code,
date_of_birth: form.date_of_birth,
gender: form.gender,
phone_number: form.phone_number,
location: form.location,
underage: form.underage,
statutory_representative_email: form.statutory_representative_email
)
end

def send_email_to_statutory_representative
return if form.statutory_representative_email.blank? || !form.underage

Decidim::ExtraUserFields::StatutoryRepresentativeMailer.inform(@user).deliver_now
end

def same_email_representative?
return false if form.statutory_representative_email.blank?

form.statutory_representative_email == form.email
end
end
end
end
141 changes: 141 additions & 0 deletions app/views/decidim/proposals/proposals/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<%
add_decidim_meta_tags({
description: present(@proposal).body,
title: present(@proposal).title,
url: proposal_url(@proposal.id)
})
%>
<%
edit_link(
resource_locator(@proposal).edit,
:edit,
:proposal,
proposal: @proposal
)
%>
<%
extra_admin_link(
resource_locator(@proposal).show(anchor: "proposal-answer"),
:create,
:proposal_answer,
{ proposal: @proposal },
{ name: t(".answer"), icon: "comment-square" }
)
%>
<%= render partial: "voting_rules" %>
<% if component_settings.participatory_texts_enabled? %>
<div class="row column">
<div class="section text-medium">
<%= t(".back_to") %> <u><%= link_to translated_attribute(@participatory_text.title), main_component_path(current_component) %></u>
</div>
</div>
<% end %>
<%= emendation_announcement_for @proposal %>
<div class="row column view-header">

<div class="m-bottom">
<%= link_to proposals_path, class: "small hollow js-back-to-list" do %>
<%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
<%= t(".back_to_list") %>
<% end %>
</div>

<% if @proposal.emendation? %>
<h2 class="heading3"><%= t(".changes_at_title", title: present(@proposal.amendable).title(links: true, html_escape: true)) %></h2>
<% else %>
<h2 class="heading3"><%= present(@proposal).title(links: true, html_escape: true) %></h2>
<% end %>
<% unless component_settings.participatory_texts_enabled? %>
<%= cell("decidim/coauthorships", @proposal, has_actions: true, size: 3, context: { current_user: current_user }) %>
<% end %>
</div>
<div class="row">
<div class="columns mediumlarge-8 large-9">
<div class="section">
<% if @proposal.emendation? %>
<%= cell("decidim/diff", proposal_presenter.versions.last) %>
<% elsif not ["section","subsection"].include? @proposal.participatory_text_level %>
<%== cell("decidim/proposals/proposal_m", @proposal, full_badge: true).badge %>
<%= render_proposal_body(@proposal) %>
<% end %>
<% if component_settings.geocoding_enabled? %>
<%= render partial: "decidim/shared/static_map", locals: { icon_name: "proposals", geolocalizable: @proposal } %>
<% end %>
<% if proposal_has_costs? && current_settings.answers_with_costs? %>
<%= cell("decidim/proposals/cost_report", @proposal) %>
<% end %>
</div>

<%= cell("decidim/announcement", proposal_reason_callout_announcement, callout_class: proposal_reason_callout_class) if @proposal.answered? && @proposal.published_state? %>
<%= linked_resources_for @proposal, :results, "included_proposals" %>
<%= linked_resources_for @proposal, :projects, "included_proposals" %>
<%= linked_resources_for @proposal, :meetings, "proposals_from_meeting" %>
<%= linked_resources_for @proposal, :proposals, "copied_from_component" %>
<%= amendments_for @proposal %>
</div>
<div class="columns section view-side mediumlarge-4 large-3">
<% if @proposal.amendable? && allowed_to?(:edit, :proposal, proposal: @proposal) %>
<%= link_to t(".edit_proposal"), edit_proposal_path(@proposal), class: "button hollow expanded button--sc" %>
<% else %>
<%= amend_button_for @proposal %>
<% end %>
<%= emendation_actions_for @proposal %>
<% if current_settings.votes_enabled? || show_endorsements_card? || current_user %>
<% if @proposal.withdrawn? %>
<div class="card">
<div class="card__content">
<% if current_settings.votes_enabled? %>
<%= render partial: "votes_count", locals: { proposal: @proposal, from_proposals_list: false } %>
<% end %>
</div>
</div>
<% else %>
<div class="card">
<div class="card__content">
<% if current_settings.votes_enabled? %>
<%= render partial: "votes_count", locals: { proposal: @proposal, from_proposals_list: false } %>
<%= render partial: "vote_button", locals: { proposal: @proposal, from_proposals_list: false } %>
<% end %>
<div class="row collapse buttons__row">
<% if endorsements_enabled? %>
<div class="column small-9 collapse">
<%= endorsement_buttons_cell(@proposal) %>
</div>
<% end %>
<div class="column collapse <%= endorsements_enabled? ? "small-3" : "" %>">
<%= link_to "#comments", class: "button small compact hollow secondary button--nomargin expanded" do %>
<span class="show-for-sr"><%= present(@proposal).title(html_escape: true) %></span>
<%= icon "comment-square", class: "icon--small", aria_label: t(".comments"), role: "img" %> <%= @proposal.comments_count %>
<% end %>
</div>
</div>
<br>
<%= follow_button_for(@proposal) %>
</div>
</div>
<% end %>
<% end %>
<%= amenders_list_for(@proposal) %>
<%= resource_reference(@proposal) %>
<%= resource_version(proposal_presenter, versions_path: proposal_versions_path(@proposal)) %>
<%= cell("decidim/fingerprint", @proposal) %>
<%= render partial: "decidim/shared/share_modal", locals: { resource: @proposal } %>
<%= embed_modal_for proposal_widget_url(@proposal, format: :js) %>
<%= cell "decidim/proposals/proposal_link_to_collaborative_draft", @proposal %>
<%= cell "decidim/proposals/proposal_link_to_rejected_emendation", @proposal %>
</div>
</div>
<%= attachments_for @proposal %>
<%= comments_for @proposal %>
<%= cell("decidim/flag_modal", @proposal) %>
7 changes: 7 additions & 0 deletions app/views/layouts/decidim/_head.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
<%= invisible_captcha_styles %>
<%= organization_colors %>
<%= javascript_pack_tag "decidim_core", defer: false %>
<%= javascript_pack_tag "decidim_admin", defer: false %>
<%= render partial: "layouts/decidim/head_extra" %>
<%== current_organization.header_snippets if Decidim.enable_html_header_snippets %>
Expand All @@ -34,3 +36,8 @@
<%= stylesheet_pack_tag "decidim_decidim_awesome", media: "all" %>
<%= render(partial: "layouts/decidim/decidim_awesome/custom_styles") if awesome_custom_styles %>
<%= javascript_pack_tag "decidim_decidim_awesome_custom_fields" if awesome_proposal_custom_fields %>
<%= render partial: "layouts/decidim/decidim_awesome/awesome_config" %>

Loading

0 comments on commit c4db7f0

Please sign in to comment.