Header.vue 2.9 KB
Newer Older
1
2
<template>
  <header>
3
4
5
6
7
8
9
10
    <div class="container">
      <div class="row header-branding">
        <div class="col-9">
          <span class="header-title"><router-link to="home">AUTOradio dashboard</router-link></span>
        </div>
        <div class="col-3 header-right">
          <a href="http://o94.at" target="new"><img class="header-logo" src="../assets/logo.jpg" /></a>
        </div>
11
      </div>
12
13
14
      <div class="row">
        <div class="col-3">
          <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
        </div>
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
        <div class="col-6">
          <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>
        </div>
        <div class="col-3 header-right">
          <div v-if="user.logged_in">
            Logged in as: {{ user.name }}
            <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">
            You are 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>
          </div>
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
        </div>
      </div>
    </div>
  </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
56
57
  }
}
</script>

<style>
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
66
67
68
69
70
71
72
73
  border-bottom: 1px solid #5c3566;
}
nav {
  text-align: left;
}
.header-branding {
  height: 75px;
  line-height: 75px;
}
74
75
76
.header-right {
  text-align: right;
}
77
78
.header-title {
  font-size: 3em;
79
  font-weight: bold;
80
81
  vertical-align: middle;
}
82
83
84
85
86
.header-title a {
  text-decoration: none;
  color: #2e3436;
  text-shadow: #ccc 0 0 10px;
}
87
88
89
90
91
92
.header-logo {
  width: 75px;
  height: 75px;
}

</style>