Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added mapper/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file added mapper/static/.DS_Store
Binary file not shown.
11 changes: 8 additions & 3 deletions mapper/static/js/mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ var Mapper = new function() {
this.map_id;

this.init = function() {
Mapper.ui.init();
Mapper.gallery.init();
if (Mapper.map_id) {
Mapper.ui.init();
Mapper.view.loadData();
}
else {
Mapper.ui.init();
Mapper.gallery.init();
}
}


}();

$(document).ready(function() {
Expand Down
3 changes: 0 additions & 3 deletions mapper/static/js/mapper_generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ Mapper.generate = new function() {
dataType: "json",
url: "/api/maps/"+Mapper.map_id,}).done(
function(data) {

_generate.markerCounter = data.points.length + 1;

Mapper.map_components.storageMarkerLayer.addData(data.points);
Mapper.ui.els.savedPins.empty();

var markers = data.points;

$.each(markers, function(x, marker) {
Expand All @@ -53,7 +51,6 @@ Mapper.generate = new function() {
)
}


this.addListeners = function() {
Mapper.map_components.map.on('dblclick', Mapper.annotate.addMarker)
}
Expand Down
18 changes: 18 additions & 0 deletions mapper/static/js/mapper_view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Mapper.view = new function() {

_view = this;
var map_id = Mapper.map_id

this.loadData = function(map_id) {
$.ajax({
dataType: "json",
url: "/api/maps/"+Mapper.map_id+"?include=points"}
).done(
function(data) {
console.log(data);
Mapper.ui.els.mapTitle.text(data.name);
Mapper.ui.els.mapNotes.text(data.notes);
});
}

}
30 changes: 29 additions & 1 deletion mapper/static/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ Mapper.ui = new function() {
'markerCancelBtn': '#markerCancelBtn',
'markerList': '#markerList',
'createNewMap': '#createNewMapBtn',
'editMap' : '#editMapBtn',
'cancelEditMap' : '#cancelEditMapBtn',
'savePublish': '#savePublishBtn',
'cancelMap': '#cancelMapBtn',
'mapPreview' : '#mapPreview',
'mapTitle': '#mapTitle',
'mapNotes': '#mapNotes',
'formInputs': '.form-input',
'savedPins': '#saved-pins',
'mapGrid': '#map-grid',
'editMapBtn': '.edit-map-btn'
};
this.templates = {};
this.events = {};
Expand All @@ -46,6 +48,8 @@ Mapper.ui = new function() {
_ui.els.markerSaveButton.click(Mapper.annotate.saveMarker);
_ui.els.markerCancelBtn.click(Mapper.annotate.cancelMarker);
_ui.els.createNewMap.click(_ui.openMapCreator);
_ui.els.editMap.click(_ui.openMapEditor);
_ui.els.cancelEditMap.click(_ui.closeMapEditor);
_ui.els.cancelMap.click(_ui.closeMapCreator);
_ui.els.savePublish.click(Mapper.save.init);
_ui.els.formInputs.keyup(_ui.toggleInputError);
Expand Down Expand Up @@ -80,5 +84,29 @@ Mapper.ui = new function() {
_ui.els.cancelMap.hide();
}

this.openMapEditor = function() {
_ui.els.mapPreview.hide();
_ui.els.editMap.hide();
_ui.openMapCreator();
_ui.els.cancelEditMap.show();
/*
_ui.els.editMap.hide();
_ui.els.savePublish.show();
_ui.els.cancelEditMap.show();
_ui.els.formInputs.parents().removeClass('form-error');
_ui.els.mapCreator.slideDown(250, function() {
Mapper.generate.init();
});*/
}

this.closeMapEditor = function() {
_ui.els.mapCreator.hide();
_ui.els.mapPreview.show();
_ui.els.editMap.show();
_ui.els.savePublish.hide();
_ui.els.cancelEditMap.hide();
}



}();
2 changes: 2 additions & 0 deletions mapper/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<script src="{% static 'js/jquery.blockUI.js' %}"></script>
<script src="{% static 'js/mapper.js' %}"></script>
<script src="{% static 'js/mapper_generate.js' %}"></script>
<script src="{% static 'js/mapper_view.js' %}"></script>
<script src="{% static 'js/mapper_annotate.js' %}"></script>
<script src="{% static 'js/mapper_save.js' %}"></script>
<script src="{% static 'js/ui.js' %}"></script>
Expand All @@ -27,6 +28,7 @@
<style>
body { margin:0; padding:0; }
#map { position: relative; height: 300px; width: 100%;}
#map-screenshot { position: relative; height: 300px; width: 100%; background-color:gray;}
#markerAdder { position: relative; bottom:10px;}
#markerList { position: relative right:20px; top: 20px;}
</style>
Expand Down
46 changes: 37 additions & 9 deletions mapper/templates/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,47 @@
</head>
{% endblock %}



</script>
{% block body %}
<script type="text/javascript">
Mapper.map_id = {{map_id}}
</script>

<div class="col col-12 my3">
<a id="createNewMapBtn" class="button button--primary col md-col-2">Edit this Map</a>
<a id="savePublishBtn" class="hide button button--primary col md-col-2 mr2">Save and Publish</a>
<a id="cancelMapBtn" class="hide button button--secondary col md-col-2">Cancel</a>
<a id="editMapBtn" class="button button--primary col md-col-2">Edit this Map</a>
<a id="savePublishBtn" class="hide button button--primary col md-col-2">Save and Publish</a>
<a id="cancelEditMapBtn" class="hide button button--secondary col md-col-2">Cancel</a>
</div>

<div class="mx-auto p2 wrapper">
<div id='map-creator'style="width:100%;">
{% include "map-creator.html" %}
</div>
<div id='mapPreview' style="width:100%;">
<div class="clearfix pb4 border-bottom">
<div class="col md-col-6 xs-col-12 pr3">
<label class="form-label">Title</label>
<p id='mapTitle' class="col md-col-6 xs-col-12 pr3"></p>

</div>

<div class="col md-col-6 xs-col-12">
<label class="form-label">Notes</label>
<p id='mapNotes' class="col md-col-6 xs-col-12 pr3"></p>
</div>

<div class="col col-12 mb2">
</div>


<div class="col md-col-6 xs-col-12 pr3">
<div class="full-width mb3 border-light">
<div id="map-screenshot"></div>
</div>

</div>
<div class="col md-col-6 xs-col-12 type-5">

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

{% include "map-creator.html" %}

{% endblock %}
2 changes: 1 addition & 1 deletion mapper/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
url(r'^api/maps/(?P<pk>[0-9]+)/$', views.map_detail),
url(r'^bpage$', TemplateView.as_view(template_name='bpage.html')),
url(r'^cms$', TemplateView.as_view(template_name='cms.html')),
url(r'^map$', TemplateView.as_view(template_name='map.html')),
url(r'^maps/(?P<map_id>[0-9]+)/$', TemplateView.as_view(template_name='map.html')),
url(r'^gallery$', TemplateView.as_view(template_name='gallery.html')),
url(r'^demo/test$', TemplateView.as_view(template_name='demo/test.html')),
url(r'^creator-test$', TemplateView.as_view(template_name='creator-test.html')),
Expand Down