Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove show more button on elections #9103

Merged
merged 3 commits into from
May 3, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,10 @@
<img src="<%= introductory_image.path %>" alt="">
</div>
<% end %>
<div class="columns medium-8 mediumlarge-7 content">
<div class="columns medium-8 mediumlarge-7">
<h2 class="show-for-sr"><%= t("decidim.votings.content_blocks.landing_page.description.title") %></h2>
<div><%= description_text %></div>
</div>
<div class="content-height-toggler show-more">
<button class="button button--muted tiny">
<span class="button-text show-more-content">
<%= button_show_more_text %>
andreslucena marked this conversation as resolved.
Show resolved Hide resolved
</span>

<span class="button-text show-less-content hide">
<%= button_show_less_text %>
</span>
</button>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ def introductory_image
def description_text
decidim_sanitize_editor(translated_attribute(current_participatory_space.description))
end

def button_show_more_text
t(:show_more, scope: "decidim.votings.content_blocks.landing_page.description")
end

def button_show_less_text
t(:show_less, scope: "decidim.votings.content_blocks.landing_page.description")
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
$(() => {
const isShowMoreButton = ($button) => $button.hasClass("show-more-content");

const remToPx = (count) => {
const unit = $("html").css("font-size");

Expand All @@ -25,17 +23,12 @@ $(() => {
$content.css("max-height", contentMaxHeight);
}

$button.on("click", (event) => {
const $buttonTextMore = $button.find(".button-text.show-more-content");
$button.on("click", () => {
const $buttonTextLess = $button.find(".button-text.show-less-content");

let newHeight = contentMaxHeight;
if (isShowMoreButton($(event.target))) {
newHeight = contentHeight;
}

$content.css("max-height", newHeight);
$buttonTextLess.toggleClass("hide");
$buttonTextMore.toggleClass("hide");
});
});
2 changes: 0 additions & 2 deletions decidim-elections/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,6 @@ en:
name: Highlighted votings
landing_page:
description:
show_less: Read less
show_more: Read more
title: About this voting
metrics:
heading: Metrics
Expand Down