Skip to content

Commit 4192a27

Browse files
committed
Merge branch 'master' into develop
2 parents 9697cc0 + 165c01f commit 4192a27

File tree

27 files changed

+771
-665
lines changed

27 files changed

+771
-665
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Make sure you have installed **Node** and [**Yarn**](https://yarnpkg.com/) (late
4444
* `touch database/database.sqlite` to create an empty database file
4545
* `cp .env.example .env` to configure installation
4646
* `php artisan key:generate` to generate unique key for the project
47+
* `php artisan jwt:secret` to generate unique key for the project
4748
* `php artisan migrate` to create all the tables
4849
* `php artisan db:seed` to fill the tables with fake data
4950
* `php artisan serve` to serve application on localhost:8000

client/config/dev.env.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ var merge = require('webpack-merge')
22
var prodEnv = require('./prod.env')
33

44
module.exports = merge(prodEnv, {
5-
NODE_ENV: '"development"'
5+
NODE_ENV: '"development"',
6+
API_URL: '"http://localhost:8000/api"',
67
})

client/config/prod.env.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
NODE_ENV: '"production"',
3-
API_URL: '"http://localhost:8000/api"',
3+
API_URL: '"https://spa.vedcasts.com.br/api"',
44
}

client/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<title>Codecasts.com.br - SPA - Starter Kit</title>
66
</head>
77
<body>
8+
<a href="https://github.com/codecasts/spa-starter-kit"><img style="position: absolute; top: 0; left: 0; border: 0; z-index: 2;" src="https://camo.githubusercontent.com/121cd7cbdc3e4855075ea8b558508b91ac463ac2/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_left_green_007200.png"></a>
89
<div id="app"></div>
910
<!-- built files will be auto injected -->
1011
</body>

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"bootstrap-sass": "^3.3.7",
1818
"font-awesome": "^4.7.0",
1919
"jquery": "^3.1.1",
20+
"lodash": "^4.17.2",
2021
"sweetalert": "^1.1.3",
2122
"vue": "^2.0.1",
2223
"vue-router": "^2.0.1",

client/src/Root.vue

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,11 @@ export default {
1919
<template>
2020
<div id="app">
2121
<cc-nav-bar v-show="shouldShowNavigation"></cc-nav-bar>
22-
<cc-alerts></cc-alerts>
2322
<div class="container">
24-
<transition name="fade">
25-
<router-view></router-view>
26-
</transition>
23+
<cc-alerts></cc-alerts>
24+
<router-view></router-view>
2725
</div>
2826
</div>
2927
</template>
3028

3129
<style lang="sass" src="assets/sass/app.scss"></style>
32-
33-
<style scoped>
34-
.fade-enter-active, .fade-leave-active {
35-
transition: opacity .5s ease;
36-
}
37-
.fade-enter, .fade-leave-active {
38-
opacity: 0;
39-
}
40-
</style>

client/src/app/categories/form.vue

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,18 @@
4040
isEditing() {
4141
return this.category.id > 0
4242
},
43+
isValid() {
44+
this.resetMessages()
45+
if (this.category.name === '') {
46+
this.setMessage({ type: 'error', message: ['Please fill category name'] })
47+
return false
48+
}
49+
return true
50+
},
4351
},
4452
4553
methods: {
46-
...mapActions(['setFetching', 'setMessage']),
54+
...mapActions(['setFetching', 'resetMessages', 'setMessage']),
4755
4856
/**
4957
* If there's an ID in the route params
@@ -74,14 +82,19 @@
7482
},
7583
submit() {
7684
/**
77-
* Shows the global spinner
85+
* Pre-conditions are met
7886
*/
79-
this.setFetching({ fetching: true })
87+
if (this.isValid) {
88+
/**
89+
* Shows the global spinner
90+
*/
91+
this.setFetching({ fetching: true })
8092
81-
if (this.isEditing) {
82-
this.update()
83-
} else {
84-
this.save()
93+
if (this.isEditing) {
94+
this.update()
95+
} else {
96+
this.save()
97+
}
8598
}
8699
},
87100
save() {
@@ -111,7 +124,7 @@
111124
})
112125
},
113126
update() {
114-
this.$http.put(`categories/${this.category.id}/update`, { category: this.category }).then(() => {
127+
this.$http.put(`categories/${this.category.id}/update`, this.category).then(() => {
115128
/**
116129
* This event will notify the world about
117130
* the category creation. In this case

client/src/app/dashboard/main.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@
77

88
<template>
99
<div>
10-
<blockquote>
11-
A highly opinionated Single Page Application starter kit built on top of Vue.js and Laravel.
12-
</blockquote>
10+
<div class="text-center">
11+
<img class="cover" src="http://vedovelli.com.br/spas.png" alt="Codecasts Single Page Application starter kit">
12+
<h4>A highly opinionated Single Page Application starter kit built on top of Vue.js and Laravel.</h4>
13+
</div>
1314
</div>
1415
</template>
16+
17+
<style scoped>
18+
.cover {
19+
max-width: 800px;
20+
}
21+
</style>

client/src/app/routes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ import { routes as login } from './login'
44

55
// https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Operators/Spread_operator
66
// Thus a new array is created, containing all objects that match the routes.
7-
export default [...login, ...dashboard, ...categories]
7+
// ...dashboard must be the last one because of the catchall instruction
8+
export default [...login, ...categories, ...dashboard]

client/src/components/general/alerts.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
<script>
33
import { mapState, mapActions } from 'vuex'
4+
import { isEmpty } from 'lodash'
45
56
export default {
67
computed: {
@@ -11,13 +12,18 @@
1112
hasErrorMessages() {
1213
return this.messages.error.length > 0
1314
},
15+
hasValidationMessages() {
16+
return !isEmpty(this.messages.validation)
17+
},
1418
},
1519
methods: {
1620
...mapActions(['setMessage']),
1721
dismiss(type) {
1822
let obj
1923
if (type === 'error') {
2024
obj = { type, message: [] }
25+
} else if (type === 'validation') {
26+
obj = { type, message: {} }
2127
} else {
2228
obj = { type, message: '' }
2329
}
@@ -48,5 +54,15 @@
4854
</ul>
4955
</div>
5056

57+
<!-- Validation messages -->
58+
<div class="alert alert-danger" v-show="hasValidationMessages">
59+
<button type="button" class="close" aria-label="Close" @click="dismiss('validation')">
60+
<span aria-hidden="true">&times;</span>
61+
</button>
62+
<ul>
63+
<li v-for="error in messages.validation">{{ error[0] }}</li>
64+
</ul>
65+
</div>
66+
5167
</div>
5268
</template>

0 commit comments

Comments
 (0)