Skip to content

Commit

Permalink
🍱(edulib) update templates and asset to 1.12
Browse files Browse the repository at this point in the history
update templates to 1.12 but maintain icon font
  • Loading branch information
2018D committed Jan 14, 2020
1 parent f28061a commit 5664e4f
Show file tree
Hide file tree
Showing 7 changed files with 244 additions and 212 deletions.
294 changes: 156 additions & 138 deletions src/backend/funmooc/templates/courses/cms/course_detail.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "richie/fullwidth.html" %}
{% load cms_tags i18n extra_tags thumbnail %}
{% load cms_tags i18n extra_tags static thumbnail %}

{% block breadcrumbs %}{% endblock breadcrumbs %}

Expand All @@ -19,165 +19,183 @@

{% block content %}{% spaceless %}
<div class="course-detail">
{% spaceless %}

{% with course=current_page.course header_level=2 %}

<div class="course-detail__content course-detail__content--two">

{% if request.current_page.parent_page.course %}
<div class="course-detail__content__snapshot">
<div class="course-detail__content__snapshot__date">
{% blocktrans with creation_date=request.current_page.creation_date|date:"SHORT_DATE_FORMAT" %}
Archived on {{ creation_date }}
{% endblocktrans %}
{% block snapshot %}
{% if request.current_page.parent_page.course %}
<div class="course-detail__content__snapshot">
<div class="course-detail__content__snapshot__date">
{% blocktrans with creation_date=request.current_page.creation_date|date:"SHORT_DATE_FORMAT" %}
Archived on {{ creation_date }}
{% endblocktrans %}
</div>
<a href="{{ request.current_page.parent_page.get_absolute_url }}">{% trans "Go to current version" %}</a>
</div>
<a href="{{ request.current_page.parent_page.get_absolute_url }}">{% trans "Go to current version" %}</a>
</div>
{% endif %}
{% endif %}
{% endblock snapshot %}

<h1 class="course-detail__content__title">
{% if request.current_page.parent_page.course %}
{{ request.current_page.parent_page.get_title }}
{% else %}
{% render_model request.current_page "title" %}
{% block title %}
<h1 class="course-detail__content__title">
{% if request.current_page.parent_page.course %}
{{ request.current_page.parent_page.get_title }}
{% else %}
{% render_model request.current_page "title" %}
{% endif %}
</h1>
{% endblock title %}

{% block introduction %}
{% if current_page.publisher_is_draft or not current_page|is_empty_placeholder:"course_introduction" %}
<div class="course-detail__content__row course-detail__content__introduction">
{% page_placeholder "course_introduction" current_page %}
</div>
{% endif %}
</h1>

{% if current_page.publisher_is_draft or not current_page|is_empty_placeholder:"course_introduction" %}
<div class="course-detail__content__row course-detail__content__introduction">
{% page_placeholder "course_introduction" current_page %}
</div>
{% endif %}

{% if current_page.publisher_is_draft or not current_page|is_empty_placeholder:"course_icons" or not current_page|is_empty_placeholder:"course_categories" %}
<div class="course-detail__content__row course-detail__content__categories">
{% with form_factor="tag" %}
{% placeholder "course_icons" %}
{% page_placeholder "course_categories" current_page or %}
{% if current_page.publisher_is_draft and current_page|is_empty_placeholder:"course_icons" %}
<p class="course-detail__content__categories__placeholder">
{% trans "No associated categories" %}
</p>
{% endif %}
{% endpage_placeholder %}
{% endwith %}
</div>
{% endif %}
{% endblock introduction %}

{% block categories %}
{% if current_page.publisher_is_draft or not current_page|is_empty_placeholder:"course_icons" or not current_page|is_empty_placeholder:"course_categories" %}
<div class="course-detail__content__row course-detail__content__categories">
{% with form_factor="tag" %}
{% placeholder "course_icons" %}
{% page_placeholder "course_categories" current_page or %}
{% if current_page.publisher_is_draft and current_page|is_empty_placeholder:"course_icons" %}
<p class="course-detail__content__categories__placeholder">
{% trans "No associated categories" %}
</p>
{% endif %}
{% endpage_placeholder %}
{% endwith %}
</div>
{% endif %}
{% endblock categories %}

