Header.vue 2.88 KB
Newer Older
1
2
<template>
  <header>
3
4
5
    <b-container>
      <b-row class="header-branding">
        <b-col md="10">
6
          <span class="header-title"><router-link to="home">AUTOradio dashboard</router-link></span>
7
8
        </b-col>
        <b-col md="2" class="d-none d-sm-none d-md-block">
9
          <a href="http://o94.at" target="new"><img class="header-logo" src="../assets/logo.jpg" /></a>
10
11
12
13
        </b-col>
      </b-row>
      <b-row>
        <b-col md="1">
14
          <router-link to="help"><img src="../assets/help-browser-32x32.png" alt="Help symbol" title="Go to help pages" v-on:click="activeModule.route = 'help'"></router-link>
15
16
        </b-col>
        <b-col md="9">
17
18
19
20
21
22
          <nav>
            Go to:
            <select v-model="activeModule.route" v-on:change="activateModule">
              <option v-for="mod in modules" v-bind:value="mod.slug">{{ mod.title }}</option>
            </select>
          </nav>
23
24
        </b-col>
        <b-col md="2">
25
          <div v-if="user.logged_in">
26
            {{ user.name }}
27
28
29
            <router-link v-bind:to="{ name: 'login', params: { action: 'logout'} }"><img src="../assets/16x16/media-eject.png" alt="log-out symbol" title="Log out" v-on:click="user.logged_in = !user.logged_in"></router-link>
          </div>
          <div v-if="! user.logged_in">
30
            not logged in <router-link to="login"><img src="../assets/16x16/system-users.png" alt="log-in symbol" title="Log in" v-on:click="user.logged_in = !user.logged_in"></router-link>
31
          </div>
32
33
34
        </b-col>
      </b-row>
    </b-container>
35
36
37
38
39
40
41
42
43
44
45
46
  </header>
</template>

<script>
export default {
  props: {
    modules: { type: Array, required: true },
    activeModule: { type: Object, required: true },
    user: { type: Object, required: true }
  },
  methods: {
    activateModule () {
47
      this.$router.push('/' + this.activeModule.route)
48
    }
49
50
51
  },
  created () {
    this.activateModule()
52
53
54
55
  }
}
</script>

56
<style scoped>
57
header {
58
59
60
61
62
63
64
  background: #ad7fa8; /* for browsers that don't support gradients */
/*  background: linear-gradient(#ad7fa8, #888a85); /* light magenta to light alu */
/*  background: linear-gradient(#ad7fa8, #555753); /* light magenta to medium alu */
/*  background: linear-gradient(#ad7fa8, #5c3566); /* light magenta to dark magenta */
/*  background: linear-gradient(#ad7fa8, #75507b); /* light magenta to medium magenta */
/*  background: linear-gradient(#5c3566, #555753); /* dark magenta to light alu */
  background: linear-gradient(#5c3566, #ad7fa8); /* dark magenta to light magenta */
65
  border-bottom: 1px solid #5c3566;
66
67
  padding-bottom: 1em;
  margin-bottom: 2em;
68
}
69
70
div.container {
  text-align: center;
71
72
73
74
75
76
77
}
.header-branding {
  height: 75px;
  line-height: 75px;
}
.header-title {
  font-size: 3em;
78
  font-weight: bold;
79
80
  vertical-align: middle;
}
81
82
83
84
85
.header-title a {
  text-decoration: none;
  color: #2e3436;
  text-shadow: #ccc 0 0 10px;
}
86
87
88
89
90
91
.header-logo {
  width: 75px;
  height: 75px;
}

</style>