Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ahukkanen committed Sep 26, 2023
2 parents aad56f6 + ce8dc71 commit d8733fe
Show file tree
Hide file tree
Showing 66 changed files with 878 additions and 532 deletions.
40 changes: 16 additions & 24 deletions app/cells/decidim/plans/plan_add_authors/show.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,28 @@
<div class="columns large-12">
<div class="expanded">
<div class="wrapper wrapper--inner">
<div class="row">
<div class="large-12">
<p class="h2"> <%= t(".modal_title") %></p>
</div>
</div>
<div class="row">
<div class="row columns mentions__container">
<label for="add_plan_authors"><%= t(".label") %></label>
<input id="add_plan_authors" type="text"
class="js-multiple-mentions mentions__container"
placeholder="<%= t(".add_users_placeholder") %>"
data-noresults="<%= t(".no_results") %>"
data-tribute="yes"
contenteditable="true">
</div>
<div class="columns large-12">
<div class="js-multiple-mentions-recipients"></div>
</div>
<p class="h2"> <%= t(".modal_title") %></p>

<div class="multiple-mentions" data-name="recipient_id[]" data-multiple="true">
<label for="add_plan_authors"><%= t(".label") %></label>
<input id="add_plan_authors" type="text"
spellcheck="false"
autocomplete="off"
placeholder="<%= t(".add_users_placeholder") %>"
data-noresults="<%= t(".no_results") %>"
contenteditable="true"
data-selected="multiple-mentions-selected"
aria-expanded="false">
</div>

