Sha256: 37765c75b1c0d40399d0ad622e0fa8662bed0b784bff00ccd2a5b9deb7c1f21e

Contents?: true

Size: 1.63 KB

Versions: 3

Compression:

Stored size: 1.63 KB

Contents

$ ->
  # CONTROLS
  holder = $('.comments_list')
  
  holder.on 'ajax:success', '.to_published', (request, response, status) ->
    link = $ @
    link.parents('.item').first().attr('class', 'item published')

  holder.on 'ajax:success', '.to_draft', (request, response, status) ->
    link = $ @
    link.parents('.item').first().attr('class', 'item draft')

  holder.on 'ajax:success', '.to_spam, .to_deleted', (request, response, status) ->
    $(@).parents('li').first().hide()

  $('.comments_tree').on 'ajax:success', '.delete', (request, response, status) ->
    $(@).parents('li').first().hide()

  # INPLACE EDIT
  inplace_forms = '.comments_list .form form'
  $(document).on 'ajax:success', inplace_forms, (request, response, status) ->
    form = $ @
    item = form.parents('.item')
    item.children('.body').html(response).show()
    item.children('.form').hide()

  # FOR MANAGE SECTION
  list = $('.comments_list')

  list.on 'click', '.controls a.view', ->
    form = $(@).parents('div.form')
    body = form.siblings('.body')  
    body.show()
    form.hide()
    false

  list.on 'click', '.controls a.edit', ->
    body = $(@).parents('div.body')
    form = body.siblings('.form')
    body.hide()
    form.show()
    false

  # BLACK LIST
  holder = $('.black_list')

  holder.on 'ajax:success', '.to_warning', (request, response, status) ->
    link = $ @
    li = link.parents('li').first()
    li.attr 'class', 'warning'
    li.find('.state').html 'warning'

  holder.on 'ajax:success', '.to_banned', (request, response, status) ->
    link = $ @
    li = link.parents('li').first()
    li.attr 'class', 'banned'
    li.find('.state').html 'banned'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
the_comments-1.1.0 app/assets/javascripts/the_comments_manage.js.coffee
the_comments-1.0.0 app/assets/javascripts/the_comments_manage.js.coffee
the_comments-0.9.9 app/assets/javascripts/the_comments_manage.js.coffee