From b9b5828e14f6776fee624bbb57fd983b19e99c7b Mon Sep 17 00:00:00 2001 From: Heiner Sameisky Date: Fri, 30 Dec 2022 19:21:45 +0100 Subject: [PATCH 1/4] initial logic --- .../active_proposal_collections/show.erb | 20 ++++ .../active_proposal_collections_cell.rb | 31 ++++++ .../decidim/zukunftsprozess/startpage.scss | 97 +++++++++++++++++++ config/initializers/decidim_content_blocks.rb | 7 +- config/locales/zukunftsprozess/de.yml | 7 +- 5 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb create mode 100644 app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections_cell.rb diff --git a/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb new file mode 100644 index 000000000..5556c6f5f --- /dev/null +++ b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb @@ -0,0 +1,20 @@ +
+
+

<%= t('title', scope: 'decidim.active_proposal_collections_content_block.content_blocks.active_proposal_collections') %>

+
+
+ <% active_proposals_components.each do |component| %> +
+
+ <%= link_to Decidim::Assemblies::Engine.routes.url_helpers.decidim_assembly_proposals_path(component.participatory_space, component), class: "card card__link", style: "background-image:url('#{component.participatory_space.attached_uploader(:hero_image).path}')" do %> +
+ <%= translated_attribute(component.settings.announcement) %> +
+ <% end %> +
+
+ <% end %> +
+
+
+
diff --git a/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections_cell.rb b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections_cell.rb new file mode 100644 index 000000000..cd9675088 --- /dev/null +++ b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections_cell.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Decidim + module ActiveProposalCollectionsContentBlock + module ContentBlocks + class ActiveProposalCollectionsCell < Decidim::ViewModel + include Decidim::ApplicationHelper # html_truncate + # include Decidim::LayoutHelper # If icons are needed in the (customized) view + include Decidim::SanitizeHelper # decidim_sanitize + + delegate :current_organization, to: :controller + delegate :current_user, to: :controller + + def show + render + end + + def active_proposals_components + @active_proposals_components ||= Decidim::Component.where(participatory_space_id: public_assemblies_ids, participatory_space_type: 'Decidim::Assembly' ).where( manifest_name: 'proposals' ).where.not( published_at: nil ) + end + + private + + def public_assemblies_ids + Decidim::Assemblies::OrganizationPublishedAssemblies.new(current_organization).pluck(:id) + end + + end + end + end +end diff --git a/app/packs/stylesheets/decidim/zukunftsprozess/startpage.scss b/app/packs/stylesheets/decidim/zukunftsprozess/startpage.scss index cad53388a..451ef64ff 100644 --- a/app/packs/stylesheets/decidim/zukunftsprozess/startpage.scss +++ b/app/packs/stylesheets/decidim/zukunftsprozess/startpage.scss @@ -332,3 +332,100 @@ } + + +.home-section.proposals { + .card-wrapper { + position: relative; + padding-top: 66.66%; /* 3:2 Aspect Ratio or 75% for 4:3 */ + + .card { + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + + background-size: cover; + + + + .teaser { + position: absolute; + bottom: 20px; + right: 20px; + z-index: 1000; + + transform: rotate(-2deg); + + width: 45%; + padding: .5rem; + + background-color: $white; + + font-weight: 400; + font-size: .9rem; + line-height: 1.1rem; + color: $black; + + .link { + font-weight: 700; + color: var(--secondary); + + svg { + height: 12px; + } + } + + // @include breakpoint(small) { + // width: 45%; + // font-size: .8rem; + // line-height: 1rem; + // padding: .3rem; + // } + + // @include breakpoint(medium) { + // width: 45%; + // height: auto; + // padding: .5rem; + + // font-size: .9rem; + // line-height: 1.1rem; + // } + + + // @include breakpoint(large) { + // width: 45%; + // padding: .5rem; + + // font-size: 1.2rem; + // line-height: 1.4rem; + // } + + a { + // text-decoration: none; + font-weight: 600; + + .icon.inline { + @include breakpoint(small) { + width: 9px; + height: 9px; + } + + @include breakpoint(medium) { + width: 10px; + height: 10px; + } + + + @include breakpoint(large) { + width: 12px; + height: 12px; + } + + } + } + } + } + } +} diff --git a/config/initializers/decidim_content_blocks.rb b/config/initializers/decidim_content_blocks.rb index f6a78d4d9..63c203f9b 100644 --- a/config/initializers/decidim_content_blocks.rb +++ b/config/initializers/decidim_content_blocks.rb @@ -6,4 +6,9 @@ Decidim.content_blocks.register(:homepage, :recent_blog_posts) do |content_block| content_block.cell = 'decidim/blog_posts_content_block/content_blocks/recent_blog_posts' content_block.public_name_key = 'decidim.blog_posts_content_block.content_blocks.recent_blog_posts.name' -end \ No newline at end of file +end + +Decidim.content_blocks.register(:homepage, :active_proposal_collections) do |content_block| + content_block.cell = 'decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections' + content_block.public_name_key = 'decidim.active_proposal_collections_content_block.content_blocks.active_proposal_collections.name' +end diff --git a/config/locales/zukunftsprozess/de.yml b/config/locales/zukunftsprozess/de.yml index 8be04c5a1..0d43d35c5 100644 --- a/config/locales/zukunftsprozess/de.yml +++ b/config/locales/zukunftsprozess/de.yml @@ -3,4 +3,9 @@ de: zukunftsprozess_content_block: content_blocks: startpage: - name: Zukunftsprozess \ No newline at end of file + name: Zukunftsprozess + active_proposal_collections_content_block: + content_blocks: + active_proposal_collections: + name: Aktive Vorschlagssammlungen + title: Hier sammeln Werkräume deine Vorschläge From 42afebe5c9c78b8dbd023e67c2bc6f45e7bd593f Mon Sep 17 00:00:00 2001 From: Heiner Sameisky Date: Thu, 5 Jan 2023 11:04:32 +0100 Subject: [PATCH 2/4] wip --- .../active_proposal_collections/show.erb | 12 ++++++++++++ .../stylesheets/decidim/decidim_application.scss | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb index 5556c6f5f..ed0bb35f2 100644 --- a/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb +++ b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb @@ -15,6 +15,18 @@ <% end %> + Alle konKreationen anzeigen + + +
+
+ +
+ +
+
Spend Less Time Coding, Testing, and Preparing:
+
+
diff --git a/app/packs/stylesheets/decidim/decidim_application.scss b/app/packs/stylesheets/decidim/decidim_application.scss index ab03791ab..3fd65cc8b 100644 --- a/app/packs/stylesheets/decidim/decidim_application.scss +++ b/app/packs/stylesheets/decidim/decidim_application.scss @@ -666,3 +666,18 @@ ul.card-data { display: none; } } + + +.read-more-content, +.read-more, +.toggler { + display: none; + margin-top: 1rem; + + &.expanded { + display: block; + .read-more { + display: block; + } + } +} From 25705c915430a909853fbafe0b2edbf49342469b Mon Sep 17 00:00:00 2001 From: Heiner Sameisky Date: Mon, 26 Jun 2023 19:50:00 +0200 Subject: [PATCH 3/4] Fix broken css --- app/packs/stylesheets/decidim/decidim_application.scss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/packs/stylesheets/decidim/decidim_application.scss b/app/packs/stylesheets/decidim/decidim_application.scss index 12af7f982..dee4e5fef 100644 --- a/app/packs/stylesheets/decidim/decidim_application.scss +++ b/app/packs/stylesheets/decidim/decidim_application.scss @@ -683,7 +683,6 @@ ul.card-data { } } - .read-more-content, .read-more, .toggler { @@ -693,6 +692,11 @@ ul.card-data { &.expanded { display: block; .read-more { + display: block; + } + } +} + .tags { a:hover { text-decoration: none; From 6f8bde7ed9a54fe16473926bcb06b9c881ee0d52 Mon Sep 17 00:00:00 2001 From: Heiner Sameisky Date: Wed, 5 Jul 2023 10:50:52 +0200 Subject: [PATCH 4/4] wip --- .../active_proposal_collections/show.erb | 13 +------------ .../active_proposal_collections_cell.rb | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb index ed0bb35f2..327f55770 100644 --- a/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb +++ b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections/show.erb @@ -15,18 +15,7 @@ <% end %> - Alle konKreationen anzeigen + Alle Werkräume anzeigen - - -
-
- -
- -
-
Spend Less Time Coding, Testing, and Preparing:
-
-
diff --git a/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections_cell.rb b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections_cell.rb index cd9675088..2dbae279d 100644 --- a/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections_cell.rb +++ b/app/cells/decidim/active_proposal_collections_content_block/content_blocks/active_proposal_collections_cell.rb @@ -16,7 +16,7 @@ def show end def active_proposals_components - @active_proposals_components ||= Decidim::Component.where(participatory_space_id: public_assemblies_ids, participatory_space_type: 'Decidim::Assembly' ).where( manifest_name: 'proposals' ).where.not( published_at: nil ) + @active_proposals_components ||= Decidim::Component.where(participatory_space_id: public_assemblies_ids, participatory_space_type: 'Decidim::Assembly' ).where( manifest_name: 'proposals' ).where.not( published_at: nil ).where("(settings->'default_step'->>'creation_enabled')::boolean = true") end private