Sha256: 2a04a8877d8ec13bfacd73f935dbf9e341f8ae31b9bb4b151562daeee1831681

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 Bytes

Contents

class @PostsHeader
  constructor: (@list) ->
    @_add_subscriptions()
    @_add_refresh()


  # PRIVATE ===============================================

  _add_subscriptions: ->
    @list.$subscriptions =$ """<a href='#/tape/subscriptions'
                                  class='tape-header-subscriptions'>
                                 <i class='fa fa-ellipsis-h'></i>
                                </a>"""
    @list.$search.before(@list.$subscriptions)


  _add_refresh: ->
    @list.$refresh =$ """<a href='#' class='tape-refresh-posts'>
                           <i class='fa fa-refresh'></i>
                         </a>"""
    @list.$refresh.on 'click', (e) =>
      e.preventDefault()
      @_refesh()

    @list.$header.prepend(@list.$refresh)


  _refesh: ->
    @list.showSpinner()
    $.get '/admin/tape_posts/new', =>
      @list.updateItems()

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tape-chr-0.1.9 app/assets/javascripts/tape/posts_header.coffee
tape-chr-0.1.8 app/assets/javascripts/tape/posts_header.coffee