Skip to content

Commit

Permalink
Add demo application
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloborges committed Jul 13, 2015
1 parent 37c408c commit 0c442a9
Show file tree
Hide file tree
Showing 13 changed files with 250 additions and 0 deletions.
8 changes: 8 additions & 0 deletions demo/.meteor/.finished-upgraders
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.

notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1 change: 1 addition & 0 deletions demo/.meteor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
local
7 changes: 7 additions & 0 deletions demo/.meteor/.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics

19fi3ya1gfrj3ecj0dwa
1 change: 1 addition & 0 deletions demo/.meteor/cordova-plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

13 changes: 13 additions & 0 deletions demo/.meteor/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Meteor packages used by this project, one per line.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

meteor-platform
autopublish
insecure
richsilv:semantic-ui
pauloborges:mapbox

meteorhacks:flow-router
meteorhacks:flow-layout
3 changes: 3 additions & 0 deletions demo/.meteor/platforms
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
android
browser
server
1 change: 1 addition & 0 deletions demo/.meteor/release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]
5 changes: 5 additions & 0 deletions demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# pauloborges:mapbox demo

This repository contains a very simple Meteor application that uses
[pauloborges:mapbox](https://github.com/pauloborges/meteor-mapbox) for
[Mapbox](https://www.mapbox.com/) integration.
18 changes: 18 additions & 0 deletions demo/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*div#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}*/

div#footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
}

.nested.column {
margin-top: 0px !important;
margin-bottom: 0px !important;
}
71 changes: 71 additions & 0 deletions demo/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<head>
<title>Mapbox for Meteor apps</title>
</head>

<template name="Layout">
{{> Template.dynamic template=content}}

<a href="https://github.com/pauloborges/meteor-mapbox"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
</template>

<template name="Main">
<div id="map" class="mapbox"></div>

<div id="footer" class="ui grid">
<div class="one wide column"></div>

<div class="fourteen wide column">
<div class="ui segment">
<div class="ui three column grid">
<div class="four wide nested column">
<p>Install it</p>
<pre>$ meteor add pauloborges:mapbox</pre>
</div>

<div class="four wide nested column">
<p>HTML</p>
<pre>{{html}}</pre>
</div>

<div class="nested column">
<p>JS</p>
<pre>{{js}}</pre>
</div>
</div>
</div>
</div>

<div class="one wide column"></div>
</div>
</template>

<template name="GL">
<div id="map" class="mapbox"></div>

<div id="footer" class="ui grid">
<div class="one wide column"></div>

<div class="fourteen wide column">
<div class="ui segment">
<div class="ui three column grid">
<div class="four wide nested column">
<p>Install it</p>
<pre>$ meteor add pauloborges:mapbox</pre>
</div>

<div class="four wide nested column">
<p>HTML</p>
<pre>{{html}}</pre>
</div>

<div class="nested column">
<p>JS</p>
<pre>{{js}}</pre>
</div>
</div>
</div>
</div>

<div class="one wide column"></div>
</div>
</template>
67 changes: 67 additions & 0 deletions demo/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FlowRouter.route('/', {
action: function(params) {
FlowLayout.render('Layout', {content: 'Main'});
}
});

FlowRouter.route('/gl', {
action: function(params) {
FlowLayout.render('Layout', {content: 'GL'});
}
});

if (Meteor.isClient) {
Template.Main.onRendered(function () {
Mapbox.debug = true;
Mapbox.load({
plugins: ['markercluster', 'heat']
});

this.autorun(function () {
if (Mapbox.loaded()) {
L.mapbox.accessToken = 'pk.eyJ1IjoicGF1bG9ib3JnZXMiLCJhIjoicFQ1Sll5ZyJ9.alPGD574u3NOBi2iiIh--g';
var map = L.mapbox.map('map', 'pauloborges.k8eg55fh');
}
});
});

Template.Main.helpers({
html: '<div id="map" class="mapbox"></div>',
js: 'Mapbox.load();\nTracker.autorun(function () {\n' +
'\tif (Mapbox.loaded()) {\n' +
'\t\tL.mapbox.accessToken = MY_ACCESS_TOKEN;\n' +
'\t\tvar map = L.mapbox.map("map", MY_MAP_ID);\n' +
'\t}\n' +
'});'
});

Template.GL.onRendered(function () {
Mapbox.debug = true;
Mapbox.load({
gl: true
});

this.autorun(function () {
if (Mapbox.loaded()) {
mapboxgl.accessToken = 'pk.eyJ1IjoicGF1bG9ib3JnZXMiLCJhIjoicFQ1Sll5ZyJ9.alPGD574u3NOBi2iiIh--g';
var map = new mapboxgl.Map({
container: 'map',
style: 'https://www.mapbox.com/mapbox-gl-styles/styles/outdoors-v7.json',
});
}
});
});

Template.GL.helpers({
html: '<div id="map" class="mapbox"></div>',
js: 'Mapbox.load({gl: true});\nTracker.autorun(function () {\n' +
' if (Mapbox.loaded()) {\n' +
' mapboxgl.accessToken = MY_ACCESS_TOKEN;\n' +
' var map = new mapboxgl.Map({\n' +
' container: "map",\n' +
' style: "https://www.mapbox.com/mapbox-gl-styles/styles/outdoors-v7.json",\n' +
' };\n' +
' }\n' +
'});'
});
}
1 change: 1 addition & 0 deletions demo/packages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mapbox

0 comments on commit 0c442a9

Please sign in to comment.