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 316f8708a..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' @@ -91,6 +101,9 @@ class App.ColumnSelect extends Spine.Controller onFilterKeydown: (event) -> return if event.keyCode != 13 + event.stopPropagation() + event.preventDefault() + firstVisibleOption = @poolOptions.not('.is-filtered').not('.is-hidden').first() if firstVisibleOption @select firstVisibleOption.attr('data-value') \ No newline at end of file diff --git a/app/assets/javascripts/app/views/customer_chat/setting.jst.eco b/app/assets/javascripts/app/views/customer_chat/setting.jst.eco index ed4f22deb..a80c1203e 100644 --- a/app/assets/javascripts/app/views/customer_chat/setting.jst.eco +++ b/app/assets/javascripts/app/views/customer_chat/setting.jst.eco @@ -23,9 +23,9 @@ <% for chat in @chats: %>