Sha256: e5b77183a2a4868bdff6a6a1b16d42c7dded7a938b11d1c4d064e1e2f1630a7b

Contents?: true

Size: 833 Bytes

Versions: 8

Compression:

Stored size: 833 Bytes

Contents

$(document).ready(function () {
  $('.email-events').each(function() {
    var events_container = this;

    $(events_container).html('<span class="fa fa-circle-o-notch fa-spin"></span>');

    var data_url = $(events_container).data('url');
    $.ajax(data_url)
      .done(function(json) {
        if (!json.length) {
          $(events_container).html('<em>No events found.</em>');
          return;
        }

        var $new_html = $('<ul>');
        $(json).each(function(_, event) {
          $new_html.append('<li><p>' + event.subject + ' : <strong>' + event.type + '</strong><br><em>' + event.timestamp + '</em></p></li>');
        });
        $(events_container).html($new_html);
      })
      .fail(function() {
        $(events_container).html('<em>An error ocurred. Please try again later.</em>');
      });
  });
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hackathon_manager-0.4.1 app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js
hackathon_manager-0.4.0 app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js
hackathon_manager-0.3.3 app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js
hackathon_manager-0.3.2 app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js
hackathon_manager-0.3.1 app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js
hackathon_manager-0.3.0 app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js
hackathon_manager-0.2.0 app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js
hackathon_manager-0.1.0 app/assets/javascripts/hackathon_manager/manage/lib/emailEvents.js