Sha256: 9ba4d72df45ab8dade100fe0d95b1cf05605a383248984a7d75d56eaf02b974a

Contents?: true

Size: 840 Bytes

Versions: 1

Compression:

Stored size: 840 Bytes

Contents

function extractId(obj) {
  tokens = obj.attr('id').split('-');
  return tokens[tokens.length-1];
}

$(document).ready(function (){
  if ($('#recent-comments').length) {
    $('.comment-body').hide();

    $('.comment-link').click(function() {
      comment_body_id = '#comment-body-' + extractId($(this));

      $('.comment-body').not(comment_body_id).hide();
      $(comment_body_id).toggle();

      return false;
    });

    $(document).click(function() {
      $('.comment-body').hide();
    });

    asyncUndoBehaviour();

    $('form.delete-item').submit(function () {
      asyncDeleteForm($(this));

      // Assume success and remove comment
      comment_link_id = '#comment-link-' + extractId($(this));
      $(comment_link_id).remove();
      $(this).parent('div').parent('div').remove();
      return false;
    });
  }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enki-engine-0.0.5 app/assets/javascripts/admin/dashboard.js