From a2b43005e2e826aa437b97f37df465b759a9c573 Mon Sep 17 00:00:00 2001
From: "robinwilliam.hundt" <robinwilliam.hundt@stud.uni-goettingen.de>
Date: Mon, 6 Aug 2018 22:45:10 +0200
Subject: [PATCH] Added SubmissionTypesOverview component

---
 frontend/src/components/RegisterDialog.vue    |  4 +-
 .../components/SubmissionTypesOverview.vue    | 60 +++++++++++++++++++
 .../src/pages/reviewer/ReviewerStartPage.vue  |  3 +
 frontend/src/pages/tutor/TutorStartPage.vue   |  3 +
 4 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 frontend/src/components/SubmissionTypesOverview.vue

diff --git a/frontend/src/components/RegisterDialog.vue b/frontend/src/components/RegisterDialog.vue
index feffd1b3..f8c747a8 100644
--- a/frontend/src/components/RegisterDialog.vue
+++ b/frontend/src/components/RegisterDialog.vue
@@ -6,9 +6,9 @@
     <v-card-text>
       <GDPRNotice/>
     </v-card-text>
-    <v-card-action>
+    <v-card-actions>
       <v-btn @click="acceptedGDPR = true">Einwilligen</v-btn>
-    </v-card-action>
+    </v-card-actions>
   </v-card>
   <v-card v-else>
     <v-card-title class="title">
diff --git a/frontend/src/components/SubmissionTypesOverview.vue b/frontend/src/components/SubmissionTypesOverview.vue
new file mode 100644
index 00000000..e96e9614
--- /dev/null
+++ b/frontend/src/components/SubmissionTypesOverview.vue
@@ -0,0 +1,60 @@
+<template>
+  <v-card>
+    <v-card-title class="title">Assignment types</v-card-title>
+      <v-layout row wrap>
+          <v-flex xs3>
+              <v-list>
+                  <v-list-tile
+                          v-for="submissionType in sortedSubmissionTypes" :key="submissionType.pk"
+                          @click="selectedSubmissionType = submissionType"
+                  >
+                    <v-list-tile-content>
+                        {{submissionType.name}}
+                    </v-list-tile-content>
+                  </v-list-tile>
+              </v-list>
+          </v-flex>
+          <v-flex xs9>
+              <v-layout v-if="!selectedSubmissionType" justify-center>
+                  <strong>Select an assignment type on the left to see the description and solution.</strong>
+              </v-layout>
+              <submission-type class="mr-2 mb-2" v-else v-bind="selectedSubmissionType"/>
+          </v-flex>
+      </v-layout>
+  </v-card>
+</template>
+
+<script>
+import {mapState} from 'vuex'
+import SubmissionType from '@/components/SubmissionType'
+export default {
+  name: 'SubmissionTypesOverview',
+  components: {SubmissionType},
+  data () {
+    return {
+      selectedSubmissionType: null
+    }
+  },
+  computed: {
+    ...mapState([
+      'submissionTypes'
+    ]),
+    sortedSubmissionTypes () {
+      return Object.values(this.submissionTypes).sort((t1, t2) => {
+        let lowerName1 = t1.name.toLowerCase()
+        let lowerName2 = t2.name.toLowerCase()
+        if (lowerName1 < lowerName2) {
+          return -1
+        } else if (lowerName1 > lowerName2) {
+          return 1
+        }
+        return 0
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>
diff --git a/frontend/src/pages/reviewer/ReviewerStartPage.vue b/frontend/src/pages/reviewer/ReviewerStartPage.vue
index 19db7cea..c049278d 100644
--- a/frontend/src/pages/reviewer/ReviewerStartPage.vue
+++ b/frontend/src/pages/reviewer/ReviewerStartPage.vue
@@ -11,6 +11,7 @@
         <subscription-list class="ma-4"></subscription-list>
       </v-flex>
     </v-layout>
+    <SubmissionTypesOverview class="ma-4"/>
   </div>
 </template>
 
@@ -18,9 +19,11 @@
 import CorrectionStatistics from '@/components/CorrectionStatistics'
 import WelcomeJumbotron from '@/components/WelcomeJumbotron'
 import SubscriptionList from '@/components/subscriptions/SubscriptionList'
+import SubmissionTypesOverview from '@/components/SubmissionTypesOverview'
 
 export default {
   components: {
+    SubmissionTypesOverview,
     SubscriptionList,
     WelcomeJumbotron,
     CorrectionStatistics},
diff --git a/frontend/src/pages/tutor/TutorStartPage.vue b/frontend/src/pages/tutor/TutorStartPage.vue
index a352530c..3d57117c 100644
--- a/frontend/src/pages/tutor/TutorStartPage.vue
+++ b/frontend/src/pages/tutor/TutorStartPage.vue
@@ -11,6 +11,7 @@
         <subscription-list class="ma-4"></subscription-list>
       </v-flex>
     </v-layout>
+    <SubmissionTypesOverview class="ma-4"/>
   </div>
 </template>
 
@@ -18,9 +19,11 @@
 import SubscriptionList from '@/components/subscriptions/SubscriptionList'
 import CorrectionStatistics from '@/components/CorrectionStatistics'
 import WelcomeJumbotron from '@/components/WelcomeJumbotron'
+import SubmissionTypesOverview from '@/components/SubmissionTypesOverview'
 
 export default {
   components: {
+    SubmissionTypesOverview,
     WelcomeJumbotron,
     CorrectionStatistics,
     SubscriptionList},
-- 
GitLab