commit
ade7ab4dec
@ -0,0 +1,22 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
/package-lock.json
|
@ -0,0 +1,29 @@
|
||||
# email-templates
|
||||
|
||||
## Project setup
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
yarn run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
yarn run build
|
||||
```
|
||||
|
||||
### Run your tests
|
||||
```
|
||||
yarn run test
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
yarn run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [[
|
||||
'@vue/app', { useBuiltIns: "entry" }
|
||||
]]
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "email-templates",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^2.6.5",
|
||||
"vue": "^2.6.10",
|
||||
"vue-nl2br": "^0.1.2",
|
||||
"vue-resource": "^1.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^3.11.0",
|
||||
"@vue/cli-plugin-eslint": "^3.11.0",
|
||||
"@vue/cli-service": "^3.11.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-vue": "^5.0.0",
|
||||
"vue-devtools": "^5.1.3",
|
||||
"vue-template-compiler": "^2.6.10"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"rules": {},
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
}
|
||||
},
|
||||
"postcss": {
|
||||
"plugins": {
|
||||
"autoprefixer": {}
|
||||
}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions"
|
||||
]
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$slug = $_POST['slug'];
|
||||
$emails_json = json_decode(file_get_contents(__DIR__.'/emails.json'), true);
|
||||
$emails = [];
|
||||
foreach ($emails_json as $email) {
|
||||
$emails[$email['slug']] = $email;
|
||||
}
|
||||
|
||||
if (!array_key_exists($slug, $emails)) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
}
|
||||
|
||||
$email = $emails[$slug];
|
||||
|
||||
header('Content-Type: application/json');
|
||||
die(json_encode($email));
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
header('Content-Type: application/json');
|
||||
readfile(__DIR__.'/emails.json');
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="favicon.ico">
|
||||
<title>Modèles d'Email</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>Désolé mais cette application ne fonctionne pas sans JavaScript. Merci de l'activer pour continuer.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<img alt="Vue logo" src="./assets/hero.png">
|
||||
<EmailModel/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EmailModel from './components/EmailModel.vue'
|
||||
|
||||
export default {
|
||||
name: 'app',
|
||||
components: {
|
||||
EmailModel
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
margin-top: 60px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 500px;
|
||||
}
|
||||
</style>
|
After Width: | Height: | Size: 81 KiB |
@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>Modèles d'Email</h1>
|
||||
<h2>Templates d'email potentiellement pré-rempli à usage professionnel et personnel !</h2>
|
||||
<select v-model="selected" v-on:change="selectEmail">
|
||||
<option v-for="template in emails" :value="template.slug" :key="template.slug">
|
||||
{{ template.name }}
|
||||
</option>
|
||||
</select>
|
||||
<div v-if="email != null">
|
||||
<h4 class="email-subject">Sujet : {{ email.subject }}</h4>
|
||||
<nl2br tag="p" :text="email.body" class-name="email-body"></nl2br>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import VueResource from 'vue-resource';
|
||||
import Nl2br from 'vue-nl2br';
|
||||
|
||||
Vue.component('nl2br', Nl2br);
|
||||
Vue.use(VueResource);
|
||||
|
||||
export default {
|
||||
name: "EmailModel",
|
||||
components: {
|
||||
Nl2br
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
emails: [],
|
||||
selected: "",
|
||||
email: null
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
let $this = this;
|
||||
Vue.http.get("emails.php").then(response => {
|
||||
$this.emails = response.body
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
selectEmail: function() {
|
||||
let $this = this;
|
||||
Vue.http.post("email.php", {"slug": $this.selected}).then(response => {
|
||||
$this.email = response.body;
|
||||
// $this.email.body.replace(/(\r\n|\n\r|\r|\n)/g, '<br>$1');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
.email-subject, .email-body {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,13 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import VueResource from 'vue-resource';
|
||||
|
||||
Vue.use(VueResource);
|
||||
Vue.config.productionTip = false;
|
||||
Vue.config.debug = true;
|
||||
Vue.config.devtools = true;
|
||||
Vue.http.options.emulateJSON = true;
|
||||
|
||||
new Vue({
|
||||
render: h => h(App),
|
||||
}).$mount('#app');
|
@ -0,0 +1,4 @@
|
||||
// vue.config.js
|
||||
module.exports = {
|
||||
publicPath: "/shikiryu/email-templates/dist/"
|
||||
}
|
Loading…
Reference in new issue