Restore filter functionality in UI.
This commit is contained in:
parent
476f532544
commit
8db766dc9c
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user