Commit 83e443e0 authored by Paul Jongsma's avatar Paul Jongsma

displayname in global store.displayname instead of computed

parent edca34d5
......@@ -103,7 +103,7 @@
components: {
Dropzone,
MyLabel
},
},
mounted: function () {
//init foundation on this compoment and create ref to global store
$(this.$el).foundation();
......
......@@ -83,7 +83,7 @@
<ul class="menu align-right">
<li @click="gotoprofile" class="username" v-if="this.$store.state.loggedIn">
<!--router-link to="/my/profile">{{displayname}}</router-link-->
{{displayname}}
{{this.$store.state.displayname}}
</li>
......@@ -159,14 +159,15 @@
window.jQuery(document).foundation();
},
computed: {
displayname: function (e) {
var a = [
this.$store.state.user.name,
this.$store.state.user.login,
this.$store.state.user.email
]
return a.filter(n => n)[0] || 'Anonymous'
}
// moved to main
// displayname: function (e) {
// var a = [
// this.$store.state.user.name,
// this.$store.state.user.login,
// this.$store.state.user.email
// ]
// return a.filter(n => n)[0] || 'Anonymous'
// }
},
methods: {
gotoprofile: function (e) {
......
......@@ -44,6 +44,7 @@ const store = new Vuex.Store({
state: {
count: 0,
loggedIn: false,
displayname: 'Anonymous',
user: {},
activity: {
next: dummy,
......@@ -98,6 +99,15 @@ const store = new Vuex.Store({
setUser (state, user) {
state.user = user
state.displayname = function (e) {
var a = [
state.user.name,
state.user.login,
state.user.email
]
return a.filter(n => n)[0] || 'Anonymous'
}()
}
}
})
......
......@@ -8,9 +8,15 @@
</div>
<div class="title-bar-right">
<ul class="menu simple align-right">
<li><a href="/#/builder"><i class="fa fa-arrow-left"></i> Back to Builder</a></li>
<li><a href=""><i class="fa fa-sign-in"></i> Login</a></li>
<li><a href=""><i class="fa fa-user"></i> Register</a></li>
<li><a href="/#/builder"><i class="fa fa-arrow-left"></i> Back to Builder</a></li>
<li v-if="this.$store.state.loggedIn" class="username">
<!--router-link to="/my/profile">{{displayname}}</router-link-->
{{this.$store.state.displayname}}
</li>
<li v-else><a href=""><i class="fa fa-sign-in"></i> Login</a></li>
<li v-else><a href=""><i class="fa fa-user"></i> Register</a></li>
</ul>
</div>
</div>
......@@ -89,6 +95,14 @@
import navBuildingBlock from '../tags/navBuildingBlock'
export default {
name: 'builder-editor',
created () {
this.$on('some-event',function() {
// window.alert('someeventdonxxe')
console.log('** help clicked')
})
},
components: {
navBuildingBlock
},
......@@ -103,7 +117,7 @@
this.$store.state.activity.prev = blocks[ blockOrder[blockOrder.indexOf(current) - 1] ] || {href: null}
}
},
computed: {
computed: {
blocks () {
console.log('computed blocksssss: ')
return this.$store.state.activity.bblocks
......@@ -131,6 +145,7 @@
var blockOrder = this.$store.state.activity.blockOrder
this.$store.state.activity.currentBlock = current
this.$store.state.activity.currentType = blocks[current].type
this.$store.state.activity.next = blocks[ blockOrder[blockOrder.indexOf(current) + 1] ] || {href: null}
this.$store.state.activity.prev = blocks[ blockOrder[blockOrder.indexOf(current) - 1] ] || {href: null}
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment