Sha256: a5870fa3e5715d978c42e777067088952a1b033c6e9407bd214a3daf12ae3b64

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

class window.Locator
  constructor: ->
    @to_locale = $('#edit_locale_name').val()
    @from_locale = $('#main_locale_name').val()
    @initHandlers()

  initHandlers: ->
    self = this

    $('#show_all').click ->
      $('#locale_data tr').show()

    $('#show_incomplete').click ->
      $('#locale_data tr').hide()
      $('#locale_data tr.error').show()

    $('#show_complete').click ->
      $('#locale_data tr').hide()
      $('#locale_data tr.ready').show()

    $('#translate_incomplete').click ->
      empty_areas = _.filter $("#locale_data tr textarea:enabled"), (el) ->
        not $.trim($(el).val())
      for el in empty_areas
        $(el).closest('tr').find('.auto_translate').trigger('click')

    $('#locale_data .auto_translate').click (e) ->
      e.preventDefault()
      $cont = $(this).closest('tr')
      $input_to = $cont.find('textarea:enabled')
      $input_from = $cont.find('textarea:disabled')
      window.google_t($input_from.val(), $input_to, self.from_locale, self.to_locale)

    $('.filter_field').keyup ->
      $el = $(this)
      ind = $el.closest('th').index() + 1
      text = $el.val().replace(/'/, '\'')
      $('#locale_data tr').hide()
      $("#locale_data td:nth-child(#{ind}):contains('#{text}')").parent().show()

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ab_admin-0.5.0 app/assets/javascripts/ab_admin/components/locator.js.coffee
ab_admin-0.4.0 app/assets/javascripts/ab_admin/components/locator.js.coffee