Skip to content

Commit

Permalink
Merge pull request #83 from wmo-raf/dev
Browse files Browse the repository at this point in the history
Updates and Bug Fixes
  • Loading branch information
erick-otenyo authored Mar 20, 2024
2 parents 5bf1975 + 472c1fa commit fbe6ed6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion nmhs_cms/templates/videos_include.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h4>{{ item.snippet.title }}</h4>
</a>
<div class="card-video-stats">
<span>
{% blocktranslate trimmed with updated_on=item.contentDetails.videoPublishedAt|slice:"0:10"|parse_date:"%Y-%m-%d"|date:"d M Y" %}
{% blocktranslate trimmed with updated_on=item.contentDetails.videoPublishedAt|date:'d M Y' %}
Published on : {{ updated_on }}
{% endblocktranslate %}
</span>
Expand Down
9 changes: 7 additions & 2 deletions pages/feedback/templates/feedback.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% load static wagtailcore_tags bulma_tags nmhs_cms_tags i18n %}
{% load static wagtailimages_tags lazyimages_tags wagtailcore_tags bulma_tags nmhs_cms_tags i18n %}

{% block body_class %}feedback_page{% endblock %}

Expand All @@ -18,8 +18,13 @@ <h1 class="title" style="font-weight:600; font-size:40px">{{ page.introduction_t
</p>

<figure class="image">
{% if page.illustration %}
{% if page.illustration.url %}
{% svg page.illustration.file.name %}
{% else %}
{% image page.illustration original as img %}
<img class="progressive__img progressive--not-loaded"
data-progressive="{{ img.url }}"
src="{% lazy_image_url img %}" alt=""/>
{% endif %}
</figure>
</div>
Expand Down
12 changes: 10 additions & 2 deletions pages/videos/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from dateutil.parser import parse
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
Expand Down Expand Up @@ -82,9 +83,16 @@ def playlist_items(self, limit=None):
pass

if info:
# sort by video position in playlist
info.sort(key=lambda info_item: info_item['snippet']['position'], reverse=True)
# parse the date published
for item in info:
published_at = parse(item['contentDetails']['videoPublishedAt'])
item['contentDetails']['videoPublishedAt'] = published_at

# sort the videos by date published
info = sorted(info, key=lambda x: x['contentDetails']['videoPublishedAt'], reverse=True)

return info

return None

panels = [
Expand Down
3 changes: 1 addition & 2 deletions pages/videos/templates/playlist_items.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ <h1 class="icon icon-form">
</iframe>
<h2>{{ video.snippet.title }}</h2>
</td>
{# 2019-09-27T08:57:37.000Z#}
<td class="title">
<h2>{{ video.snippet.publishedAt|slice:"0:10"|parse_date:"%Y-%m-%d"|date:"d M Y" }}</h2>
<h2>{{ video.snippet.publishedAt }}</h2>
</td>
</tr>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

{% block body_class %}weather{% endblock %}

{% block extra_css %}
<link rel="stylesheet" href="{% static 'weather/css/daily_weather_report.css' %}">
{% endblock extra_css %}
{% block content %}
<main class="is-index">
<section class="nmhs-work is-desktop">
Expand Down

0 comments on commit fbe6ed6

Please sign in to comment.