Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonin Savoie committed Oct 17, 2018
0 parents commit 0d75ed3
Show file tree
Hide file tree
Showing 77 changed files with 18,641 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=9afc5127615b7bac8e2f7f3e51210fec
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
###> symfony/framework-bundle ###
/.env
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/phpunit-bridge ###
.phpunit
/phpunit.xml
###< symfony/phpunit-bridge ###

###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###

###> symfony/webpack-encore-pack ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-pack ###

/idea/
Empty file added assets/.gitignore
Empty file.
3 changes: 3 additions & 0 deletions assets/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background-color: lightgray;
}
39 changes: 39 additions & 0 deletions assets/js/RecipeComponentsWebpack/Recipe.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div>
<label>Portions :</label>
<input type="number" v-model="serving">
<button @click="decreaseServing">-</button>
<button @click="increaseServing">+</button>

<div class="Recipe-IngredientList">
<RecipeIngredient name="Farine" :serving="serving" base-value="100" metric="g"></RecipeIngredient>
<RecipeIngredient name="Oeuf" :serving="serving" base-value="2" metric=""/>
<RecipeIngredient name="Lait" :serving="serving" base-value="150" metric="mL"/>
<RecipeIngredient name="Lardon" :serving="serving" base-value="50" metric="g"/>
</div>
</div>
</template>

<script>
import RecipeIngredient from './components/RecipeIngredient'
export default {
name: 'Recipe',
components: {
RecipeIngredient
},
data() {
return {
serving: 1
}
},
methods: {
decreaseServing() {
this.serving = this.serving - 1
},
increaseServing() {
this.serving = this.serving + 1
}
}
}
</script>
10 changes: 10 additions & 0 deletions assets/js/RecipeComponentsWebpack/components/RecipeIngredient.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div class="Recipe-Ingredient">{{ name }} : <span>{{ serving * baseValue }}</span>{{ metric }}</div>
</template>

<script>
export default {
name: 'RecipeIngredient',
props: ['name', 'serving', 'baseValue', 'metric']
}
</script>
Empty file added assets/js/Vue/mixins/mixin.js
Empty file.
Empty file added assets/js/Vue/plugins/plugin.js
Empty file.
18 changes: 18 additions & 0 deletions assets/js/Widgets/MyFirstWidget/MyFirstWidget.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div class="MyFirstWidget">
<h1>I'm the first widget ! And my name is : {{ widgetName }}</h1>
<WidgetChild/>
</div>
</template>

<script>
import WidgetChild from './components/WidgetChild'
export default {
name: 'MyFirstWidget',
props: ['widgetName'],
components: {
WidgetChild
}
}
</script>
11 changes: 11 additions & 0 deletions assets/js/Widgets/MyFirstWidget/components/WidgetChild.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<div class="WidgetChild">
<h3>Hello there</h3>
</div>
</template>

<script>
export default {
name: 'WidgetChild',
}
</script>
Empty file.
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions assets/js/Widgets/services/commonEventBus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Vue from 'vue'

let eventBus = new Vue()

export default eventBus

eventBus.$on('My::Event', () => {
// someAction()
})
15 changes: 15 additions & 0 deletions assets/js/Widgets/store/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Vue from 'vue'
import Vuex from 'vuex'

import functionnalStore from './modules/functionnalStore'

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

export default new Vuex.Store({
modules: {
functionnalStore
},
strict: debug
})
9 changes: 9 additions & 0 deletions assets/js/Widgets/store/modules/functionnalStore/actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as types from './types'

export default {
[types.FETCH_DATA] ({state, commit}) {
// fetch data from API, file, etc..
let data = {}
commit(types.SET_DATA, data)
}
}
18 changes: 18 additions & 0 deletions assets/js/Widgets/store/modules/functionnalStore/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as types from './types'
import actions from './actions'

const state = {
data: null
}

const mutations = {
[types.SET_DATA] (state, data) {
state.DATA = data
}
}

export default {
state,
mutations,
actions
}
5 changes: 5 additions & 0 deletions assets/js/Widgets/store/modules/functionnalStore/types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// mutations types
export const SET_DATA = 'functionanalStore/SET_DATA'

// actions types
export const FETCH_DATA = 'functionanalStore/FETCH_DATA'
38 changes: 38 additions & 0 deletions assets/js/Widgets/vueWidgetsHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import Vue from 'vue'
import Vuex from 'vuex'
import functionnalStore from './store'

import MyFirstWidget from './MyFirstWidget/MyFirstWidget'
import MySecondWidget from './MySecondWidget/MySecondWidget'

Vue.use(Vuex)

export default (function () {
let self = {}

self.init = function () {
document.querySelectorAll('[data-vue-widget="MyFirstWidget"]').forEach(function (element) {
let props = {}
for (let key in element.dataset) {
try {
props[key] = JSON.parse(element.dataset[key])
} catch(error) {
props[key] = element.dataset[key]
}
}

new Vue({
store: functionnalStore,
render: h => h(MyFirstWidget, {props}),
}).$mount(element)
})

document.querySelectorAll('[data-vue-widget="MySecondWidget"]').forEach(function (element) {
new Vue({
render: h => h(MySecondWidget),
}).$mount(element)
})
}

return self
})()
15 changes: 15 additions & 0 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require('../css/app.css')

import RecipeComponentsWebpack from './RecipeComponentsWebpack/Recipe'

new Vue({
el: '.recipe-components-webpack',
// 'h' is for hyperscript => Hyperscript itself stands for "script that generates HTML structure". It's a shortcut for DOM element creation
render: h => h(RecipeComponentsWebpack)
})

import vueWidgetHandler from './Widgets/vueWidgetsHandler'

vueWidgetHandler.init()

// call others libraries if needed
39 changes: 39 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;

set_time_limit(0);

require __DIR__.'/../vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true);
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true);

if ($debug) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($env, $debug);
$application = new Application($kernel);
$application->run($input);
22 changes: 22 additions & 0 deletions bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env php
<?php

if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
if (false === getenv('SYMFONY_DEPRECATIONS_HELPER')) {
// see https://symfony.com/doc/current/components/phpunit_bridge.html#making-tests-fail
putenv('SYMFONY_DEPRECATIONS_HELPER=999999');
}
if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) {
putenv('SYMFONY_PHPUNIT_REMOVE=');
}
if (false === getenv('SYMFONY_PHPUNIT_VERSION')) {
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
}
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
Loading

0 comments on commit 0d75ed3

Please sign in to comment.