diff --git a/core/templates/core/macros.jinja b/core/templates/core/macros.jinja index 84c5b05a0..b9888d07e 100644 --- a/core/templates/core/macros.jinja +++ b/core/templates/core/macros.jinja @@ -328,3 +328,22 @@ {% endmacro %} + +{% macro read_more(text, max_size, tag, tag_attrs) %} + {% set tag = tag|default('p') %} + {% set tag_attrs = tag_attrs|default('tag_attrs') %} +
+ <{{ tag }} x-cloak {{ tag_attrs|safe }} x-text="open ? fullText : slicedText" x-transition> + {{ text }} + +
+ +
+{% endmacro %} \ No newline at end of file diff --git a/election/static/election/css/election.scss b/election/static/election/css/election.scss index 32ba7a9c6..b0d915c7a 100644 --- a/election/static/election/css/election.scss +++ b/election/static/election/css/election.scss @@ -106,7 +106,7 @@ $min_col_width: 100px; margin: 0; } - >p { + .role_description { flex-grow: 1; margin-top: .5em; text-wrap: auto; diff --git a/election/templates/election/election_detail.jinja b/election/templates/election/election_detail.jinja index e9dfdd9bd..264866734 100644 --- a/election/templates/election/election_detail.jinja +++ b/election/templates/election/election_detail.jinja @@ -1,4 +1,5 @@ {% extends "core/base.jinja" %} +{% from 'core/macros.jinja' import read_more %} {% block title %} {{ object.title }} @@ -8,10 +9,6 @@ {% endblock %} -{% block additional_js %} - -{% endblock %} - {% block content %}

{{ election.title }}

{{ election.description }}

@@ -68,7 +65,7 @@

{{ role.title }}

-

{{ role.description }}

+ {{ read_more(role.description, 300, "p", "class='role_description'") }} {%- if role.max_choice > 1 and not election.has_voted(user) and election.can_vote(user) %} {% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %} {%- endif %} @@ -139,7 +136,7 @@
{{ candidature.user.first_name }} {{candidature.user.nick_name or ''}} {{ candidature.user.last_name }}
{%- if not election.is_vote_finished %} - {{ candidature.program | markdown or '' }} + {{ read_more(candidature.program|markdown or '', 200, "q", "class='candidate_program'") }} {%- endif %}
{%- if user.can_edit(candidature) -%} @@ -198,18 +195,6 @@ {% block script %} {{ super() }} -