old_contents: //= require jquery
  
  $(function() {
    $('.login-trello').click(function() {
      Trello.authorize({
        type: "redirect",
        name: "Reportrello",
        scope: {
          read: true,
          write: true
        }
      });
    });
  })
new_contents: //= require jquery
  
  $(function() {
    $('.login-trello').click(function() {
      Reportrello.authorize();
    });
  
    Reportrello = {
      authorize: function() {
        var self = this
  
        Trello.authorize({
          type: 'popup',
          name: 'Reportrello',
          fragment: 'postmessage',
          scope: {
            read: true,
            write: true
          },
          expiration: 'never',
          success: function() {
            self.getMe();
          },
          error: function() {
            alert("Failed authentication");
          }
        });
      },
  
      getMe: function() {
        var token = localStorage.getItem('trello_token');
  
        Trello.rest(
          'GET',
          'members/me',
          {
            fields: 'username,fullName,avatar',
            token: token
          },
          function (object) {
            location.href = '/authentication/?user[token]=' + token + '&user[username]=' + object.username + '&user[fullname]=' + object.fullName
          },
          function (a) { alert("Failed authentication"); }
        );
      },
  
      newReport: function() {
  
      }
    }
  })
subject: Add JS to authentication and get user information by token