Skip to content
Snippets Groups Projects
Commit 15302762 authored by fanconic's avatar fanconic
Browse files

Pictures are now retrievable from API

parent 4b6c554c
No related branches found
No related tags found
1 merge request!46Pictures are now retrievable from API
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 = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment