Browse Source

changes over changes

master
christian 6 years ago
parent
commit
196020243c
12 changed files with 163 additions and 6 deletions
  1. +1
    -1
      bloomhunt/urls.py
  2. +1
    -1
      map/templates/map/index.html
  3. +1
    -0
      map/urls.py
  4. +1
    -0
      map/views.py
  5. +109
    -0
      mobile/static/mobile/base.css
  6. BIN
      mobile/static/mobile/map_icon.png
  7. +27
    -1
      mobile/templates/mobile/base.html
  8. +5
    -0
      mobile/templates/mobile/index.html
  9. +6
    -1
      mobile/templates/mobile/scan.html
  10. +2
    -2
      mobile/templates/mobile/scanned.html
  11. +2
    -0
      mobile/urls.py
  12. +8
    -0
      mobile/views.py

+ 1
- 1
bloomhunt/urls.py View File

@@ -21,6 +21,6 @@ from django.views.generic import RedirectView
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^mobile/', include('mobile.urls')), url(r'^mobile/', include('mobile.urls')),
url(r'^map/', include('map.urls'), name='map'),
url(r'^map/', include('map.urls')),
url(r'', RedirectView.as_view(url='/map/', permanent=False)) url(r'', RedirectView.as_view(url='/map/', permanent=False))
] ]

+ 1
- 1
map/templates/map/index.html View File

@@ -144,7 +144,7 @@ var trees_2 = [];


for (var i = 0; i < treesFromJSON.length; i++) { for (var i = 0; i < treesFromJSON.length; i++) {
let raw = treesFromJSON[i]; let raw = treesFromJSON[i];
let tree = new Tree(raw["name"], raw["bloom_start"] + 20,
let tree = new Tree(raw["name"], raw["bloom_start"] - 20,
raw["latitude"], raw["longitude"]); raw["latitude"], raw["longitude"]);
trees_2.push(tree); trees_2.push(tree);
} }


+ 1
- 0
map/urls.py View File

@@ -2,6 +2,7 @@ from django.urls import path


from . import views from . import views


app_name = "map"
urlpatterns = [ urlpatterns = [
path('', views.index, name='index') path('', views.index, name='index')
] ]

+ 1
- 0
map/views.py View File

@@ -12,4 +12,5 @@ def index(request):
loaded = json.load(f) loaded = json.load(f)
s = json.dumps(loaded); s = json.dumps(loaded);
data = {"trees": s} data = {"trees": s}

return render(request, "map/index.html", context=data); return render(request, "map/index.html", context=data);

+ 109
- 0
mobile/static/mobile/base.css View File

@@ -0,0 +1,109 @@
body,html{
font-size: 16px;
font-family: "Georgia", serif;
line-height: 29px;
color:#0c1a30;
padding:0;
height: 100%;
margin: 0 0 1px;
}

#main{
background:#fff scroll repeat-x 0px -100px;
margin: 0;
padding: 0;
width:100%;
min-height: 100%;
/*background: #FFFFFF;*/
}

#content {
width: 70%;
margin: 0 auto;
overflow:hidden;
position: relative;
}

#footer {
position: relative;
top: 0;
left: 0;
width: 100%;
clear: both;
border-top: 1px solid #C2D1E1;
color: #a0acba;
padding: 4px 0px;
height: 41px;
font-family: "PT Sans", sans-serif;
font-size: 0.75em;
/* text-align: right; */
background: #f5f9ff;
/* vertical-align: middle; */
line-height: 31px;
overflow: hidden;
}

#footer p {
padding: 0 20px;
margin: 0;
float: right;
}

#footer p.left {
padding: 0 20px;
margin: 0;
float: left;
}

#heading {
width: 100%;
background: #132742 url(nav-back.png) scroll repeat-x bottom left;
color: #FFFFFF;
padding: 25px 0 0 0;
margin:0;
height: 94px;
overflow:hidden;
margin-bottom: 30px;
}

#heading .inner{
width: 70%;
margin:0 auto;
overflow:hidden;
line-height: 1em;
vertical-align: top;
height: 100px;
padding: 0;
position: relative;
/*height: 4em;*/
}

