From 6e287ac0a168be496079ed52af09757b9dca6813 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Mon, 15 Feb 2016 16:43:07 +0100 Subject: [PATCH] column select: disable double click --- .../app/lib/app_post/column_select.coffee | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/column_select.coffee b/app/assets/javascripts/app/lib/app_post/column_select.coffee index ec3f1307e..cbbb84178 100644 --- a/app/assets/javascripts/app/lib/app_post/column_select.coffee +++ b/app/assets/javascripts/app/lib/app_post/column_select.coffee @@ -25,6 +25,14 @@ class App.ColumnSelect extends Spine.Controller super @render() + @throttledRemove = _.throttle => + @remove @pickedValue + , 300, {trailing: false} + + @throttledSelect = _.throttle => + @select @pickedValue + , 300, {trailing: false} + render: -> @values = [] _.each @options.attribute.options, (option) => @@ -43,7 +51,8 @@ class App.ColumnSelect extends Spine.Controller # , 0 onSelect: (event) -> - @select $(event.currentTarget).attr('data-value') + @pickedValue = $(event.currentTarget).attr('data-value') + @throttledSelect() select: (value) -> @selected.find("[data-value='#{value}']").removeClass 'is-hidden' @@ -58,7 +67,8 @@ class App.ColumnSelect extends Spine.Controller @clear() onRemove: (event) -> - @remove $(event.currentTarget).attr('data-value') + @pickedValue = $(event.currentTarget).attr('data-value') + @throttledRemove() remove: (value) -> @pool.find("[data-value='#{value}']").removeClass 'is-hidden' @@ -90,7 +100,7 @@ class App.ColumnSelect extends Spine.Controller onFilterKeydown: (event) -> return if event.keyCode != 13 - + event.stopPropagation() event.preventDefault()