summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/SettingsModule.vue
blob: b7625ef2be1f109b255fee3ad090a68ac2a30fa1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<i18n>
{
  "en": {
    "darkTheme": "Dark Theme",
    "clipped": "Show drawer under the top bar",
    "mini": "Show icons in collapsed drawer"
  },
  "de": {
    "darkTheme": "Dark Theme",
    "clipped": "Zeige den Drawer unter der Hauptleiste",
    "mini": "Zeige die Symbole im eingeklappten Drawer"
  }
}
</i18n>

<template>
  <v-container>
    <v-layout>
      <v-flex md4 offset-md4 sm10 offset-sm1>
        <v-select
          class="lang-select"
          :items="langChoices"
          v-model="locale"
          solo
        ></v-select>
        <v-switch
          :label="$t('darkTheme')"
          v-model="dark"
          color="primary"
        ></v-switch>
        <v-switch
          :label="$t('clipped')"
          v-model="clipped"
          color="primary"
          class="hidden-md-and-down"
        ></v-switch>
        <v-switch
          :label="$t('mini')"
          v-model="mini"
          color="primary"
          class="hidden-md-and-down"
        ></v-switch>
      </v-flex>
    </v-layout>
  </v-container>
</template>

<script>

export default {
  name: 'SettingsPage',
  data () {
    return {
      langChoices: [ { text: 'Deutsch', value: 'de' }, { text: 'English', value: 'en' } ]
    }
  },
  computed: {
    locale: {
      get () { return this.$store.state.locale },
      set (value) { this.$store.commit('setLocale', value) }
    },
    dark: {
      get () { return this.$store.state.dark },
      set (value) { this.$store.commit('setDark', value) }
    },
    clipped: {
      get () { return this.$store.state.clipped },
      set (value) { this.$store.commit('setClipped', value) }
    },
    mini: {
      get () { return this.$store.state.mini },
      set (value) { this.$store.commit('setMini', value) }
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

.lang-select {
  margin-top: 40px;
  margin-bottom: 40px;
}

</style>