Skip to content
This repository has been archived by the owner on Jun 30, 2020. It is now read-only.

Commit

Permalink
Revert "Statistiques Matomo (#62)"
Browse files Browse the repository at this point in the history
This reverts commit f11154a.
  • Loading branch information
yann-yinn committed Jul 3, 2019
1 parent f11154a commit c46f5a0
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 117 deletions.
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ La machine à Popcorn permet de créer son propre "Popcorn" : un annuaire local
- SEO-friendly avec la prégénération du html et les tags pour les réseaux sociaux (Facebook, Twitter, Linkedin)
- Support Gravatar pour les photos du profil
- Un formulaire de contact qui envoie le message sur le channel #general d'un Slack
- Statistiques avec [Matomo](https://matomo.org/) (requiert d'avoir une instance de Matomo)
- Une page qui affichent tous les autres popcorns francophones

## Ajouter son Popcorn dans l'annuaire des Popcorns
Expand All @@ -26,23 +25,6 @@ La machine à Popcorn permet de créer son propre "Popcorn" : un annuaire local
- Choisis une belle image qui symbolise bien d'après toi la localité de ton Popcorn et met là dans le dossier `/static/images/`. Attention ! L'image doit faire 100ko maximum
- Soumettre ta pull request ! Ton popcorn apparaitra dans la page "Annuaire des Popcorns" de tous les Popcorns dès qu'ils auront mis à jour leur version de `popcorn-machine`.

## Brancher les statistiques de Matomo

Il suffit de renseigner dans le `popcorn.config.js` les paramètres de votre [Matomo](https://matomo.org/)

```js
module.exports = {
location: 'à Nantes',
// statistiques
matomo: {
matomoUrl: 'https://xxx.xxx.xx/', // notez le slash final
siteId: 1,
debug: false,
verbose: false
}
}
```

## PHILOSOPHIE TECHNIQUE : 0 MAINTENANCE, 0 FRAIS, SIMPLE ET EFFICACE

Le mot "Popcorn" a été notamment choisi pour évoquer une grande légèreté. Son mantra technique pourrait être:
Expand Down
70 changes: 23 additions & 47 deletions components/PersonsSearchForm.vue
Original file line number Diff line number Diff line change
@@ -1,62 +1,38 @@
<template>
<form @submit.prevent="onSubmit">
<div class="field has-text-centered has-addons">
<div class="container">
<div class="control has-icons-left is-expanded">
<input
aria-label="Rechercher un développeur par mot-clef"
id="search"
class="input is-medium is-flat"
v-model="search"
type="text"
placeholder="Site, Boutique, Application, React, WordPress, Java, PHP ..."
/>
<span class="icon is-small is-left">
<i class="fas fa-search"></i>
</span>
</div>
<div class="control">
<input
value="Rechercher"
type="submit"
class="button is-warning is-medium"
/>
</div>
</div>
</div>
</form>
<div class="field has-text-centered">
<p class="control has-icons-left">
<input
aria-label="Rechercher un développeur par mot-clef"
id="search"
class="input is-medium is-flat"
:value="value"
@input="$emit('input', $event.target.value)"
type="text"
placeholder="Site, Boutique, Application mobile, React, WordPress, Java, PHP ..."
/>
<span class="icon is-small is-left"><i class="fas fa-search"></i></span>
</p>
</div>
</template>

<script>
export default {
data() {
return {
search: ''
}
},
methods: {
onSubmit() {
this.$emit('onSubmit', this.search)
}
},
created() {
// si on vient d'une autre page, filtrer les profils en fonction
// de la recherche en cours, si il y en a une.
if (this.$store.state.currentSearch.trim()) {
this.search = this.$store.state.currentSearch.trim()
props: {
value: {
type: String,
required: true
}
}
}
</script>

<style scoped>
div.container {
display: flex;
justify-content: center;
max-width: 900px;
}
div.field {
padding-bottom: 3rem;
margin: auto;
}
p.control {
display: inline-block;
width: 100%;
max-width: 900px;
}
</style>
48 changes: 21 additions & 27 deletions nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
const { POPCORN_DIR } = process.env
require('dotenv').config({ path: POPCORN_DIR + '/.env' })
const { generateSocialShareHeadersMeta } = require('./services/helpers.js')
const popcornConfig = require('./popcorn.config.js')
const popcorn = require('./popcorn.config.js')
const serveStatic = require('serve-static')
const path = require('path')

const config = {
module.exports = {
mode: 'universal',
buildDir: popcornConfig.dirBuildPath,
buildDir: popcorn.dirBuildPath,
// ces variables seront accessibles côté client comme côté serveur
env: {
POPCORN_BASE_URL: process.env.POPCORN_BASE_URL,
POPCORN_SLACK_WEBHOOK: process.env.POPCORN_SLACK_WEBHOOK,
POPCORN_LOCATION: popcornConfig.location,
POPCORN_SLOGAN: popcornConfig.slogan,
POPCORN_TITLE: popcornConfig.title,
POPCORN_SUBTITLE: popcornConfig.subtitle,
POPCORN_OG_DEFAULT_TITLE: popcornConfig.ogDefaultTitle,
POPCORN_OG_DEFAULT_DESCRIPTION: popcornConfig.ogDefaultDescription,
POPCORN_OG_DEFAULT_URL: popcornConfig.ogDefaultUrl,
POPCORN_OG_DEFAULT_IMAGE: popcornConfig.ogDefaultImage
POPCORN_LOCATION: popcorn.location,
POPCORN_SLOGAN: popcorn.slogan,
POPCORN_TITLE: popcorn.title,
POPCORN_SUBTITLE: popcorn.subtitle,
POPCORN_OG_DEFAULT_TITLE: popcorn.ogDefaultTitle,
POPCORN_OG_DEFAULT_DESCRIPTION: popcorn.ogDefaultDescription,
POPCORN_OG_DEFAULT_URL: popcorn.ogDefaultUrl,
POPCORN_OG_DEFAULT_IMAGE: popcorn.ogDefaultImage
},
css: ['@/static/css/bulma.min.css', '@/static/css/app.css'],
/*
Expand All @@ -35,13 +35,13 @@ const config = {
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
name: 'description',
content: popcornConfig.ogDefaultDescription
content: popcorn.ogDefaultDescription
},
...generateSocialShareHeadersMeta({
title: popcornConfig.ogDefaultTitle,
description: popcornConfig.ogDefaultDescription,
image: popcornConfig.ogDefaultImage,
url: popcornConfig.ogDefaultUrl
title: popcorn.ogDefaultTitle,
description: popcorn.ogDefaultDescription,
image: popcorn.ogDefaultImage,
url: popcorn.ogDefaultUrl
})
],
link: [
Expand All @@ -68,33 +68,27 @@ const config = {
mode: 'postcss'
},
gustave: {
JSONDirectory: popcornConfig.dirApiPath,
JSONDirectory: popcorn.dirApiPath,
compilers: [
'compilers/persons.js',
'compilers/pages.js',
'compilers/popcorns.js'
]
},
generate: {
dir: popcornConfig.dirDistPath
dir: popcorn.dirDistPath
},
build: {
extend(config) {
// override and set some aliases
config.resolve.alias['@api'] = popcornConfig.dirApiPath
config.resolve.alias['@api'] = popcorn.dirApiPath
}
},
serverMiddleware: [
{
// servir les fichiers du dossier "public" pendant le dev
path: '/' + path.basename(popcornConfig.dirPublicPath),
handler: serveStatic(popcornConfig.dirPublicPath)
path: '/' + path.basename(popcorn.dirPublicPath),
handler: serveStatic(popcorn.dirPublicPath)
}
]
}

if (popcornConfig.matomo) {
config.modules.push(['nuxt-matomo', popcornConfig.matomo])
}

module.exports = config
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
}
},
"lint-staged": {
"*.{js,vue,json,css,md}": [
"prettier --write",
"*.{js,vue,json,css,!.min.css,md}": [
"node_modules/.bin/prettier --write",
"git add"
]
},
Expand All @@ -36,7 +36,6 @@
"nodemon": "^1.18.7",
"nuxt": "^2.3.4",
"nuxt-gustave": "^0.5.2",
"nuxt-matomo": "^1.2.2",
"serve": "^10.1.1",
"vue-lazyload": "^1.2.6"
},
Expand Down
13 changes: 6 additions & 7 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

<section class="section">
<div class="container">
<PersonsSearchForm @onSubmit="onSearchSubmit" />
<PersonsSearchForm
:value="$store.state.currentSearch"
@input="onInput"
/>
<Persons :persons="persons" />
</div>
</section>
Expand Down Expand Up @@ -39,13 +42,9 @@ export default {
subtitle: () => process.env.POPCORN_SUBTITLE
},
methods: {
onSearchSubmit(value) {
this.persons = this.filterPersons(value)
onInput(value) {
this.$store.commit('setCurrentSearch', value)
this.$router.push({
path: '/',
query: { ...this.$route.query, search: value }
})
this.persons = this.filterPersons(value)
},
filterPersons(text) {
let persons = getPersons().filter(person => {
Expand Down
2 changes: 1 addition & 1 deletion pages/person/_slug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<main>
<div class="section">
<div class="container">
<Person v-if="person" :person="person" />
<Person v-if="person" :person="person"/>
<div v-else>Désolé, cette page n'existe pas ou a été dépubliée. 😭</div>
</div>
</div>
Expand Down
11 changes: 4 additions & 7 deletions pages/popcorns/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<main>

<section class="hero has-text-centered">
<div class="hero-body">
<div class="container">
Expand All @@ -15,13 +16,9 @@

<div class="section">
<div class="container">
<BulmaGrid
:items="popcorns"
itemsByRow="3"
:itemKey="popcorn => popcorn.$slug"
>
<template slot-scope="{ item }">
<PopcornCard :popcorn="item" />
<BulmaGrid :items="popcorns" itemsByRow="3" :itemKey="popcorn => popcorn.$slug">
<template slot-scope="{item}">
<PopcornCard :popcorn="item"/>
</template>
</BulmaGrid>
</div>
Expand Down
3 changes: 1 addition & 2 deletions popcorn.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// POPCORN_DIR est le chemin absolu vers l'instance de la localité.
// POPCORN_DIR est le chemin absolu vers l'instance de Popcorn courante.
const { POPCORN_BASE_URL, POPCORN_DIR } = process.env
const path = require('path')
let config = require(POPCORN_DIR + '/popcorn.config')
Expand All @@ -15,7 +15,6 @@ const slogan = `Trouvez un développeur freelance ${

module.exports = {
location: config.location,
matomo: config.matomo ? config.matomo : null,

title,
subtitle,
Expand Down

0 comments on commit c46f5a0

Please sign in to comment.