Skip to content

Commit e25c4ca

Browse files
committed
Fixes bug with adding messages not clearing text-field and link not found error.
1 parent 4f4fca5 commit e25c4ca

File tree

6 files changed

+60
-59
lines changed

6 files changed

+60
-59
lines changed

app/components/navigation.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ nav.navbar.navbar-default.navbar-custom.navbar-fixed-top
55
button.navbar-toggle(type='button', data-toggle='collapse', data-target='#headbar-navbar')
66
span.sr-only Toggle navigation
77
i.fa.fa-bars
8-
a.navbar-brand(v-link="{path: '/'}") Feathers-Vue
8+
router-link.navbar-brand(to="/") Feathers-Vue
99
#headbar-navbar.collapse.navbar-collapse
1010
ul.nav.navbar-nav.navbar-right
1111
li(v-for="route in routes" v-if="!route.meta.excludeMenu")

app/components/simple-input.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<template lang="pug">
22
.form-group(:class="{'has-error': error, 'has-success': !error }")
3-
label(:for='randomId', v-once='', v-if='label') {{label}}
4-
.input-group(v-if='addon', v-once='')
3+
label(:for='randomId', v-once v-if='label') {{label}}
4+
.input-group(v-if='addon')
55
.input-group-addon(v-html='addon')
66
input.form-control(
77
:id='randomId',
88
type='text',
99
@input="$emit('input', $event.target.value)",
1010
:name='label',
11-
:type='safeType',
11+
:type='safeType',
12+
:value="value",
1213
:placeholder='label',
1314
@keyup="$emit('keyup', $event)",
1415
@keydown="$emit('keydown', $event)")
@@ -19,7 +20,8 @@
1920
@input="$emit('input', $event.target.value)",
2021
:name='label',
2122
:type='safeType',
22-
:placeholder='label',
23+
:placeholder='label',
24+
:value="value",
2325
@keyup="$emit('keyup', $event)",
2426
@keydown="$emit('keydown', $event)")
2527
.help-block.with-errors {{error}}

app/views/home.vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
)
2424
.alert.alert-danger(v-show="errorsSummary" v-html="errorsSummary")
2525
button.btn.btn-success(@click="sendMessage(newMessage)") Add Message
26-
2726
</template>
2827

