Commit 94031420 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'filter-bug-fix' into 'master'

Fix bug with JS error from dropdowns in filter area

Fixes:

![consoleerror](/uploads/0fa19a943050baac855c9e6f896ea941/consoleerror.png)

This error is not a logged issue yet.

Error when turbolinks fetches a new page, `setup()` was not run. 

Signed-off-by: Jacob Schatz jschatz@gitlab.com

cc @iamphill @alfredo1 

See merge request !3216
parents 19ecfb5c 4fc2dcc4
...@@ -10,7 +10,6 @@ class @Breakpoints ...@@ -10,7 +10,6 @@ class @Breakpoints
setup: -> setup: ->
allDeviceSelector = BREAKPOINTS.map (breakpoint) -> allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}" ".device-#{breakpoint}"
return if $(allDeviceSelector.join(",")).length return if $(allDeviceSelector.join(",")).length
# Create all the elements # Create all the elements
...@@ -18,12 +17,17 @@ class @Breakpoints ...@@ -18,12 +17,17 @@ class @Breakpoints
"<div class='device-#{breakpoint} visible-#{breakpoint}'></div>" "<div class='device-#{breakpoint} visible-#{breakpoint}'></div>"
$("body").append els.join('') $("body").append els.join('')
getBreakpointSize: -> visibleDevice: ->
allDeviceSelector = BREAKPOINTS.map (breakpoint) -> allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}" ".device-#{breakpoint}"
$(allDeviceSelector.join(",")).filter(":visible")
$visibleDevice = $(allDeviceSelector.join(",")).filter(":visible") getBreakpointSize: ->
$visibleDevice = @visibleDevice
# the page refreshed via turbolinks
if not $visibleDevice().length
@setup()
$visibleDevice = @visibleDevice()
return $visibleDevice.attr("class").split("visible-")[1] return $visibleDevice.attr("class").split("visible-")[1]
@get: -> @get: ->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment