Sha256: c4662b941e0a06f7566b813725b93a9b3d63bf845e31b7ffa1a72189a5f5275c

Contents?: true

Size: 688 Bytes

Versions: 5

Compression:

Stored size: 688 Bytes

Contents

//= require jquery-1.8.3.min
//= require jquery_ujs
//= require_tree .

jQuery(function($) {
  $('.letter-opener').on('click', 'tr', function() {
    var $this = $(this);
    $('iframe').attr('src', $this.find('a').attr('href'));
    $this.parent().find('.active').removeClass('active');
    $this.addClass('active');
  });

  $('.refresh').click(function(e) {
    e.preventDefault();

    var table = $('.letter-opener');
    table.find('tbody').empty().append('<tr><td colspan="2">Loading...</td></tr>');
    table.load(table.data('letters-path') + ' .letter-opener', function() {
      $('iframe').attr('src', $('.letter-opener tbody a:first-child()').attr('href'));
    });
  });
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
letter_opener_web-1.1.3 app/assets/javascripts/letter_opener_web/application.js
letter_opener_web-1.1.2 app/assets/javascripts/letter_opener_web/application.js
letter_opener_web-1.1.1 app/assets/javascripts/letter_opener_web/application.js
letter_opener_web-1.1.0 app/assets/javascripts/letter_opener_web/application.js
letter_opener_web-1.0.3 app/assets/javascripts/letter_opener_web/application.js