<commit_before>_ = require "underscore"
$2 = require "jquery-ui/slider"
ContinuumView = require "../common/continuum_view"
{logger} = require "../common/logging"
slidertemplate = require "./slidertemplate"
InputWidget = require "./input_widget"

class SliderView extends ContinuumView
  tagName: "div"
  template: slidertemplate

  initialize: (options) ->
    super(options)
    @render()

  render: () ->
    @$el.empty()
    html = @template(@model.attributes)
    @$el.html(html)
    max = @mget('end')
    min = @mget('start')
    step = @mget('step') or ((max - min)/50)
    logger.debug("slider render: min, max, step = (#{min}, #{max}, #{step})")
    @$('.slider').slider({
      orientation: @mget('orientation')
      animate: "fast",
      slide: _.throttle(@slide, 200),
      value: @mget('value')
      min: min,
      max: max,
      step: step,<commit_msg>fix plumbing for slider updates<commit_after>_ = require "underscore"
$2 = require "jquery-ui/slider"
ContinuumView = require "../common/continuum_view"
{logger} = require "../common/logging"
slidertemplate = require "./slidertemplate"
InputWidget = require "./input_widget"

class SliderView extends ContinuumView
  tagName: "div"
  template: slidertemplate

  initialize: (options) ->
    super(options)
    @listenTo(@model, 'change', @render)
    @$el.empty()
    html = @template(@model.attributes)
    @$el.html(html)
    @render()

  render: () ->
    max = @mget('end')
    min = @mget('start')
    step = @mget('step') or ((max - min)/50)
    logger.debug("slider render: min, max, step = (#{min}, #{max}, #{step})")
    @$('.slider').slider({
      orientation: @mget('orientation')
      animate: "fast",
      slide: _.throttle(@slide, 200),
      value: @mget('value')
      min: min,
      max: max,
      step: step,
{'fraction_non_alphanumeric': 0.18025513033832502, 'fraction_numerical': 0.0066555740432612314, 'mean_word_length': 3.378640776699029, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3210325', 'n_tokens_mistral': 609, 'n_tokens_neox': 594, 'n_words': 142}