2928
<script>
@@ -38,7 +37,6 @@ module.exports = {
3837
userId: null,
3938
errors: {}
4039
},
41-
newMessageText: '',
4240
errorsSummary: ''
4341
}),
4442
store: ['message', 'auth', 'currentModal', 'messages', 'api', 'validateLive'],
@@ -61,25 +59,26 @@ module.exports = {
6159
let valid = await checkValid(mes, 'message')
6260
if(valid) {
6361
let [err, message] = await api.messages.upsert(mes)
64-
if(err) { notify.error(parseErrors(err)); }
62+
if(err) { notify.error(parseErrors(err)); }
6563
} else {
6664
Vue.set(m, 'errors', mes.errors)
6765
}
6866
},
6967
7068
sendMessage: async function(data) {
71-
if(!_.get(this, 'auth.currentUser._id')) {
72-
this.errorsSummary = "You must be logged in."
73-
return false;
74-
}
69+
if(!_.get(this, 'auth.currentUser._id')) {
70+
this.errorsSummary = "You must be logged in."
71+
return false;
72+
}
7573
76-
data.userId = _.get(this, 'auth.currentUser._id');
74+
data.userId = _.get(this, 'auth.currentUser._id');
7775
7876
let valid = await checkValid(data, 'message')
7977
8078
if(valid) {
8179
this.errorsSummary = ''
8280
var [err, success] = await api.messages.upsert(data)
81+
this.newMessage.text = ''
8382
} else {
8483
this.errorsSummary = _.map(data.errors, err => err).join('<br>')
8584
}

public/main.js

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -49311,7 +49311,6 @@ module.exports = {
4931149311
userId: null,
4931249312
errors: {}
4931349313
},
49314-
newMessageText: '',
4931549314
errorsSummary: ''
4931649315
};
4931749316
},
@@ -49439,7 +49438,7 @@ module.exports = {
4943949438
valid = _context3.sent;
4944049439

4944149440
if (!valid) {
49442-
_context3.next = 17;
49441+
_context3.next = 18;
4944349442
break;
4944449443
}
4944549444

@@ -49452,15 +49451,17 @@ module.exports = {
4945249451
_ref9 = (0, _slicedToArray3.default)(_ref8, 2);
4945349452
err = _ref9[0];
4945449453
success = _ref9[1];
49455-
_context3.next = 18;
49454+
49455+
this.newMessage.text = '';
49456+
_context3.next = 19;
4945649457
break;
4945749458

49458-
case 17:
49459+
case 18:
4945949460
this.errorsSummary = _.map(data.errors, function (err) {
4946049461
return err;
4946149462
}).join('<br>');
4946249463

49463-
case 18:
49464+
case 19:
4946449465
case 'end':
4946549466
return _context3.stop();
4946649467
}
@@ -51068,7 +51069,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
5106851069
_vm.sendMessage(_vm.newMessage)
5106951070
}
5107051071
}
51071-
}, [_vm._v("Add Message")])], 1)])
51072+
}, [_vm._v("Add Message")]), _c('div', [_vm._v(_vm._s(_vm.newMessage.text))])], 1)])
5107251073
},staticRenderFns: []}
5107351074
module.exports.render._withStripped = true
5107451075
if (false) {
@@ -72015,17 +72016,12 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
7201572016
staticClass: "container-fluid"
7201672017
}, [_c('div', {
7201772018
staticClass: "navbar-header page-scroll"
72018-
}, [_vm._m(0), _c('a', {
72019-
directives: [{
72020-
name: "link",
72021-
rawName: "v-link",
72022-
value: ({
72023-
path: '/'
72024-
}),
72025-
expression: "{path: '/'}"
72026-
}],
72027-
staticClass: "navbar-brand"
72028-
}, [_vm._v("Feathers-Vue")])]), _c('div', {
72019+
}, [_vm._m(0), _c('router-link', {
72020+
staticClass: "navbar-brand",
72021+
attrs: {
72022+
"to": "/"
72023+
}
72024+
}, [_vm._v("Feathers-Vue")])], 1), _c('div', {
7202972025
staticClass: "collapse navbar-collapse",
7203072026
attrs: {
7203172027
"id": "headbar-navbar"
@@ -72127,7 +72123,14 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
7212772123
class: {
7212872124
'has-error': _vm.error, 'has-success': !_vm.error
7212972125
}
72130-
}, [(_vm.label) ? _vm._m(0) : _vm._e(), (_vm.addon) ? _vm._m(1) : _vm._e(), (!_vm.addon) ? _c('input', {
72126+
}, [(_vm.label) ? _vm._m(0) : _vm._e(), (_vm.addon) ? _c('div', {
72127+
staticClass: "input-group"
72128+
}, [_c('div', {
72129+
staticClass: "input-group-addon",
72130+
domProps: {
72131+
"innerHTML": _vm._s(_vm.addon)
72132+
}
72133+
}), _c('input', {
7213172134
staticClass: "form-control",
7213272135
attrs: {
7213372136
"id": _vm.randomId,
@@ -72136,6 +72139,9 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
7213672139
"type": _vm.safeType,
7213772140
"placeholder": _vm.label
7213872141
},
72142+
domProps: {
72143+
"value": _vm.value
72144+
},
7213972145
on: {
7214072146
"input": function($event) {
7214172147
_vm.$emit('input', $event.target.value)
@@ -72147,24 +72153,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
7214772153
_vm.$emit('keydown', $event)
7214872154
}
7214972155
}
72150-
}) : _vm._e(), _c('div', {
72151-
staticClass: "help-block with-errors"
72152-
}, [_vm._v(_vm._s(_vm.error))])])
72153-
},staticRenderFns: [function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
72154-
return _c('label', {
72155-
attrs: {
72156-
"for": _vm.randomId
72157-
}
72158-
}, [_vm._v(_vm._s(_vm.label))])
72159-
},function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
72160-
return _c('div', {
72161-
staticClass: "input-group"
72162-
}, [_c('div', {
72163-
staticClass: "input-group-addon",
72164-
domProps: {
72165-
"innerHTML": _vm._s(_vm.addon)
72166-
}
72167-
}), _c('input', {
72156+
})]) : _vm._e(), (!_vm.addon) ? _c('input', {
7216872157
staticClass: "form-control",
7216972158
attrs: {
7217072159
"id": _vm.randomId,
@@ -72173,6 +72162,9 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
7217372162
"type": _vm.safeType,
7217472163
"placeholder": _vm.label
7217572164
},
72165+
domProps: {
72166+
"value": _vm.value
72167+
},
7217672168
on: {
7217772169
"input": function($event) {
7217872170
_vm.$emit('input', $event.target.value)
@@ -72184,7 +72176,15 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
7218472176
_vm.$emit('keydown', $event)
7218572177
}
7218672178
}
72187-
})])
72179+
}) : _vm._e(), _c('div', {
72180+
staticClass: "help-block with-errors"
72181+
}, [_vm._v(_vm._s(_vm.error))])])
72182+
},staticRenderFns: [function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
72183+
return _c('label', {
72184+
attrs: {
72185+
"for": _vm.randomId
72186+
}
72187+
}, [_vm._v(_vm._s(_vm.label))])
7218872188
}]}
7218972189
module.exports.render._withStripped = true
7219072190
if (false) {

public/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/vue-ssr-server-bundle.json

Lines changed: 8 additions & 8 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)