Skip to content

Commit 608d3f3

Browse files
author
Julien Neuhart
committed
adding new files
1 parent 42448c2 commit 608d3f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+17385
-0
lines changed

Diff for: .env.template

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MYSQL_ROOT_PASSWORD=admin
2+
MYSQL_DATABASE=tutorial
3+
MYSQL_USER=foo
4+
MYSQL_PASSWORD=bar

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

Diff for: sources/app/.env.test

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# define your env variables for the test env here
2+
KERNEL_CLASS='App\Kernel'
3+
APP_SECRET='s$cretf0rt3st'
4+
SYMFONY_DEPRECATIONS_HELPER=999999

Diff for: sources/app/.eslintrc.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"root": true,
3+
"parserOptions": {
4+
"ecmaVersion": 2018,
5+
"sourceType": "module",
6+
"parser": "babel-eslint"
7+
},
8+
"env": {
9+
"browser": true,
10+
"es6": true
11+
},
12+
"extends": [
13+
"eslint:recommended",
14+
"plugin:vue/recommended"
15+
]
16+
}

Diff for: sources/app/.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
###> symfony/framework-bundle ###
3+
/.env.local
4+
/.env.local.php
5+
/.env.*.local
6+
/public/bundles/
7+
/var/
8+
/vendor/
9+
###< symfony/framework-bundle ###
10+
11+
###> symfony/phpunit-bridge ###
12+
.phpunit
13+
/phpunit.xml
14+
###< symfony/phpunit-bridge ###
15+
16+
###> symfony/web-server-bundle ###
17+
/.web-server-pid
18+
###< symfony/web-server-bundle ###
19+
20+
###> squizlabs/php_codesniffer ###
21+
/.phpcs-cache
22+
/phpcs.xml
23+
###< squizlabs/php_codesniffer ###
24+
25+
###> symfony/webpack-encore-bundle ###
26+
/node_modules/
27+
/public/build/
28+
npm-debug.log
29+
yarn-error.log
30+
###< symfony/webpack-encore-bundle ###

Diff for: sources/app/assets/vue/App.vue

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<template>
2+
<div class="container">
3+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
4+
<router-link
5+
class="navbar-brand"
6+
to="/home"
7+
>
8+
App
9+
</router-link>
10+
<button
11+
class="navbar-toggler"
12+
type="button"
13+
data-toggle="collapse"
14+
data-target="#navbarNav"
15+
aria-controls="navbarNav"
16+
aria-expanded="false"
17+
aria-label="Toggle navigation"
18+
>
19+
<span class="navbar-toggler-icon" />
20+
</button>
21+
<div
22+
id="navbarNav"
23+
class="collapse navbar-collapse"
24+
>
25+
<ul class="navbar-nav">
26+
<router-link
27+
class="nav-item"
28+
tag="li"
29+
to="/home"
30+
active-class="active"
31+
>
32+
<a class="nav-link">Home</a>
33+
</router-link>
34+
<router-link
35+
class="nav-item"
36+
tag="li"
37+
to="/posts"
38+
active-class="active"
39+
>
40+
<a class="nav-link">Posts</a>
41+
</router-link>
42+
</ul>
43+
</div>
44+
</nav>
45+
46+
<router-view />
47+
</div>
48+
</template>
49+
50+
<script>
51+
export default {
52+
name: "App",
53+
}
54+
</script>

Diff for: sources/app/assets/vue/api/post.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import axios from "axios";
2+
3+
export default {
4+
create(message) {
5+
return axios.post("/api/post/create", {
6+
message: message
7+
});
8+
},
9+
posts() {
10+
return axios.get("/api/posts");
11+
}
12+
};

Diff for: sources/app/assets/vue/components/Post.vue

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div class="card w-100 mt-2">
3+
<div class="card-body">
4+
{{ message }}
5+
</div>
6+
</div>
7+
</template>
8+
9+
<script>
10+
export default {
11+
name: "Post",
12+
props: {
13+
message: {
14+
type: String,
15+
required: true,
16+
}
17+
}
18+
};
19+
</script>

Diff for: sources/app/assets/vue/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Vue from "vue";
2+
import App from "./App";
3+
import router from "./router";
4+
import store from "./store";
5+
6+
new Vue({
7+
components: { App },
8+
template: "<App/>",
9+
router,
10+
store
11+
}).$mount("#app");