{% include "courses/cms/fragment_course_content.html" with page=current_page %}
{% block fragment %}
{% include "courses/cms/fragment_course_content.html" with page=current_page %}
{% endblock fragment %}
</div>

<div class="course-detail__aside">

{% if current_page.publisher_is_draft %}
<div class="course-detail__aside__cover">
{% get_placeholder_plugins "course_cover" as plugins or %}
<p class="course-detail__aside__cover__empty">{% trans 'Add an image for course cover on its glimpse.' %}</p>
{% endget_placeholder_plugins %}
{% blockplugin plugins.0 %}
<img
src="{% thumbnail instance.picture 300x170 crop upscale subject_location=instance.picture.subject_location %}"
srcset="
{% thumbnail instance.picture 300x170 crop upscale subject_location=instance.picture.subject_location %} 300w,
{% if instance.picture.width >= 600 %}{% thumbnail instance.picture 600x340 crop upscale subject_location=instance.picture.subject_location %} 600w,{% endif %}
{% if instance.picture.width >= 900 %}{% thumbnail instance.picture 900x510 crop upscale subject_location=instance.picture.subject_location %} 900w{% endif %}
"
sizes="300px"
alt="{% if instance.picture.default_alt_text %}{{ instance.picture.default_alt_text }}{% else %}{% trans 'course cover image' %}{% endif %}"
/>
{% endblockplugin %}
</div>
{% endif %}