#heading h1 {
margin:0;
padding: 0;
margin: 0 auto;
position: absolute;
top: 10px;
left: 94px;
vertical-align: top;
}


#heading img {
width: 64px;
margin:0;
padding: 0;
margin: 0 auto;
position: absolute;
top: 0px;
left: 0px;
vertical-align: top;
}

#map_icon {
width: 64px;
margin:0;
position: absolute;
right: 50px;
top: 24px;
}

BIN
mobile/static/mobile/map_icon.png View File

Before After
Width: 512  |  Height: 512  |  Size: 3.5KB

+ 27
- 1
mobile/templates/mobile/base.html View File

@@ -1,18 +1,44 @@
{% load static %}

<html> <html>


<head> <head>
<title>Bloom Hunting</title>

<link rel="shortcut icon" type="image/png" href="{% static 'favicon.ico' %}"/>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="{% static 'mobile/base.css' %}">


</head> </head>


<body> <body>


<div id=content>
<div id="main">
<div id='header'>
<a href="{% url 'map:index' %}">
<img id="map_icon" class="right" src='{% static 'mobile/map_icon.png' %}' />
</a>
<div id='heading'>
<div class='inner'>
<img src='{% static 'favicon.ico' %}' />
<h1 id='title'>Bloom up your city</h1>

</div>
</div>
</div>

<div id="content">
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</div> </div>
</div>


<!-- FOOTER -->
<div id='footer'>
<p class='left'>Bloom Hunting - a Ökostadt Heidelberg initiative</p>
<p>A Climathon Heidelberg project</p>
</div>
</body> </body>


</html> </html>

+ 5
- 0
mobile/templates/mobile/index.html View File

@@ -7,4 +7,9 @@
<p>Hunt blooming trees in your area.</p> <p>Hunt blooming trees in your area.</p>


<a class="btn btn-default" id="btn_scan" href="{% url 'mobile:scan' %}">Scan a blooming tree</a> <a class="btn btn-default" id="btn_scan" href="{% url 'mobile:scan' %}">Scan a blooming tree</a>

<p>Hey, some predictions</p>

<p>{{ prediction }}</p>

{% endblock %} {% endblock %}

+ 6
- 1
mobile/templates/mobile/scan.html View File

@@ -7,13 +7,18 @@


<p>{{ question.text }}</p> <p>{{ question.text }}</p>


<table>
<tr>
{% for option in question.options %} {% for option in question.options %}

<td width=30%>
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
<input name="question" type="hidden" value="{{ question.key }}"> <input name="question" type="hidden" value="{{ question.key }}">
<input name="chosen_option" class="btn btn-default" type="submit" value="{{ option.text }}"> <input name="chosen_option" class="btn btn-default" type="submit" value="{{ option.text }}">
</form> </form>
</td>
{% endfor %} {% endfor %}
</tr>
</table>


{% endblock %} {% endblock %}

+ 2
- 2
mobile/templates/mobile/scanned.html View File

@@ -11,8 +11,8 @@ tree is blooming.<p>
{% csrf_token %} {% csrf_token %}
<input type="text" name="name"> <input type="text" name="name">
<input type="hidden" name="tree" value="{{ tree.name }}"> <input type="hidden" name="tree" value="{{ tree.name }}">
<input id="in_long" type="text" name="longitude">
<input id="in_lat" type="text" name="latitude">
<input id="in_long" type="hidden" name="longitude">
<input id="in_lat" type="hidden" name="latitude">
<input type="submit" value="Name your tree"> <input type="submit" value="Name your tree">
</form> </form>




+ 2
- 0
mobile/urls.py View File

@@ -2,6 +2,8 @@ from django.urls import path


from . import views from . import views


app_name = "mobile"

urlpatterns = [ urlpatterns = [
path('addtree/', views.addtree, name='addtree'), path('addtree/', views.addtree, name='addtree'),
path('scan/', views.scan , name='scan'), path('scan/', views.scan , name='scan'),


+ 8
- 0
mobile/views.py View File

@@ -5,8 +5,16 @@ from datetime import datetime
import json import json
import os import os


import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import re as re



def index(request): def index(request):


return render(request, 'mobile/index.html') return render(request, 'mobile/index.html')






Loading…
Cancel
Save