Diff for: sources/app/assets/vue/router/index.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Vue from "vue";
2+
import VueRouter from "vue-router";
3+
import Home from "../views/Home";
4+
import Posts from "../views/Posts";
5+
6+
Vue.use(VueRouter);
7+
8+
export default new VueRouter({
9+
mode: "history",
10+
routes: [
11+
{ path: "/home", component: Home },
12+
{ path: "/posts", component: Posts },
13+
{ path: "*", redirect: "/home" }
14+
]
15+
});

Diff for: sources/app/assets/vue/store/index.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Vue from "vue";
2+
import Vuex from "vuex";
3+
import PostModule from "./post";
4+
5+
Vue.use(Vuex);
6+
7+
export default new Vuex.Store({
8+
modules: {
9+
post: PostModule
10+
}
11+
});

Diff for: sources/app/assets/vue/store/post.js

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import PostAPI from "../api/post";
2+
3+
const CREATING_POST = "CREATING_POST",
4+
CREATING_POST_SUCCESS = "CREATING_POST_SUCCESS",
5+
CREATING_POST_ERROR = "CREATING_POST_ERROR",
6+
FETCHING_POSTS = "FETCHING_POSTS",
7+
FETCHING_POSTS_SUCCESS = "FETCHING_POSTS_SUCCESS",
8+
FETCHING_POSTS_ERROR = "FETCHING_POSTS_ERROR";
9+
10+
export default {
11+
namespaced: true,
12+
state: {
13+
isLoading: false,
14+
error: null,
15+
posts: []
16+
},
17+
getters: {
18+
isLoading(state) {
19+
return state.isLoading;
20+
},
21+
hasError(state) {
22+
return state.error !== null;
23+
},
24+
error(state) {
25+
return state.error;
26+
},
27+
hasPosts(state) {
28+
return state.posts.length > 0;
29+
},
30+
posts(state) {
31+
return state.posts;
32+
}
33+
},
34+
mutations: {
35+
[CREATING_POST](state) {
36+
state.isLoading = true;
37+
state.error = null;
38+
},
39+
[CREATING_POST_SUCCESS](state, post) {
40+
state.isLoading = false;
41+
state.error = null;
42+
state.posts.unshift(post);
43+
},
44+
[CREATING_POST_ERROR](state, error) {
45+
state.isLoading = false;
46+
state.error = error;
47+
state.posts = [];
48+
},
49+
[FETCHING_POSTS](state) {
50+
state.isLoading = true;
51+
state.error = null;
52+
state.posts = [];
53+
},
54+
[FETCHING_POSTS_SUCCESS](state, posts) {
55+
state.isLoading = false;
56+
state.error = null;
57+
state.posts = posts;
58+
},
59+
[FETCHING_POSTS_ERROR](state, error) {
60+
state.isLoading = false;
61+
state.error = error;
62+
state.posts = [];
63+
}
64+
},
65+
actions: {
66+
async create({ commit }, message) {
67+
commit(CREATING_POST);
68+
try {
69+
let response = await PostAPI.create(message);
70+
commit(CREATING_POST_SUCCESS, response.data);
71+
return response.data;
72+
} catch (error) {
73+
commit(CREATING_POST_ERROR, error);
74+
return null;
75+
}
76+
},
77+
async posts({ commit }) {
78+
commit(FETCHING_POSTS);
79+
try {
80+
let response = await PostAPI.posts();
81+
commit(FETCHING_POSTS_SUCCESS, response.data);
82+
return response.data;
83+
} catch (error) {
84+
commit(FETCHING_POSTS_ERROR, error);
85+
return null;
86+
}
87+
}
88+
}
89+
};

Diff for: sources/app/assets/vue/views/Home.vue

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<template>
2+
<div>
3+
<div class="row col">
4+
<h1>Homepage</h1>
5+
</div>
6+
7+
<div class="row col">
8+
<p>This is the homepage of our Vue.js application.</p>
9+
</div>
10+
</div>
11+
</template>
12+
13+
<script>
14+
export default {
15+
name: "Home"
16+
};
17+
</script>

0 commit comments

Comments
 (0)