Skip to content

Commit

Permalink
standard
Browse files Browse the repository at this point in the history
  • Loading branch information
rap2hpoutre committed Oct 8, 2018
1 parent f3addbf commit 79ef092
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 45 deletions.
22 changes: 11 additions & 11 deletions index.html
Expand Up @@ -20,17 +20,17 @@
<script>
if (window.location.hostname !== 'localhost') {
window._paq = window._paq || []
_paq.push(["setDomains", ["*.education-artistique-culturelle.fr"]]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//stats.data.gouv.fr/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '61']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
}
_paq.push(['setDomains', ['*.education-artistique-culturelle.fr']])
_paq.push(['trackPageView'])
_paq.push(['enableLinkTracking']);
(function () {
var u = '//stats.data.gouv.fr/'
_paq.push(['setTrackerUrl', u + 'piwik.php'])
_paq.push(['setSiteId', '61'])
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]
g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = u + 'piwik.js'; s.parentNode.insertBefore(g, s)
})()
}
</script>
<noscript><p><img src="//stats.data.gouv.fr/piwik.php?idsite=61" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
Expand Down
4 changes: 2 additions & 2 deletions tags/app.tag.html
Expand Up @@ -132,7 +132,7 @@ <h2>Ressources externes</h2>
})

page('/actor/:id', (ctx) => {
this.searchStyle = 'hidden'
this.searchStyle = 'hidden'
this.schoolId = urlParams(ctx.querystring).get('school') || ''
this.changePage('actor', `
school-id="${this.schoolId}"
Expand All @@ -141,7 +141,7 @@ <h2>Ressources externes</h2>
})

page('/action/:id', (ctx) => {
this.searchStyle = 'hidden'
this.searchStyle = 'hidden'
this.schoolId = urlParams(ctx.querystring).get('school') || ''
this.changePage('action', `
id="${ctx.params.id}"
Expand Down
6 changes: 3 additions & 3 deletions tags/pages/action.tag.html
Expand Up @@ -55,14 +55,14 @@ <h3>Proposé par { this.actor.name }</h3>


<script>
/* globals api */
/* globals api, schoolById */
this.action = {}
this.actor = {}
this.medias = []

this.actorUrl = () => `/actor/${this.actor._id}${this.opts.schoolId && `?school=${this.opts.schoolId}` }`
this.actorUrl = () => `/actor/${this.actor._id}${this.opts.schoolId && `?school=${this.opts.schoolId}`}`

this.isImage = (media) => /(?:jpg|jpeg|svg|png)$/.test(media)
this.isImage = (media) => /(?:jpg|jpeg|svg|png)$/.test(media)
this.mediaLabel = (media) => (media.split('/').splice(-1)[0] || media).substring(0, 48)

this.on('mount', async () => {
Expand Down
5 changes: 2 additions & 3 deletions tags/pages/actor-edit.tag.html
Expand Up @@ -186,7 +186,7 @@ <h5>En lien pédagogique avec </h5>
</section>

<script>
/* global request, api, page */
/* global confirm, api, page, FormData */

const actorId = this.opts.actorId
this.actor = {}
Expand Down Expand Up @@ -289,8 +289,7 @@ <h5>En lien pédagogique avec </h5>
fullAddress: this.address.data.label,
loc: { type: 'Point', coordinates: this.address.latLng }
})
}
else if (!this.actor.address) {
} else if (!this.actor.address) {
this.errors.push("L'adresse postale n'est pas valide. Veuillez corriger ce champ.")
}

Expand Down
4 changes: 2 additions & 2 deletions tags/pages/actor.tag.html
Expand Up @@ -66,11 +66,11 @@ <h4>{ action.name }</h4>
</section>

<script>
/* global api */
/* global api, schoolById */
this.actor = {}

this.actorFormatDate = () => (new Date(this.actor.updatedAt)).toLocaleDateString('fr-FR')
this.actionUrl = (id) => `/action/${id}${this.opts.schoolId && `?school=${this.opts.schoolId}` }`
this.actionUrl = (id) => `/action/${id}${this.opts.schoolId && `?school=${this.opts.schoolId}`}`

this.on('mount', async () => {
this.actor = await api(`/actors/${this.opts.actorId}`)
Expand Down
17 changes: 9 additions & 8 deletions tags/pages/dashboard.tag.html
Expand Up @@ -18,14 +18,15 @@ <h2>Chiffres clés</h2>
</section>

<script>
/* global api, urlParams, L */
this.region = {departments: []}
this.schoolsCount = 0
this.actorsCount = 0
this.actionsCount = 0
const query = urlParams()
let map = null

this.regions = [ 
this.regions = [

{ code: 'fra', label: 'France', zoom: 5, latLng: [47, 2], departments: [], loadMarkers: false },
{ code: 'ara', label: 'Auvergne-Rhône-Alpes', departments: ['01', '03', '07', '15', '26', '38', '42', '43', '63', '69', '73', '74'], zoom: 7, latLng: [45.37, 5] },
Expand All @@ -39,7 +40,7 @@ <h2>Chiffres clés</h2>
{ code: 'nor', label: 'Normandie', departments: ['14', '27', '50', '61', '76'], zoom: 7, latLng: [49, 0] },
{ code: 'naq', label: 'Nouvelle-Aquitaine', departments: ['16', '17', '19', '33', '24', '33', '40', '47', '64', '79', '86', '87'], zoom: 6, latLng: [44.95, 0] },
{ code: 'occ', label: 'Occitanie', departments: ['09', '11', '12', '30', '31', '32', '34', '46', '48', '65', '66', '81', '82'], zoom: 7, latLng: [43.66, 2] },
{ code: 'pdl', label: 'Pays de la Loire', departments: ['44', '49', '53', '72', '85'], zoom: 7, latLng: [47.41, -.95] },
{ code: 'pdl', label: 'Pays de la Loire', departments: ['44', '49', '53', '72', '85'], zoom: 7, latLng: [47.41, -0.95] },
{ code: 'pac', label: 'Provence-Alpes-Côte d\'Azur', departments: ['04', '05', '06', '13', '83', '84'], zoom: 7, latLng: [44.05, 5.85] }
]

Expand Down Expand Up @@ -70,7 +71,7 @@ <h2>Chiffres clés</h2>
marker.bindPopup(`<h4>${school.name}${school.postalCode} ${school.city}</h4>`)
return marker
})
//L.featureGroup(schoolMarkers).addTo(map)
// L.featureGroup(schoolMarkers).addTo(map)

const actors = await api(`/actors?limit=10&departments=${this.region.departments.join(',')}`)
const actorIcon = L.icon({iconUrl: `/images/marker.svg`, iconSize: [40, 45]})
Expand All @@ -82,7 +83,7 @@ <h2>Chiffres clés</h2>
marker.bindPopup(`<h4>${actor.name}${actor.postalCode} ${actor.city}</h4>`)
return marker
})
.filter((marker) => marker && marker._latlng)
.filter((marker) => marker && marker._latlng)

actorMarkers && L.featureGroup(actorMarkers).addTo(map)
}
Expand All @@ -97,19 +98,19 @@ <h2>Chiffres clés</h2>
map = L.map(this.refs.map).setView(this.region.latLng, this.region.zoom)

