From 8891b325b3e7321c77566b9c37af69bc96fcdc85 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Wed, 22 Jul 2015 15:05:27 +0200 Subject: [PATCH] fetch repo hook, but hide deactivate section for now --- app/routes/settings.coffee | 16 +++++++++++++++- app/templates/settings.hbs | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/routes/settings.coffee b/app/routes/settings.coffee index 3a2888a9..33d63f16 100644 --- a/app/routes/settings.coffee +++ b/app/routes/settings.coffee @@ -1,5 +1,6 @@ `import TravisRoute from 'travis/routes/basic'` `import Ajax from 'travis/utils/ajax'` +`import config from 'travis/config/environment'` Route = TravisRoute.extend needsAuth: true @@ -29,12 +30,25 @@ Route = TravisRoute.extend Ajax.get "/repos/#{repo.get('id')}/key", (data) => Ember.Object.create(fingerprint: data.fingerprint) + fetchRepositoryActiveFlag: -> + repoId = @modelFor('repo').get('id') + apiEndpoint = config.apiEndpoint + + $.ajax("#{apiEndpoint}/v3/repo/#{repoId}", { + headers: { + Authorization: 'token ' + @auth.token() + } + }).then( (response) -> + response.active + ); + model: () -> return Ember.RSVP.hash({ settings: @modelFor('repo').fetchSettings(), envVars: this.fetchEnvVars(), sshKey: this.fetchSshKey(), - customSshKey: this.fetchCustomSshKey() + customSshKey: this.fetchCustomSshKey(), + repositoryActive: this.fetchRepositoryActiveFlag() }); `export default Route` diff --git a/app/templates/settings.hbs b/app/templates/settings.hbs index de7299f0..bfb23762 100644 --- a/app/templates/settings.hbs +++ b/app/templates/settings.hbs @@ -38,10 +38,10 @@ {{/if}} -
+ {{!--

Deactivate Repository

If you'd no longer like to run this project on Travis CI you can deactivate it now.
You will be able to reactivate it in the future if you'd like to.

Deactivate Repository -
+
--}}