Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/packs/stylesheets/decidim/dataspace/dataspace.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@
p.author_name{
margin-left: 0.75rem;
}
.card__list-external {
border-color: rgb(var(--tertiary-rgb) / var(--tw-ring-opacity, 1));
}
24 changes: 19 additions & 5 deletions app/views/decidim/proposals/proposals/_external_proposal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="card__grid-text">
<div class="card__grid-text-title">
<%= content_tag :h4, external_proposal["title"], class: "h4 text-secondary" %>
<% if external_proposal["metadata"]["state"]["state"].present? %>
<% if external_proposal.dig("metadata", "state", "state").present? %>
<%= external_state_item(external_proposal["metadata"]["state"]) %>
<% end %>
</div>
Expand All @@ -22,17 +22,31 @@
</div>
<div class="mb-3">
<%= icon("wechat-line") %>
<p><%= external_proposal["children"].count %></p>
<p><%= external_proposal["children"].present? ? external_proposal["children"].count : 0 %></p>
</div>
</div>
<% end %>
<% else %>
<%= link_to external_proposal["source"], class: "card__list", id: external_proposal["reference"] do %>
<%= link_to external_proposal_proposals_path(external_proposal["reference"], url: external_proposal["source"]), class: "card__list card__list-external", id: external_proposal["reference"] do %>
<%= content_tag(:div, class: "card__list-content") do %>
<%= content_tag :h4, class: "h4 card__list-title" do %>
<%= external_proposal["title"] %>
<%= external_proposal["title"] %> ( <%= t('.view_from', platform: display_host(external_proposal["source"])) %>)
<% end %>
<p>Proposal from external platform</p>
<div class="card__list-metadata">
<div class="author__container">
<div class="author__avatar-container">
<img alt="default avatar" class="author__avatar" src="<%= asset_pack_path("media/images/default-avatar.svg") %>">
</div>
<p class="author_name"><%= @authors.select{|author| external_proposal["authors"].include?(author["reference"])}.map{|author| author["name"]}.join(', ') %></p>
</div>
<div class="data-comments-count">
<%= icon("wechat-line") %>
<p><%= external_proposal["children"].present? ? external_proposal["children"].count : 0 %></p>
</div>
<% if external_proposal.dig("metadata", "state", "state").present? %>
<div><p><%= external_state_item(external_proposal["metadata"]["state"]) %></p></div>
<% end %>
</div>
<% end %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<section class="layout-main__section layout-main__heading">
<%= render partial: "voting_rules" %>
<h1 class="h2 decorator"><%= @external_proposal["title"] %></h1>
<h1 class="h2 decorator"><%= @external_proposal["title"] %> (<%= t('.view_from', platform: display_host(@external_proposal["source"])) %>)</h1>
<div class="layout-author">
<div class="author__avatar-container">
<img alt="default avatar" class="author__avatar" src="<%= asset_pack_path("media/images/default-avatar.svg") %>">
Expand Down
17 changes: 17 additions & 0 deletions app/views/decidim/proposals/proposals/index.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var $proposals = $('#proposals');
var $orderFilterInput = $('.order_filter');

$proposals.html('<%= j(render partial: "proposals").strip.html_safe %>');
$orderFilterInput.val('<%= order %>');

<% if Decidim::Map.available?(:geocoding, :dynamic) && component_settings.geocoding_enabled? %>
var $map = $("#map");
var controller = $map.data("map-controller");
if (controller) {
var markerData = JSON.parse('<%= escape_javascript proposals_data_for_map(@proposals).to_json.html_safe %>');
controller.clearMarkers();
if (markerData.length > 0 ) {
controller.addMarkers(markerData);
}
}
<% end %>
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ en:
proposals:
external_proposal:
view_from: View from platform %{platform}
layouts:
decidim:
shared:
layout_item:
view_from: view from plateform %{platform}
5 changes: 5 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ fr:
proposals:
external_proposal:
view_from: Vue de la plateforme %{platform}
layouts:
decidim:
shared:
layout_item:
view_from: vue de la plateforme %{platform}
5 changes: 3 additions & 2 deletions lib/decidim/dataspace/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ class Engine < ::Rails::Engine

initializer "dataspace-extends" do
config.after_initialize do
require "extends/controllers/decidim/proposals/proposals_controller_extends"
require "extends/controllers/decidim/proposals/proposals_controller_dataspace_extends"
require "extends/models/decidim/comments/comment_extends"
require "extends/lib/decidim/core_extends"
require "extends/commands/decidim/system/create_organization_extends"
require "extends/commands/decidim/system/update_organization_extends"
require "extends/forms/decidim/system/base_organization_form_extends"
require "extends/forms/decidim/system/register_organization_form_extends"
require "extends/forms/decidim/system/update_organization_form_extends"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "active_support/concern"
require "uri"

module ProposalsControllerExtends
module ProposalsControllerDataspaceExtends
extend ActiveSupport::Concern

included do
Expand Down Expand Up @@ -128,4 +128,4 @@ def create_pagination_object(total_count, current_page, per_page)
end
end

Decidim::Proposals::ProposalsController.include(ProposalsControllerExtends)
Decidim::Proposals::ProposalsController.include(ProposalsControllerDataspaceExtends)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module RegisterOrganizationFormExtends
extend ActiveSupport::Concern

included do
attribute :enable_dataspace, Decidim::AttributeObject::TypeMap::Boolean
end
end

Decidim::System::RegisterOrganizationForm.include(RegisterOrganizationFormExtends)
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

module BaseOrganizationFormExtends
module UpdateOrganizationFormExtends
extend ActiveSupport::Concern

included do
attribute :enable_dataspace, Decidim::AttributeObject::TypeMap::Boolean
end
end

Decidim::System::BaseOrganizationForm.include(BaseOrganizationFormExtends)
Decidim::System::UpdateOrganizationForm.include(UpdateOrganizationFormExtends)
Loading
Loading