From 0e953028f657bc8a48e383edb22a2476ff4496cc Mon Sep 17 00:00:00 2001
From: Hermann <blumh@student.ethz.ch>
Date: Fri, 25 May 2018 14:16:24 +0200
Subject: [PATCH] laad eventform switch states from event.data for editing
 existing events (so price switch is on if there is a price)

---
 src/events/editEvent.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/events/editEvent.js b/src/events/editEvent.js
index dc5508a..8c7a911 100644
--- a/src/events/editEvent.js
+++ b/src/events/editEvent.js
@@ -19,8 +19,6 @@ export default class newEvent extends EditView {
     super(vnode);
     this.currentpage = 1;
     if (!this.data.priority) this.data.priority = 1;
-    this.hasregistration = false;
-    this.hasprice = false;
   }
 
   beforeSubmit() {
@@ -80,6 +78,9 @@ export default class newEvent extends EditView {
   }
 
   view() {
+    this.hasprice = 'price' in this.data;
+    this.hasregistration = 'time_advertising_start' in this.data;
+
     const buttonRight = m(RaisedButton, {
       label: 'next',
       disabled: this.currentpage === 5,
-- 
GitLab