Sha256: 44da846aed567063b6f55345d0e8809d9e39a96b963901866f960f2c79d320a9

Contents?: true

Size: 966 Bytes

Versions: 50

Compression:

Stored size: 966 Bytes

Contents

class Tenon.features.RecordApproval
  constructor: ->
    $(document).on 'click', 'a.approve, a.unapprove', @_toggleRecordApproval

  _toggleRecordApproval: (e) =>
    e.preventDefault()
    @$link = $(e.currentTarget)
    @_startIconLoad()
    @_setTooltip('Loading...')
    $.getJSON(@$link.attr('href'))
      .done(@_finishToggle)
      .fail((data)-> console.log(data))

  _finishToggle:  =>
    @$link.toggleClass('unapprove approve')
    if @$link.hasClass('approve')
      @_setTooltip('Approve')
      @$link.find('i').toggleClass('fa-spin fa-gear fa-thumbs-up')
    else
      @_setTooltip('Unapprove')
      @$link.find('i').toggleClass('fa-spin fa-gear fa-thumbs-down')

  _startIconLoad: =>
    @$link.find('i')
      .removeClass('fa-thumbs-up fa-thumbs-down')
      .addClass('fa-spin fa-gear')

  _setTooltip: (tooltip) =>
    @$link
      .tooltip('hide')
      .attr('data-original-title', tooltip)
      .tooltip('fixTitle')
      .tooltip('show')

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
tenon-1.1.4 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.1.3 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.1.2 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.1.1 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.76 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.75 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.74 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.73 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.72 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.71 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.70 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.69 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.68 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.67 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.66 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.65 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.64 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.63 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.62 app/assets/javascripts/tenon/features/record_approval.js.coffee
tenon-1.0.61 app/assets/javascripts/tenon/features/record_approval.js.coffee