Skip to content

Commit

Permalink
Merge branch 'release/1.4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
GregLeBarbar committed May 9, 2019
2 parents 90aaad5 + 108af1f commit 118c52c
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 38 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# CHANGELOG

*1.4.3* (2019-05-03)
*1.4.4* (2019-05-09)
- Shortcode Memento: academic calendar (#207)

*1.4.3* (2019-05-08)
- Update to styleguide 2.0.3
- Fix notice msg for enqueue script (#205)

Expand Down
2 changes: 1 addition & 1 deletion wp-theme-2018/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.3
1.4.4
3 changes: 1 addition & 2 deletions wp-theme-2018/shortcodes/epfl_memento/data.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ function get_event() {
$event = get_query_var('epfl_event');
return $event;
}



14 changes: 0 additions & 14 deletions wp-theme-2018/shortcodes/epfl_memento/templates/card-img-top.php

This file was deleted.

23 changes: 23 additions & 0 deletions wp-theme-2018/shortcodes/epfl_memento/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,27 @@ function is_inscription_required($invitation) {
return ($invitation === "Registration required");
}

/**
* Get visual url of event
*/
function get_visual_url($event, $memento_name) {

$visual_url = "";

if (empty($event->academic_calendar_category)) {
if ($event->visual_url) {
$visual_url = substr($event->visual_url, 0, -11) . '509x286.jpg';
} else {
if ($memento_name == 'academic-calendar') {
$visual_url = "https://memento.epfl.ch/static/img/Others.jpg";
} else {
$visual_url = "https://memento.epfl.ch/static/img/default.jpg";
}
}
} else {
$visual_url = "https://memento.epfl.ch/static/img/";
$visual_url .= $event->academic_calendar_category->en_label;
$visual_url .= ".jpg";
}
return $visual_url;
}
127 changes: 108 additions & 19 deletions wp-theme-2018/shortcodes/epfl_memento/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,34 @@
$is_first_event = ($count==1);
$is_just_finished = is_just_finished($event->end_date, $event->end_time);
$is_inscription_required = is_inscription_required($event->invitation);

$visual_url = get_visual_url($event, $memento_name);
?>

<?php if ($is_first_event and $display_first_event): ?>

<div class="card-slider-cell card-slider-cell-lg">
<a href="<?php echo esc_url($event->event_url) ?>" class="card card-gray link-trapeze-horizontal">
<div class="card-body">
<?php get_template_part('shortcodes/epfl_memento/templates/card-img-top'); ?>
<picture class="card-img-top">
<?php if (!empty($event->academic_calendar_category)): ?>
<span style='position: absolute; color: #FFF;padding: 10px 0 0 10px; line-height: 1.35em;'>
<meta itemprop="eventStatus" content="https://schema.org/EventCancelled">
<?php if ($event->lang == 'fr'): ?>
<?php echo esc_html($event->academic_calendar_category->fr_label) ?>
<?php else: ?>
<?php echo esc_html($event->academic_calendar_category->en_label) ?>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if ($visual_url): ?>
<img src="<?php echo esc_url($visual_url) ?>" class="img-fluid" title="<?php echo esc_attr($event->image_description) ?>" alt="<?php echo esc_attr($event->image_description) ?>" />
<?php endif; ?>
</picture>
<h3 class="card-title"><?php echo esc_html($event->title) ?></h3>
<p><?php echo esc_html(trim_text(strip_tags($event->description), 225)) ?></p>
<div class="card-info">
<?php get_template_part('shortcodes/epfl_memento/templates/card-info'); ?>
<?php get_template_part('shortcodes/epfl_memento/templates/card-info'); ?>
</div>
</div>
</a>
Expand All @@ -63,7 +79,21 @@
<div class="card-slider-cell">
<a href="<?php echo esc_url($event->event_url) ?>" class="card card-gray card-grayscale link-trapeze-horizontal bg-gray-100">
<div class="card-body">
<?php get_template_part('shortcodes/epfl_memento/templates/card-img-top'); ?>
<picture class="card-img-top">
<?php if (!empty($event->academic_calendar_category)): ?>
<span style='position: absolute; color: #FFF;padding: 10px 0 0 10px; line-height: 1.35em;'>
<meta itemprop="eventStatus" content="https://schema.org/EventCancelled">
<?php if ($event->lang == 'fr'): ?>
<?php echo esc_html($event->academic_calendar_category->fr_label) ?>
<?php else: ?>
<?php echo esc_html($event->academic_calendar_category->en_label) ?>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if ($visual_url): ?>
<img src="<?php echo esc_url($visual_url) ?>" class="img-fluid" title="<?php echo esc_attr($event->image_description) ?>" alt="<?php echo esc_attr($event->image_description) ?>" />
<?php endif; ?>
</picture>
<h3 class="card-title"><span class="badge badge-dark badge-sm">Just finished</span>
<?php echo esc_html($event->title) ?>
</h3>
Expand All @@ -73,7 +103,6 @@
</div>
</a>
</div>

<!-- END JUST FINISHED -->

<!-- LEARN MORE & APPLY -->
Expand All @@ -82,13 +111,27 @@
<div class="card card-gray">
<div class="card-body">
<a href="<?php echo esc_url($event->event_url) ?>" class="card-img-top">
<?php get_template_part('shortcodes/epfl_memento/templates/card-img-top'); ?>
<picture class="card-img-top">
<?php if (!empty($event->academic_calendar_category)): ?>
<span style='position: absolute; color: #FFF;padding: 10px 0 0 10px; line-height: 1.35em;'>
<meta itemprop="eventStatus" content="https://schema.org/EventCancelled">
<?php if ($event->lang == 'fr'): ?>
<?php echo esc_html($event->academic_calendar_category->fr_label) ?>
<?php else: ?>
<?php echo esc_html($event->academic_calendar_category->en_label) ?>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if ($visual_url): ?>
<img src="<?php echo esc_url($visual_url) ?>" class="img-fluid" title="<?php echo esc_attr($event->image_description) ?>" alt="<?php echo esc_attr($event->image_description) ?>" />
<?php endif; ?>
</picture>
</a>
<h3 class="card-title">
<a href="<?php echo esc_url($event->event_url) ?>"><?php echo esc_html($event->title) ?></a>
</h3>
<div class="card-info">
<?php get_template_part('shortcodes/epfl_memento/templates/card-info'); ?>
<?php get_template_part('shortcodes/epfl_memento/templates/card-info'); ?>
</div>
</div>
<div class="card-footer mt-auto">
Expand All @@ -105,17 +148,31 @@
<div class="card-slider-cell">
<a href="<?php echo esc_url($event->event_url) ?>" class="card card-gray link-trapeze-horizontal">
<div class="card-body">
<?php get_template_part('shortcodes/epfl_memento/templates/card-img-top');?>
<picture class="card-img-top">
<?php if (!empty($event->academic_calendar_category)): ?>
<span style='position: absolute; color: #FFF;padding: 10px 0 0 10px; line-height: 1.35em;font-size:2em;'>
<meta itemprop="eventStatus" content="https://schema.org/EventCancelled">
<?php if ($event->lang == 'fr'): ?>
<?php echo esc_html($event->academic_calendar_category->fr_label) ?>
<?php else: ?>
<?php echo esc_html($event->academic_calendar_category->en_label) ?>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if ($visual_url): ?>
<img src="<?php echo esc_url($visual_url) ?>" class="img-fluid" title="<?php echo esc_attr($event->image_description) ?>" alt="<?php echo esc_attr($event->image_description) ?>" />
<?php endif; ?>
</picture>
<h3 class="card-title"><?php echo esc_html($event->title) ?></h3>
<div class="card-info">
<?php get_template_part('shortcodes/epfl_memento/templates/card-info');?>
<?php get_template_part('shortcodes/epfl_memento/templates/card-info');?>
</div>
</div>
</a>
</div>

<?php endif ?>
<?php endif ?>
<?php endif; ?>
<?php endif; ?>

<?php
$count++;
Expand Down Expand Up @@ -153,7 +210,7 @@
foreach($data as $event) {
set_query_var('epfl_event', $event);
$is_first_event = ($count==1);
$visual_url = substr($event->visual_url, 0, -11) . '448x448.jpg';
$visual_url = get_visual_url($event, $memento_name);

?>

Expand All @@ -162,6 +219,14 @@
<a href="<?php echo esc_url($event->event_url) ?>" class="card card-gray link-trapeze-horizontal" itemscope itemtype="http://schema.org/Event">
<div class="card-body">
<picture class="card-img-top">
<span style='position: absolute; color: #FFF;padding: 10px 0 0 10px; line-height: 1.35em;font-size:2em;'>
<meta itemprop="eventStatus" content="https://schema.org/EventCancelled">
<?php if ($event->lang == 'fr'): ?>
<?php echo esc_html($event->academic_calendar_category->fr_label) ?>
<?php else: ?>
<?php echo esc_html($event->academic_calendar_category->en_label) ?>
<?php endif; ?>
</span>
<img src="<?php echo esc_url($visual_url) ?>" class="img-fluid" title="<?php echo esc_attr($event->image_description) ?>" alt="<?php echo esc_attr($event->image_description) ?>" />
</picture>
<h3 class="card-title" itemprop="name"><?php echo esc_html($event->title) ?></h3>
Expand All @@ -181,24 +246,36 @@
<div class="list-group-teaser-container">
<div class="list-group-teaser-thumbnail">
<picture>
<img src="<?php echo esc_url($visual_url) ?>" class="img-fluid" alt="<?php echo esc_attr($event->image_description) ?>" title="<?php echo esc_attr($event->image_description) ?>">
<?php if (!empty($event->academic_calendar_category)): ?>
<span style='position: absolute; color: #FFF;padding: 10px 0 0 10px; line-height: 1.35em;font-size:1em;'>
<meta itemprop="eventStatus" content="https://schema.org/EventCancelled">
<?php if ($event->lang == 'fr'): ?>
<?php echo esc_html($event->academic_calendar_category->fr_label) ?>
<?php else: ?>
<?php echo esc_html($event->academic_calendar_category->en_label) ?>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if ($visual_url): ?>
<img src="<?php echo esc_url($visual_url) ?>" class="img-fluid" alt="<?php echo esc_attr($event->image_description) ?>" title="<?php echo esc_attr($event->image_description) ?>">
<?php endif; ?>
</picture>
</div>
<div class="list-group-teaser-content">
<p class="h5 card-title" itemprop="name"><?php echo esc_html($event->title) ?></p>
<div class="card-info mt-0">
<?php get_template_part('shortcodes/epfl_memento/templates/card-info'); ?>
<?php get_template_part('shortcodes/epfl_memento/templates/card-info'); ?>
</div>
</div>
</div>
</a>

<?php endif ?>
<?php endif; ?>

<?php if ($count === $nb_events and $display_first_event): ?>
</div>
</div>
<?php endif ?>
<?php endif; ?>

<?php
$count++;
Expand All @@ -221,21 +298,33 @@
foreach($data as $event) {
set_query_var('epfl_event', $event);
$is_first_event = ($count==1);
$visual_url = substr($event->visual_url, 0, -11) . '448x448.jpg';
$visual_url = get_visual_url($event, $memento_name);

?>

<a href="<?php echo esc_url($event->event_url) ?>" class="list-group-item list-group-item-gray list-group-teaser link-trapeze-vertical" itemscope itemtype="http://schema.org/Event">
<div class="list-group-teaser-container">
<div class="list-group-teaser-thumbnail">
<picture>
<img src="<?php echo esc_url($visual_url) ?>" class="img-fluid" alt="<?php echo esc_attr($event->image_description) ?>" title="<?php echo esc_attr($event->image_description) ?>">
<?php if (!empty($event->academic_calendar_category)): ?>
<span style='position: absolute; color: #FFF;padding: 10px 0 0 10px; line-height: 1.35em;font-size:1em;'>
<meta itemprop="eventStatus" content="https://schema.org/EventCancelled">
<?php if ($event->lang == 'fr'): ?>
<?php echo esc_html($event->academic_calendar_category->fr_label) ?>
<?php else: ?>
<?php echo esc_html($event->academic_calendar_category->en_label) ?>
<?php endif; ?>
</span>
<?php endif; ?>
<?php if ($visual_url): ?>
<img src="<?php echo esc_url($visual_url) ?>" class="img-fluid" alt="<?php echo esc_attr($event->image_description) ?>" title="<?php echo esc_attr($event->image_description) ?>">
<?php endif; ?>
</picture>
</div>
<div class="list-group-teaser-content">
<p class="h5 card-title" itemprop="name"><?php echo esc_html($event->title) ?></p>
<div class="card-info mt-0">
<?php get_template_part('shortcodes/epfl_memento/templates/card-info'); ?>
<?php get_template_part('shortcodes/epfl_memento/templates/card-info'); ?>
</div>
</div>
</div>
Expand All @@ -245,4 +334,4 @@
}
?>
</div>
<?php endif ?>
<?php endif; ?>
2 changes: 1 addition & 1 deletion wp-theme-2018/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI:
Author: Antistatique.net
Author URI: http://antistatique.net/
Description: Description
Version: 1.4.3
Version: 1.4.4
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: epfl
Expand Down

0 comments on commit 118c52c

Please sign in to comment.