From 1530276282669dfe2429dd2abbaa99b4fedeed8f Mon Sep 17 00:00:00 2001
From: Claudio Fanconi <fanconic@student.ethz.ch>
Date: Sat, 17 Mar 2018 21:04:43 +0100
Subject: [PATCH] Pictures are now retrievable from API

---
 src/views/frontpage.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/views/frontpage.js b/src/views/frontpage.js
index 20d9d68f..fb8c1399 100644
--- a/src/views/frontpage.js
+++ b/src/views/frontpage.js
@@ -1,11 +1,13 @@
 import m from 'mithril';
+import { apiUrl } from '../models/config';
 import * as events from '../models/events';
 
 const date = `${new Date().toISOString().split('.')[0]}Z`;
 
 // Render the frontpage cards, with href and imageurl
 const renderCards = item => {
-  const { title, href, imageurl } = item;
+  const { title, href } = item;
+  const imageurl = item.img_infoscreen ? `${apiUrl}${item.img_infoscreen.file}` : null;
   return m(
     'div.frontpage-card',
     { style: `background-image: url(${imageurl})` },
@@ -15,7 +17,8 @@ const renderCards = item => {
 
 // Render the Hot Cards, with link and imageurl
 const renderHotCards = (item, index) => {
-  const { title, href, imageurl } = item;
+  const { title, href } = item;
+  const imageurl = item.img_infoscreen ? `${apiUrl}${item.img_infoscreen.file}` : null;
   if (index === 0) {
     return m(
       'div.hot-first-card',
@@ -43,7 +46,7 @@ export default class Frontpage {
       sort: ['-priority', 'time_advertising_start'],
     });
 
-    this.events = events.getList().slice(0, 3);
+    this.events = events.getList().slice(6, 9);
 
     // MOCKDATA
     this.hot = [
-- 
GitLab