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

[WIP] add coverage map depicting the location of all images in the map #554

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
20 changes: 20 additions & 0 deletions django_project/search/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,26 @@ APP.ResultItemCollection = PaginatedCollection.extend({

APP.Results = new APP.ResultItemCollection();

APP.AllResult = Backbone.Model.extend({

});

APP.AllResultCollection = Backbone.Collection.extend ({
urlRoot: '/api/v1/opticalproducts/',
model: APP.AllResult,
el: $("#total_data"),
parse: function (response) {
this.el.append(response.meta['total_count']);
return this.models;
},
initialize: function() {
// this.collection.bind('reset', this.render, this);
}
});

APP.AllResults = new APP.AllResultCollection();
APP.AllResults.fetch();

APP.ResultGridView = Backbone.View.extend({
el: $("#result-panel"),

Expand Down
7 changes: 6 additions & 1 deletion django_project/search/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ <h5 class="text-center">Set Your Search Parameters</h5>
</div>
</div>
</div>
{% if user.is_staff %}
<div id="show-all" style="z-index: 2000;position: absolute;right: 70px;background-color: white;">
There are: <a href="{% url 'showAll' %}"><span id="total_data"></span></a> data
</div>
{% endif %}
<div id="result-panel-toggle" class="hide">
<button class="btn btn-info btn-large"
onclick="toggleResultPanel();"
Expand Down Expand Up @@ -277,7 +282,7 @@ <h5 class="text-center">Set Your Search Parameters</h5>
<div id="imageBox" class="modal container hide fade text-center" tabindex="-2">
<img id="imageBoximage" src="" />
</div>
{% endblock%}
{% endblock %}

{% block extrajs %}
{{ block.super }}
Expand Down
7 changes: 5 additions & 2 deletions django_project/search/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
searchView,
searchguid,
submitSearch,
upload_geo
upload_geo,
showAll
)

urlpatterns = patterns(
Expand All @@ -22,5 +23,7 @@
url(r'^submitsearch/$', submitSearch,
name='submitSearch'),
url(r'^upload_geo/$', upload_geo,
name='upload_geo')
name='upload_geo'),
url(r'^showall/$', showAll, name='showAll'),

)
9 changes: 8 additions & 1 deletion django_project/search/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
HttpResponse,
Http404)
from django.contrib.auth.decorators import login_required
#from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.admin.views.decorators import staff_member_required
#from django.db.models import Count, Min, Max # for aggregate queries
from django.forms.models import inlineformset_factory

Expand Down Expand Up @@ -401,3 +401,10 @@ def upload_geo(theRequest):
simplejson.dumps({
"wkt": processGeometriesType(extractedGeometries).wkt}),
content_type='application/json', status=200)


@staff_member_required
#renderWithContext is explained in renderWith.py
@renderWithContext('showall.html')
def showAll(theRequest):
"""Show a map of all searches"""