-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50d2ff4
commit 10de903
Showing
15 changed files
with
1,464 additions
and
933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/node_modules | ||
**/*/node_modules | ||
priv/static/js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
const { addMap } = require('./leaflet') | ||
import { addMap } from './leaflet' | ||
import riot from 'riot' | ||
import './components/**/*' | ||
|
||
riot.mount('*') | ||
addMap('map', '/data/home.geojson') |
38 changes: 38 additions & 0 deletions
38
client/javascripts/components/organization/organization-search.tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<organization-search> | ||
<form role="search"> | ||
<input type="search" value={ keyword } onkeyup={ update_query } placeholder="recherche"> | ||
</form> | ||
|
||
<section class="organizations"> | ||
<organization each={ organizations.slice(0, 10) } name={ name } description={ description }/> | ||
</section> | ||
|
||
<script type="es6"> | ||
this.organizations = [] | ||
this.keyword = '' | ||
this.searching = false | ||
|
||
this.fetch_orgs = () => { | ||
if (this.searching) { return } | ||
|
||
this.searching = true | ||
this.oldKeyword = this.keyword | ||
|
||
fetch(`${process.env.DATAGOUVFR_SITE}/api/1/organizations/?q=${this.oldKeyword}`) | ||
.then(response => { return response.json() }) | ||
.then(data => { | ||
this.update({ organizations: data.data }) | ||
this.searching = false | ||
|
||
if (this.oldKeyword !== this.keyword) { | ||
this.fetch_orgs() | ||
} | ||
}) | ||
} | ||
|
||
this.update_query = function(event) { | ||
this.keyword = event.target.value | ||
this.fetch_orgs() | ||
} | ||
</script> | ||
</organization-search> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<organization> | ||
<section> | ||
<h1> { opts.name } </h1> | ||
<p> { opts.description } </p> | ||
</section> | ||
</organization> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
organization-search { | ||
$width: 500px; | ||
$lightblue: #e6e6fa; | ||
$grey: #eee; | ||
|
||
input { | ||
background: $grey; | ||
border: 0 none; | ||
border-radius: 10px; | ||
padding: 10px; | ||
width: $width; | ||
} | ||
|
||
section.organizations { | ||
padding-top: 2em; | ||
margin-left: 1em; | ||
organization { | ||
section { | ||
border-bottom: 1px solid $lightblue; | ||
|
||
h1 { | ||
font-size: 1em; | ||
text-align: left; | ||
margin-bottom: 0.2em; | ||
margin-top: 1.5em; | ||
} | ||
|
||
p { | ||
margin: 0; | ||
margin-left: 0.5em; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.