{% with main_organization=course.get_main_organization %}
{% if main_organization %}
{% if current_page.publisher_is_draft %}
{% if main_organization.check_publication is True %}
{% include "courses/cms/fragment_organization_main_logo.html" with organization=main_organization.public_extension %}
{% else %}
{% include "courses/cms/fragment_organization_main_logo.html" with organization=main_organization %}
{% endif %}
{# If the current page is the published version, show only the organizations that are published #}
{% elif main_organization.check_publication is True %}
{% include "courses/cms/fragment_organization_main_logo.html" with organization=main_organization.public_extension %}
{% endif %}
{% else %}
{% include "courses/cms/fragment_organization_main_logo.html" with organization=None %}
{% block cover %}
{% if current_page.publisher_is_draft %}
<div class="course-detail__aside__cover">
{% get_placeholder_plugins "course_cover" as plugins or %}
<p class="course-detail__aside__cover__empty">{% trans 'Add an image for course cover on its glimpse.' %}</p>
{% endget_placeholder_plugins %}
{% blockplugin plugins.0 %}
<img
src="{% thumbnail instance.picture 300x170 crop upscale subject_location=instance.picture.subject_location %}"
srcset="
{% thumbnail instance.picture 300x170 crop upscale subject_location=instance.picture.subject_location %} 300w
{% if instance.picture.width >= 600 %},{% thumbnail instance.picture 600x340 crop upscale subject_location=instance.picture.subject_location %} 600w{% endif %}
{% if instance.picture.width >= 900 %},{% thumbnail instance.picture 900x510 crop upscale subject_location=instance.picture.subject_location %} 900w{% endif %}
"
sizes="300px"
alt="{% if instance.picture.default_alt_text %}{{ instance.picture.default_alt_text }}{% else %}{% trans 'course cover image' %}{% endif %}"
/>
{% endblockplugin %}
</div>
{% endif %}
{% endwith %}

{% if course.duration or course.effort or current_page.publisher_is_draft %}
<div class="course-detail__aside__synopsis">
<dl>
{% render_model_block course "duration,effort" %}
{% if instance.duration or current_page.publisher_is_draft %}
<dt><span class="icon-duration"></span>{% trans "Duration:" %}</dt>
<dd>{{ instance.get_duration_display|default:"NA" }}</dd>
{% endif %}
{% if instance.effort or current_page.publisher_is_draft %}
<dt><span class="icon-effort"></span>{% trans "Effort:" %}</dt>
<dd>{{ instance.get_effort_display|default:"NA" }}</dd>
{% endif %}
{% endrender_model_block %}
</dl>
</div>
{% endif %}

<div class="course-detail__aside__run">
<h2 class="course-detail__aside__run__title">{% trans 'Course runs' %}</h2>
{% for run in course.get_course_runs_for_language %}
<div class="course-detail__aside__run__block">
<dl>
<dt>{% trans "Enrollment" %}</dt>
<dd>
{% render_model run "enrollment_start" "enrollment_start,enrollment_end" "" "date:'DATE_FORMAT'|default:'...'" as start %}
{% render_model run "enrollment_end" "enrollment_start,enrollment_end" "" "date:'DATE_FORMAT'|default:'...'" as end %}
{% trans "From" %} {{ start|safe }} {% trans "to" %} {{ end|safe }}
</dd>
<dt>{% trans "Course" %}</dt>
<dd>
{% render_model run "start" "start,end" "" "date:'DATE_FORMAT'|default:'...'" as start %}
{% render_model run "end" "start,end" "" "date:'DATE_FORMAT'|default:'...'" as end %}
{% trans "From" %} {{ start|safe }} {% trans "to" %} {{ end|safe }}
</dd>
<dt>{% trans "Languages" %}</dt><dd>{% render_model run "get_languages_display" "languages" %}</dd>
{% endblock cover %}

{% block main_organization %}
{% with main_organization=course.get_main_organization %}
{% if main_organization %}
{% if current_page.publisher_is_draft %}
<dt>{% trans "Resource link" %}</dt>
<dd>
<a href="{{ run.resource_link }}">
{% render_model run "resource_link" "resource_link" %}
</a>
</dd>
<dt><a href="{{ run.extended_object.get_absolute_url }}">{% trans "course run" %}</a></dt>
{% if main_organization.check_publication is True %}
{% include "courses/cms/fragment_organization_main_logo.html" with organization=main_organization.public_extension %}
{% else %}
{% include "courses/cms/fragment_organization_main_logo.html" with organization=main_organization %}
{% endif %}
{# If the current page is the published version, show only the organizations that are published #}
{% elif main_organization.check_publication is True %}
{% include "courses/cms/fragment_organization_main_logo.html" with organization=main_organization.public_extension %}
{% endif %}
</dl>
{% if run.state.call_to_action == _("enroll now") %}
<a class="course-detail__aside__run__block__cta" href="{{ run.resource_link }}">
{{ run.state.call_to_action|capfirst }}
</a>
{% elif run.state.call_to_action %}
<a class="course-detail__aside__run__block__cta" href="{{ run.extended_object.get_absolute_url }}">
{{ run.state.call_to_action|capfirst }}
</a>
{% else %}
<a class="course-detail__aside__run__block__cta course-detail__aside__run__block__cta--projected" href="{{ run.extended_object.get_absolute_url }}">
{{ run.state.text|capfirst }}
</a>
{% include "courses/cms/fragment_organization_main_logo.html" with organization=None %}
{% endif %}
{% endwith %}
{% endblock main_organization %}

{% block synopsis %}
{% if course.duration or course.effort or current_page.publisher_is_draft %}
<div class="course-detail__aside__synopsis">
<dl>
{% render_model_block course "duration,effort" %}
{% if instance.duration or current_page.publisher_is_draft %}
<dt><span class="icon-duration"></span>{% trans "Duration:" %}</dt>
<dd>{{ instance.get_duration_display|default:"NA" }}</dd>
{% endif %}
{% if instance.effort or current_page.publisher_is_draft %}
<dt><span class="icon-effort"></span>{% trans "Effort:" %}</dt>
<dd>{{ instance.get_effort_display|default:"NA" }}</dd>
{% endif %}
{% endrender_model_block %}
</dl>
</div>
{% endif %}
{% endblock synopsis %}

{% block runs %}
<div class="course-detail__aside__runs">
<h2 class="course-detail__aside__runs__title">{% trans 'Course runs' %}</h2>
{% for run in course.get_course_runs_for_language %}
<div class="course-detail__aside__runs__block">
<dl>
<dt>{% trans "Enrollment" %}</dt>
<dd>
{% render_model run "enrollment_start" "enrollment_start,enrollment_end" "" "date:'DATE_FORMAT'|default:'...'" as start %}
{% render_model run "enrollment_end" "enrollment_start,enrollment_end" "" "date:'DATE_FORMAT'|default:'...'" as end %}
{% trans "From" %} {{ start|safe }} {% trans "to" %} {{ end|safe }}
</dd>
<dt>{% trans "Course" %}</dt>
<dd>
{% render_model run "start" "start,end" "" "date:'DATE_FORMAT'|default:'...'" as start %}
{% render_model run "end" "start,end" "" "date:'DATE_FORMAT'|default:'...'" as end %}
{% trans "From" %} {{ start|safe }} {% trans "to" %} {{ end|safe }}
</dd>
<dt>{% trans "Languages" %}</dt><dd>{% render_model run "get_languages_display" "languages" %}</dd>
{% if current_page.publisher_is_draft %}
<dt>{% trans "Resource link" %}</dt>
<dd>
<a href="{{ run.resource_link }}">
{% render_model run "resource_link" "resource_link" %}
</a>
</dd>
<dt><a href="{{ run.extended_object.get_absolute_url }}">{% trans "course run" %}</a></dt>
{% endif %}
</dl>
{% if run.state.call_to_action == _("enroll now") %}
<a class="course-detail__aside__runs__block__cta" href="{{ run.resource_link }}">
{{ run.state.call_to_action|capfirst }}
</a>
{% elif run.state.call_to_action %}
<a class="course-detail__aside__runs__block__cta" href="{{ run.extended_object.get_absolute_url }}">
{{ run.state.call_to_action|capfirst }}
</a>
{% else %}
<a class="course-detail__aside__runs__block__cta course-detail__aside__runs__block__cta--projected" href="{{ run.extended_object.get_absolute_url }}">
{{ run.state.text|capfirst }}
</a>
{% endif %}
</div>
{% empty %}
<div class="course-detail__aside__run__empty">{% trans "No associated course runs" %}</div>
{% endfor %}
</div>
{% endblock runs %}

{% block social_networks %}
<div class="course-detail__aside__social-networks">
{% include "social-networks/course-badges.html" with page_title=request.current_page.get_title page_url=request.current_page.get_absolute_url %}
</div>
{% empty %}
<div class="course-detail__aside__run__empty">{% trans "No associated course runs" %}</div>
{% endfor %}
</div>

<div class="course-detail__aside__social-networks">
{% include "social-networks/course-badges.html" with page_title=request.current_page.get_title page_url=request.current_page.get_absolute_url %}
</div>
{% endblock social_networks %}
</div>

{% endwith %}

{% endspaceless %}
</div>
{% endspaceless %}{% endblock content %}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% extends "richie/fullwidth.html" %}
{% load cms_tags i18n extra_tags %}

{% block title %}{% spaceless %}
{% block head_title %}{% spaceless %}
{% page_attribute "page_title" as course_run_title %}
{% page_attribute "page_title" current_page.parent_page as course_title %}
{{ course_run_title|capfirst }} - {{ course_title|capfirst }}
{% endspaceless %}{% endblock title %}
{% endspaceless %}{% endblock head_title %}

{# Make sure the course run pages are not indexed by search engines #}
{% block meta_index_rules %}<meta name="robots" content="noindex">{% endblock meta_index_rules %}
Expand Down
Loading

0 comments on commit 5664e4f

Please sign in to comment.