Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mapbox templates #35

Merged
merged 17 commits into from
Sep 6, 2014
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 38 additions & 0 deletions bpz/static/js/bpz.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// function Location() {
// var options = {
// enableHighAccuracy: true
// },
// inner_pos = {},
// dfd = new $.Deferred(),
// moved = function(pos) {
// inner_pos = pos || {};
// dfd.resolve()
// },
// fail = function(err) {
// if (err) {
// console.warn('ERROR(' + err.code + '): ' + err.message);
// }
// dfd.reject()
// };
//
// this.__defineGetter__("lat", function() {
// return inner_pos.coords ? inner_pos.coords.latitude : null;
// });
//
// this.__defineGetter__("lng", function() {
// return inner_pos.coords ? inner_pos.coords.longitude : null;
// });
//
// this.WatchID = navigator.geolocation.watchPosition(moved, fail, options);
//
// this.ready = dfd.promise()
// }
//
//
//
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this comment block be removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 removing commented code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+2 for implementing commented code


jQuery(document).ready(function () {
L.mapbox.accessToken ='pk.eyJ1IjoiamR1bmdhbiIsImEiOiJlOTl6MFpNIn0.-3o5vIOCjkfXd-7ibZrb8A'
map = L.mapbox.map('map-canvas', 'jdungan.jbbebonl').setView([36.1587336,-95.9940543],16);

});
Empty file added bpz/templates/address.html
Empty file.
39 changes: 39 additions & 0 deletions bpz/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% spaceless %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes">

<script src='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.css' rel='stylesheet' />

<script src= "http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src= "http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.3.13/d3.min.js" charset="utf-8"></script>

<script src='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.css' rel='stylesheet' />

</head>
<body>

<div id="page" class="page" data-role="page" >

<div data-role="header" data-position="fixed">
</div><!-- /header -->

<div data-role="content" >

{% block content %}
<p> Content goes here </p>
{% endblock %}

</div> <!-- End of content -->

</div><!-- End of page -->


</body>
</html>{% endspaceless %}
5 changes: 4 additions & 1 deletion bpz/templates/bpz/base.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<link href="{{ static('vendor/bootstrap-3.2.0-dist/css/bootstrap-theme.min.css') }}" rel="stylesheet">
<link href="{{ static('css/bpz.css') }}" rel="stylesheet">

<script src='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.js'></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be moved into the scripts section before body_js?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

<link href='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.css' rel='stylesheet' />


<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
Expand Down Expand Up @@ -47,7 +51,6 @@

<script src="{{ static('vendor/jquery/jquery-1.11.1.min.js') }}"></script>
<script src="{{ static('vendor/bootstrap-3.2.0-dist/js/bootstrap.min.js') }}"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA4JQW3kTKVpzBIroZ1mXguTPt2J1F1zXU"></script>
<script src="{{ static('js/bpz.js') }}"></script>
{% block body_js -%}
{%- endblock body_js %}
Expand Down
31 changes: 31 additions & 0 deletions bpz/templates/bpz/cases.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

{% extends "bpz/base.jinja2" %}

{% block content %}

<div id="map-canvasd"
class="ui-content search_map"
role="main" data-role="content" data-theme="b">
</div>



<a>Get notified of building, planning, and zoning meetings in the Pearl District»</a>


<script>



</script>


{% endblock content %}








1 change: 0 additions & 1 deletion bpz/templates/bpz/home.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@
{% endblock %}

{% block body_js -%}
<script src="{{ static('js/home.js') }}"></script>
{%- endblock body_js %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove home.js as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

home.js replaced by mapbox.js functions in bpz.js

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed home.js

27 changes: 27 additions & 0 deletions bpz/templates/bpz/hood.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% extends 'bpz/base.jinja2' %}
{% block content %}

<script>

bound={{hood.boundary}}


</script>

<div id="map_content"
class="ui-content search_map"
role="main" data-role="content" data-theme="b">
</div>
<div>

<p>Contact</p>{{ hood.contact}}
<p>Phone</p>{{ hood.phone}}
<p>Email</p>{{ hood.email}}
<p>Meetings</p>{{ hood.meetings}}
<p>Website</p>{{ hood.url}}

<a >BUTTON: View building, planning, and zoning meetings in the Pearl District</a>

</div>

{% endblock content %}
13 changes: 13 additions & 0 deletions bpz/templates/bpz/notify.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends 'bpz/base.jinja2' %}

{% block content %}
<p>Get informed about public meetings affecting your neighborhood. Sign up to receive notifications:</p>

<form action="" method="post" data-ajax="false">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Submit" />
</form>
{% endblock content %}


12 changes: 12 additions & 0 deletions bpz/templates/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends 'base.html' %}
{% block content %}

<div id="map_content"
class="ui-content search_map"
role="main" data-role="content" data-theme="b">
</div>
<div>
Hi, this is some information about what this app is, what it does, and why it needs to use your GPS to find your neighborhood. Learn more»
</div>

{% endblock content %}
15 changes: 11 additions & 4 deletions bpz/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.views.generic import TemplateView
from rest_framework import routers

from .views import CaseViewSet, HOAViewSet
from .views import CaseViewSet, HOAViewSet, cases


router = routers.DefaultRouter()
Expand All @@ -12,11 +12,18 @@

urlpatterns = patterns(
'',
url(r'^api/', include(router.urls)),
url(r'^$',
TemplateView.as_view(template_name='bpz/home.jinja2'),
name='home'),
url(r'^about', TemplateView.as_view(
template_name='bpz/about.jinja2'),
url(r'^about',
TemplateView.as_view(template_name='bpz/about.jinja2'),
name='about'),
url(r'^api/', include(router.urls)),
url(r'^hood',
TemplateView.as_view(template_name='bpz/hood.jinja2'),
name='neighborhood'),
url(r'^notify',
TemplateView.as_view(template_name='bpz/notify.jinja2'),
name='notify'),
url(r'^cases', cases, name='cases'),
)
7 changes: 7 additions & 0 deletions bpz/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# bpz views here
from django.shortcuts import render

from rest_framework import viewsets

from .models import Case, HomeOwnersAssociation
Expand All @@ -12,3 +15,7 @@ class CaseViewSet(viewsets.ModelViewSet):
class HOAViewSet(viewsets.ModelViewSet):
model = HomeOwnersAssociation
serializer_class = HomeOwnersAssociationSerializer


def cases(request):
return render(request, 'bpz/cases.jinja2', {'cases': Case.objects.all()})