Example #1
0
 return dashboard.reload().then(function() {
   if (dashboard.get('repository')) {
     return;
   }
   var id = dashboard.get('id'),
       accessToken = self.controllerFor('user').get('accessToken');
   return Repository.find(id, accessToken).then(function (repository) {
     dashboard.set('repository', repository);
   });
 });
Example #2
0
  model: function (params) {
    var id = params.github_user + '/' + params.github_repo,
        accessToken = this.controllerFor('user').get('accessToken');
    // We check if the repo exists before hitting the server
    // since we need to do this for the sidebar and this
    // saves the server from having to repeat it
    return Repository.find(id, accessToken).then(function (repository) {
      var promise, dashboard = Glazier.Dashboard.find(id);
      if (dashboard.get('isLoaded')) {
        promise = dashboard.reload();
      } else {
        promise = Glazier.Dashboard.find(id);
      }

      return promise.then(function(dashboard){
        dashboard.set('repository', repository);
        return dashboard;
      });
    });
  },