<ul class="multiple-mentions-selected"></ul>
</div>
</div>
</div>
</div>
<div class="wrapper wrapper--inner">
<div class="row">
<div class="large-12">
<div class="button--double form-general-submit float-right">
<%= f.submit t(".next") %>
</div>
</div>
<div class="button--double form-general-submit float-right">
<%= f.submit t(".next") %>
</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion app/cells/decidim/plans/plan_form/buttons.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if user_signed_in? %>
<% if user_signed_in? && user_public? %>
<div class="actions text-center">
<div class="form-submit-message text-center hide">
<div class="loading-spinner"></div>
Expand All @@ -17,6 +17,8 @@
<%= form.submit t(".buttons.save"), class: "button large primary", data: { disable: true } %>
<% end %>
</div>
<% elsif user_signed_in? %>
<%= render :profile_publicity_box %>
<% else %>
<%= render :sign_in_box %>
<% end %>
20 changes: 0 additions & 20 deletions app/cells/decidim/plans/plan_form/contents_edit.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,3 @@
<%= content_form.hidden_field :section_id %>
<% end %>
<% end %>
<%
js_options = {
messages: {
charactersMin: t(".characters_min"),
charactersUsed: t(".characters_used")
}
}
%>
<script>
document.addEventListener("DOMContentLoaded", () => {
DecidimPlansCharacters.configure(<%== js_options.to_json %>);
$(".field.with-character-counter").each(function(_i, el) {
var $wrapper = $(el);
var $input = $("input, textarea", $wrapper);
var $info = $(".field-character-counter-info", $wrapper);
DecidimPlansCharacters.bindCharacterCounter($input, $info);
});
})
</script>
13 changes: 13 additions & 0 deletions app/cells/decidim/plans/plan_form/profile_publicity_box.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="banner bg-secondary margin-bottom-3">
<div class="banner__icon">
<%= icon("globe", role: "img", "aria-hidden": true) %>
</div>
<div class="banner__content">
<h2 class="h3"><%= t("decidim.plans.plans.edit.make_profile_public") %></h2>
<p><%= t("decidim.plans.plans.edit.public_profile_required") %></p>
<button type="button" class="button button--icon" data-open="publishAccountModal" data-redirect-url="<%= new_plan_path %>">
<%= t("decidim.plans.plans.edit.make_profile_public") %>
<%= icon("arrow-right", role: "img", "aria-hidden": true) %>
</button>
</div>
</div>
24 changes: 24 additions & 0 deletions app/cells/decidim/plans/plan_form/show.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,27 @@
<%= contents_edit %>
<%= render :buttons %>
<%
js_options = {
messages: {
charactersMin: t(".characters_min"),
charactersUsed: t(".characters_used")
}
}
%>
<% if user_public? %>
<script>
document.addEventListener("DOMContentLoaded", () => {
DecidimPlansCharacters.configure(<%== js_options.to_json %>);
$(".field.with-character-counter").each(function(_i, el) {
var $wrapper = $(el);
var $input = $("input, textarea", $wrapper);
var $info = $(".field-character-counter-info", $wrapper);
console.log($info);
DecidimPlansCharacters.bindCharacterCounter($input, $info);
});
})
</script>
<% end %>
22 changes: 11 additions & 11 deletions app/cells/decidim/plans/plan_form/sign_in_box.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="row">
<div class="columns large-8 large-push-2">
<div class="text-center">
<p class="lead"><%= t("decidim.plans.plans.edit.sign_in_before_submitting") %></p>
<p><%= t("decidim.plans.plan_form.buttons.you_can_invite_others") %></p>
<p>
<%= action_authorized_link_to :create, new_plan_path, class: "title-action__action button large primary", data: { "redirect_url" => new_plan_path } do %>
<%= t("decidim.plans.plans.edit.sign_in") %>
<% end %>
</p>
</div>
<div class="banner bg-secondary margin-bottom-3">
<div class="banner__icon">
<%= icon("account-login", role: "img", "aria-hidden": true) %>
</div>
<div class="banner__content">
<h2 class="h3"><%= t("decidim.plans.plans.edit.sign_in") %></h2>
<p><%= t("decidim.plans.plans.edit.sign_in_before_submitting") %></p>
<%= action_authorized_link_to :create, new_plan_path, class: "button button--icon", data: { "redirect_url" => new_plan_path } do %>
<%= t("decidim.plans.plans.edit.sign_in") %>
<%= icon("arrow-right", role: "img", "aria-hidden": true) %>
<% end %>
</div>
</div>
14 changes: 14 additions & 0 deletions app/cells/decidim/plans/plan_form_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class PlanFormCell < Decidim::ViewModel
delegate(
:current_user,
:user_signed_in?,
:user_public?,
:component_settings,
:current_component,
:snippets,
Expand All @@ -18,6 +19,7 @@ class PlanFormCell < Decidim::ViewModel
delegate :new_plan_path, to: :routes_proxy

def user_group_field
return if preview_mode?
return if options[:disable_user_group_field]
return unless manageable_user_groups.any?

Expand All @@ -28,8 +30,20 @@ def contents_edit
render :contents_edit
end

def sign_in_box
render :sign_in_box
end

def profile_publicity_box
render :profile_publicity_box
end

private

def preview_mode?
!user_signed_in?
end

def display_save_as_draft?
plan.blank? || plan.draft?
end
Expand Down
1 change: 1 addition & 0 deletions app/cells/decidim/plans/plan_index/controls.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= render(partial: "decidim/plans/plans/controls.html") %>
4 changes: 4 additions & 0 deletions app/cells/decidim/plans/plan_index/notification.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<%
# Use this file to add a notification above the plans listing and map. By
# default this is empty, so it needs to be defined for the instance itself.
%>
148 changes: 78 additions & 70 deletions app/cells/decidim/plans/plan_index/show.erb
Original file line number Diff line number Diff line change
@@ -1,93 +1,101 @@
<div class="row columns">
<div class="text-center">
<h2 class="heading1 page-title"><%= t ".title" %></h2>
<div class="page-title">
<h1 class="heading1"><%= t ".title" %></h1>
</div>
</div>

<div class="row" data-equalizer>
<div class="row medium-unstack content-intro">
<div class="columns medium-6 mediumlarge-8">
<div class="card bg-primary fg-light" data-equalizer-watch>
<div class="card__content">
<h3 class="heading1"><%= t ".subtitle" %></h3>
<div class="lead">
<% if translated_attribute(component.settings.plan_listing_intro).present? %>
<%= decidim_sanitize translated_attribute(component.settings.plan_listing_intro) %>
<% end %>
</div>
</div>
<div class="text-large">
<% if translated_attribute(component.settings.plan_listing_intro).present? %>
<%= decidim_sanitize translated_attribute(component.settings.plan_listing_intro) %>
<% end %>
</div>
</div>
<% if component.current_settings.creation_enabled && component.participatory_space.can_participate?(current_user) %>
<div class="columns medium-6 mediumlarge-4">
<div class="card border-primary" data-equalizer-watch>
<div class="card__content text-center">
<% if draft_link %>
<p class="h3"><%= t ".draft_plan_title" %></p>
<p><%= t ".draft_plan_description" %></p>
<%= link_to t(".draft_plan_continue"), draft_link, class: "title-action__action button hollow large primary" %>
<% else %>
<p class="h3"><%= t(".leave_your_plan") %></p>
<%= link_to new_plan_path, class: "title-action__action button hollow large primary", data: { "redirect_url" => new_plan_path } do %>
<%= t(".new_plan") %>
<%= icon "plus", aria_label: t(".new_plan"), role: "img" %>
<% end %>
<div class="actions-panel bg-secondary">
<% if draft_link %>
<p><%= t ".draft_plan_title" %></p>
<%= link_to draft_link, class: "action-link" do %>
<span><%= t(".draft_plan_continue") %></span>
<%= icon("arrow-right", role: "img", "aria-hidden": true) %>
<% end %>
</div>
<% else %>
<%= link_to new_plan_path, class: "action-link", data: { "redirect_url" => new_plan_path } do %>
<span><%= t(".new_plan") %></span>
<%= icon("arrow-right", role: "img", "aria-hidden": true) %>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>

<% if has_geocoding? %>
<%= plans_map plans_data_for_map(geocoded_plans) do %>
<template id="marker-popup">
<div class="map-info__content">
<h3>${title}</h3>
<div id="bodyContent">
<p>{{html body}}</p>
<div class="map__date-adress">
<div class="address card__extra">
<div class="address__icon">{{html icon}}</div>
<div class="address__details">
<span>${address}</span><br>
</div>
</div>
</div>
<div class="map-info__button">
<a href="${link}" class="button button--sc">
<%= t(".view_plan") %>
</a>
</div>
</div>
</div>
</template>
<%= javascript_pack_tag "decidim_plans_map" %>
<% end %>
<% end %>

<div class="row columns">
<%= render :filters_small_view %>
<div class="card card--secondary show-for-mediumlarge">
<div class="container bg-secondary filters-section">
<div class="row columns">
<div class="plan-filters record-filters">
<%= render :filters %>
</div>
</div>
</div>

<div class="row columns">
<div class="title-action">
<h2 id="plans-count" class="title-action__title section-heading">
<%= render :count %>
</h2>
</div>
</div>
<div class="row">
<div id="plans" class="columns">
<%= render :plans %>
</div>
</div>
<div class="row columns">
<div class="text-right">
<%= link_to t(".see_all_withdrawn"), plans_path(filter: { with_availability: "withdrawn", with_any_state: [""] }) %>
<div class="container listing-section">
<div class="row columns">
<% if has_geocoding? %>
<ul class="tabs" data-tabs id="listing-tabs">
<li class="tabs-title is-active"><a data-tabs-target="plans-listing" href="#plans-listing" aria-selected="true"><%= t(".show_list") %></a></li>
<li class="tabs-title"><a data-tabs-target="plans-map" href="#plans-map"><%= t(".show_map") %></a></li>
</ul>
<% end %>

<div class="tabs-content" data-tabs-content="listing-tabs">
<div class="tabs-panel is-active" id="plans-listing">
<%= render :controls %>
<%= render :notification %>

<div id="plans-count">
<%= render :count %>
</div>
<div id="plans">
<div class="cards-list">
<%= render :plans %>
</div>
</div>
<div class="text-right">
<%= link_to t(".see_all_withdrawn"), plans_path(filter: { with_availability: "withdrawn", with_any_state: [""] }) %>
</div>
</div>

<% if has_geocoding? %>
<div class="tabs-panel" id="plans-map">
<%= render :notification %>
<%= plans_map plans_data_for_map(geocoded_plans) do %>
<template id="marker-popup">
<div class="map-info__content">
<h3>${title}</h3>
<div id="bodyContent">
<p>{{html body}}</p>
<div class="map__date-adress">
<div class="address card__extra">
<div class="address__icon">{{html icon}}</div>
<div class="address__details">
<span>${address}</span><br>
</div>
</div>
</div>
<div class="map-info__button">
<a href="${link}" class="button button--sc">
<%= t(".view_plan") %>
</a>
</div>
</div>
</div>
</template>
<% end %>
</div>
<% end %>
</div>
</div>
</div>
21 changes: 21 additions & 0 deletions app/cells/decidim/plans/plan_l/data.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="card__info">
<% if has_visible_area_scope? %>
<div class="card__info__item">
<%= translated_attribute(area_scope.name) %>
</div>
<% end %>

<div class="card__info__item">
#<%= model.id %>
</div>

<div class="card__info__item">
<%= creation_date_status %>
</div>

<% if has_category? %>
<div class="card__info__item">
<%= category_name %>
</div>
<% end %>
</div>
Loading

0 comments on commit d8733fe

Please sign in to comment.