To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit c386dd47 authored by Sandro Lutz's avatar Sandro Lutz Committed by Sandro Lutz
Browse files

Add embedded event calendar

parent 1276aab3
......@@ -5,6 +5,7 @@
@import './dimensions.less';
@import './errors.less';
@import './eventList.less';
@import './eventCalendar.less';
@import './eventDetails.less';
@import './filteredListPage.less';
@import './footer.less';
......
@import './colors.less';
.events-calendar {
transition: background 300ms cubic-bezier(.4, 0, .2, 1) !important;
background-color: @color-grey;
&.expanded {
background-color: @color-white;
}
.pe-toolbar {
background-color: transparent;
}
}
.events-calendar-container {
margin-bottom: -6px;
width: 100%;
height: 100%;
> * {
width: 100%;
}
}
import m from 'mithril';
import DropdownCard from 'amiv-web-ui-components/src/dropdownCard';
import { i18n } from '../../models/language';
let expanded = false;
export default class EventCalendar {
static view() {
const animationDuration = 300; // in ms
return m(DropdownCard, {
className: ['events-calendar', expanded ? 'expanded' : null].join(' '),
expanded,
separated: false,
duration: animationDuration,
onChange: expandedArg => {
expanded = expandedArg;
},
title: i18n('events.agenda'),
content: m(
'div.events-calendar-container',
m.trust(
'<iframe src="https://calendar.google.com/calendar/embed?showTitle=0&amp;showPrint=0&amp;showTabs=0&amp;showCalendars=0&amp;showTz=0&amp;height=600&amp;wkst=2&amp;bgcolor=%23FFFFFF&amp;src=mdk91hfvr18q8rrlh3sedlhgvo%40group.calendar.google.com&amp;color=%23B1365F&amp;ctz=Europe%2FZurich" style="border-width:0" width="800" height="600" frameborder="0" scrolling="no"></iframe>'
)
),
});
}
}
......@@ -6,6 +6,7 @@ import logos from '../../images/logos';
import { i18n, currentLocale } from '../../models/language';
import { EventController } from '../../models/events';
import { FilteredListPage, FilteredListDataStore } from '../filteredListPage';
import EventCalendar from './eventCalendar';
const controller = new EventController({}, true);
const dataStore = new FilteredListDataStore();
......@@ -79,18 +80,6 @@ export default class EventList extends FilteredListPage {
],
},
{ type: 'hr' },
{
type: 'button',
label: i18n('events.agenda'),
className: 'flat-button',
events: {
onclick: () =>
window.open(
'https://calendar.google.com/calendar/embed?src=mdk91hfvr18q8rrlh3sedlhgvo%40group.calendar.google.com',
'_blank'
),
},
},
{
type: 'button',
label: i18n('reset'),
......@@ -141,7 +130,13 @@ export default class EventList extends FilteredListPage {
// eslint-disable-next-line class-methods-use-this
get _lists() {
const lists = [];
const lists = [
{
name: 'calendar',
permanent: true,
items: [m(EventCalendar, { controller, dataStore })],
},
];
if (controller.openRegistrationEvents.length > 0) {
lists.push({
......@@ -172,6 +167,9 @@ export default class EventList extends FilteredListPage {
// eslint-disable-next-line class-methods-use-this
_renderItem(event, list, selectedId) {
if (!event) return m('');
if (list === 'calendar') {
return event;
}
const animationDuration = 300; // in ms
const imageurl = event.img_thumbnail ? `${apiUrl}${event.img_thumbnail.file}` : logos.amivWheel;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment