From 6f1bf8736570451bbc1799e9a298b161401517f8 Mon Sep 17 00:00:00 2001
From: lioneltrebuchon <ltrebuchon@gmail.com>
Date: Sat, 2 Dec 2017 20:56:18 +0100
Subject: [PATCH] Added event keyDescriptors etc.. to config.json, added
 NewEvent etc... to eventTools.js.

---
 src/config.json  | 16 ++++++++++++++++
 src/eventTool.js | 11 ++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/config.json b/src/config.json
index 8734870..1db1a7d 100644
--- a/src/config.json
+++ b/src/config.json
@@ -1,5 +1,21 @@
 {
     "apiUrl": "https://amiv-api.ethz.ch/",
+    "Events": {
+        "keyDescriptors": {
+            "title_de": "Titel in Deutsch",
+            "title_en": "Title in English",
+            "location": "Location (Ort) of the event",
+            "allow_email_signup": "Event open for non-AMIV members",
+            "show_website": "Event is shown on the website",
+            "priority": "TODO: What type of priority is meant here? Edit priority? Organization prio?"
+        },
+        "tableKeys": [
+            "title_de",
+            "location",
+            "show_website",
+            "priority"
+        ]
+    },
     "Users": {
         "keyDescriptors": {
             "legi": "Legi Number",
diff --git a/src/eventTool.js b/src/eventTool.js
index a511fca..6989869 100644
--- a/src/eventTool.js
+++ b/src/eventTool.js
@@ -1,13 +1,13 @@
 import { ItemView } from './views/itemView';
 import { EditView, inputGroup, selectGroup, submitButton } from './views/editView';
 import TableView from './views/tableView';
-import { Users as config } from './config.json';
+import { Events as config } from './config.json';
 
 const m = require('mithril');
 
 class EventView extends ItemView {
   constructor() {
-    super('event');
+    super('events');
     this.memberships = [];
   }
 
@@ -57,9 +57,6 @@ class EventView extends ItemView {
           embedded: { event: 1 },
         },
       }),
-      m(TableView, {
-        resource: '',
-      }),
     ]);
   }
 }
@@ -130,7 +127,7 @@ export class NewEvent extends EventEdit {
     };
     this.valid = false;
 
-    // if the creation is finished, UI should switch to new User
+    // if the creation is finished, UI should switch to new Event
     this.callback = (response) => { m.route.set(`/events/${response.data._id}`); };
   }
 
@@ -170,7 +167,7 @@ export class EventModal {
 export class EventTable {
   view() {
     return m(TableView, {
-      resource: 'users',
+      resource: 'events',
       keys: config.tableKeys,
       titles: config.tableKeys.map(key => config.keyDescriptors[key] || key),
     });
-- 
GitLab