1
0

Restore filter functionality in UI.

This commit is contained in:
Markus Birth 2018-06-03 20:45:57 +02:00
parent 476f532544
commit 8db766dc9c
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
4 changed files with 18 additions and 13 deletions

View File

@ -106,17 +106,8 @@ window.gotoAccuracy = ->
window.changeTrackerID = ->
console.log 'changeTrackerID'
_trackerID = $('#trackerID_selector').val()
if _trackerID != window.trackerID
Cookies.set 'trackerID', _trackerID
console.log 'changeTrackerID: trackerID cookie = %o', Cookies.get 'trackerID'
window.trackerID = _trackerID
window.mymap.drawMap()
else
$('#configCollapse').collapse 'hide'
tid = $('#trackerID_selector').val()
window.mymap.setMarkerFilter tid
return false
window.initUI = ->
@ -212,7 +203,7 @@ window.showBoundingBox = (lid) ->
window.updateTrackerIDs = ->
console.log 'updateTrackerIDs()'
$("#trackerID_selector option[value!='all']").each ->
$("#trackerID_selector option[value!='']").each ->
$(this).remove()
trackerIds = window.mymap.markermgr.getTrackerIds()
console.log 'Got these tracker ids: %o', trackerIds

View File

@ -38,6 +38,7 @@ class window.MarkerMgr
return result
setFilter: (new_filter) ->
console.log 'MarkerMgr::setFilter(%o)', new_filter
if new_filter?
@filter_tids = new_filter
else

View File

@ -4,6 +4,10 @@ class window.OwnMap
@markermgr = markermgr
@markermgr.startstop_only = Cookies.get('show_markers') is '0'
selected_tid = Cookies.get 'trackerID'
if selected_tid isnt ''
@markermgr.setFilter [selected_tid]
@map_drawn = false
@default_zoom = 15
@default_centre = [0, 0]
@ -87,6 +91,15 @@ class window.OwnMap
@default_centre = @mymap.getCenter()
, 2000
setMarkerFilter: (tid) ->
console.log 'OwnMap::setMarkerFilter(%o)', tid
Cookies.set 'trackerID', tid
if tid isnt ''
@markermgr.setFilter [tid]
else
@markermgr.setFilter()
@drawMap()
showMarkers: ->
console.log 'OwnMap::showMarkers()'
@markermgr.startstop_only = false

View File

@ -85,7 +85,7 @@
<span class="d-block d-sm-none"><span class="fas fa-user"></span></span>
</div>
<select class="form-control" name="tracker_id" id="trackerID_selector">
<option value="all">all</option>
<option value="">all</option>
</select>
</div>
</div>