L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 15,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
maxZoom: 15,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox.streets'
id: 'mapbox.streets'
}).addTo(map)
showRegion(regionCode)
})

this.selectRegion = (event) => {
const regionCode = event.target.value || 'fra'
window.history.pushState(null, `Tableau de pilotage en ${regionCode}`,
`/dashboard?region=${regionCode}`)
`/dashboard?region=${regionCode}`)
showRegion(regionCode)
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion tags/pages/search.tag.html
Expand Up @@ -42,7 +42,7 @@ <h2>Vous n'avez rien trouvé d'intéressant&nbsp;?</h2>
</aside>

<script>
/* global api, normalizeString */
/* global api, normalizeString, schoolById, departmentFromPostalCode */
this.ready = false
this.q = this.opts.q
this.schoolId = this.opts.schoolId
Expand Down
1 change: 1 addition & 0 deletions tags/partials/actor-contact.tag.html
Expand Up @@ -16,6 +16,7 @@ <h3 if={ !this.contact }>Contacter le responsable EAC</h3>
</p>

<script>
/* globals location */
this.actor = {}

this.on('update', () => {
Expand Down
2 changes: 1 addition & 1 deletion tags/partials/actors-map.tag.html
Expand Up @@ -2,7 +2,7 @@
<div ref=map></div>

<script>
/* global api, opts, L */
/* global schoolById, opts, L */
this.schoolId = opts.schoolId
this.actors = opts.actors

Expand Down
12 changes: 6 additions & 6 deletions tags/partials/download-template.tag.html
Expand Up @@ -6,7 +6,7 @@
/* globals JSZipUtils, JSZip, Docxtemplater, saveAs, riot */

// Inject a script in document head.
function loadScript(src) {
function loadScript (src) {
const s = document.createElement('script')
s.src = src
document.head.appendChild(s)
Expand All @@ -17,7 +17,7 @@
}

// Observe script injection, then trigger template download.
function LoadedScriptObserver(tag) {
function LoadedScriptObserver (tag) {
riot.observable(this)
this.on('push', () => {
// Start downloading after all scripts are loaded.
Expand All @@ -30,9 +30,9 @@
const templateFilename = '/resources/eac-project-2018-2019.docx'
const loadedScripts = []
const scripts = [
'/vendors/js/jszip.min.js',
'/vendors/js/jszip-utils.min.js',
'/vendors/js/filesaver.min.js',
'/vendors/js/jszip.min.js',
'/vendors/js/jszip-utils.min.js',
'/vendors/js/filesaver.min.js',
'/vendors/js/docxtemplater-latest.min.js'
]
const loadedScriptObserver = new LoadedScriptObserver(this)
Expand Down Expand Up @@ -60,7 +60,7 @@
actorDomains: (this.actor.domains && this.actor.domains.join(', ')) || '',
actorContactName: this.actor.contactName || '',
actionName: this.action.name || '',
actionDescription: this.action.description || '',
actionDescription: this.action.description || ''
})

try {
Expand Down
2 changes: 2 additions & 0 deletions tags/partials/journey.tag.html
Expand Up @@ -67,6 +67,8 @@ <h5>Sources</h5>
</virtual>

<script>
/* global request */

// See: http://doc.navitia.io/

const navitiaUrl = 'https://api.navitia.io/v1'
Expand Down
4 changes: 2 additions & 2 deletions tags/partials/like.tag.html
Expand Up @@ -29,8 +29,8 @@ <h3>Merci&nbsp;!</h3>
this.send = event => {
event.preventDefault()
if (this.refs.email.value) {
this.status = 'thanks'
}
this.status = 'thanks'
}
}
</script>
<style scoped>
Expand Down
1 change: 1 addition & 0 deletions tags/partials/marked-small.tag.html
@@ -1,5 +1,6 @@
<marked-small>
<script>
/* globals marked */
this.root.innerHTML = marked(this.opts.text, { sanitize: true })
</script>

Expand Down
1 change: 1 addition & 0 deletions tags/partials/marked.tag.html
@@ -1,5 +1,6 @@
<marked>
<script>
/* globals marked */
this.root.innerHTML = marked(this.opts.text, {sanitize: true})
</script>

Expand Down
2 changes: 1 addition & 1 deletion tags/partials/request-button.tag.html
Expand Up @@ -2,7 +2,7 @@
<a href="mailto:platefome.eac@culture.gouv.fr{ this.getMailToParams() }"><yield></a>

<script>
/* globals encodeURIComponent, location */
/* globals encodeURIComponent */
this.getMailToParams = () => {
const body = `\
Afin de vous mettre en contact au mieux avec les acteurs les plus pertinents, \
Expand Down
3 changes: 1 addition & 2 deletions tags/partials/search-filters.tag.html
Expand Up @@ -37,8 +37,7 @@ <h4>Affiner par domaines</h4>
if (!filters[category]) filters[category] = []
if (activate) {
if (filters[category].indexOf(value) < 0) filters[category].push(value)
}
else filters[category].splice(filters[category].indexOf(value), 1)
} else filters[category].splice(filters[category].indexOf(value), 1)
if (!filters[category].length) delete filters[category]

page(`/search?q=${q}&school=${schoolId}&filters=${encodeURI(JSON.stringify(filters))}`)
Expand Down
3 changes: 1 addition & 2 deletions tags/partials/select-address.tag.html
Expand Up @@ -2,8 +2,7 @@
<input type=search ref=input placeholder="Ex : 88 Rue des Arts 59100 Roubaix" value={ this.opts.label }>

<script>
/* global api, Awesomplete, normalizeString */

/* global Awesomplete, request */

this.fromAddress = (data, latLng) => {
return {
Expand Down
2 changes: 1 addition & 1 deletion tags/partials/select-school.tag.html
Expand Up @@ -2,7 +2,7 @@
<input type=search ref=input placeholder="Ex : École Gosciny Cannes">

<script>
/* global api, Awesomplete, normalizeString */
/* global api, Awesomplete, normalizeString, schoolById, request */

this.displaySchool = (school) => `${school.name} (${school.postalCode} ${school.city})`

Expand Down

0 comments on commit 79ef092

Please sign in to comment.