How to use the card.data function in card

To help you get started, we’ve selected a few card examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yapplabs / glazier / cards / github-repositories / app / routes / application.js View on Github external
setupController: function(controller, model) {
    this._super(controller, model);
    controller.set('currentRepository', card.data.repositoryName);
  },
github yapplabs / glazier / cards / github-issues / app / routes / application.js View on Github external
currentUserChanged: function(user) {
      var route = this;
      var applicationController = route.controllerFor('application');
      var repositoryName = card.data.repositoryName;
      var githubLogin = user && user.github_login;

      if (!user) {
        applicationController.set('myIssues', []);
        return;
      }

      Issue.
        findEverything(repositoryName, githubLogin).
          then(updateTheApplicationController).
          then(null, Conductor.error);

      function updateTheApplicationController(hash) {
        applicationController.set('myIssues', hash.userIssues || []);
        applicationController.set('model', hash.allIssues);
github yapplabs / glazier / cards / github-issues / app / routes / application.js View on Github external
model: function(){
    var route = this;
    var user = card.data.user;
    var githubLogin = user && user.github_login;
    var applicationController = this.controllerFor('application');
    var repositoryName = card.data.repositoryName;

    applicationController.set('repositoryName', repositoryName);

    function handleRejection(reason) {
      if (Issue.isErrorDueToIssuesBeingDisabled(reason)) {
        route.transitionTo('disabled');
      } else {
        throw reason;
      }
    }

    function process(hash) {
      applicationController.set('myIssues', hash.userIssues || []);
github yapplabs / glazier / cards / github-issues / app / models / issue.js View on Github external
findAllByRepositoryName: function(repositoryName) {
    var service;

    if (card.data.user) {
      service = card.consumers.authenticatedGithubApi;
    } else {
      service = card.consumers.unauthenticatedGithubApi;
    }

    return service.request("ajax", {
      url: '/repos/' + repositoryName + '/issues',
      dataType: 'json'
    });
  },
github yapplabs / glazier / cards / github-stars / app / routes / application.js View on Github external
model: function(){
    return retrieveStargazers(card.data.user);
  }
});
github yapplabs / glazier / cards / github-stars / app / routes / application.js View on Github external
function retrieveStargazers(user) {
  var repositoryName = card.data.repositoryName;

  return Ember.RSVP.hash({
    stargazers: Stargazers.findByRepositoryName(repositoryName, user),
    isStarred: Stargazers.currentUserStarred(repositoryName, user)
  }).then(function (hash) {
    var stargazers = hash.stargazers;
    return {
      user: user,
      repositoryName: repositoryName,
      stargazers: stargazers.data,
      totalStargazers: stargazers.total || stargazers.data.length,
      isStarred: hash.isStarred
    };
  }).then(null, Conductor.error);
}