From dda2051d57b6ee455417bd059b041949b83e2470 Mon Sep 17 00:00:00 2001 From: Lisa P Date: Mon, 7 Sep 2015 15:53:14 +0200 Subject: [PATCH] commit current status --- app/controllers/branches.coffee | 17 ++++++++++++++ app/controllers/builds.coffee | 4 ---- app/router.coffee | 2 +- app/routes/branches.coffee | 24 ++++++++++++++++++-- app/routes/settings/index.coffee | 23 ------------------- app/templates/branches.hbs | 25 +++++++++++++++++++++ app/templates/builds.hbs | 8 +------ tests/unit/controllers/branches-test.coffee | 12 ++++++++++ 8 files changed, 78 insertions(+), 37 deletions(-) create mode 100644 app/controllers/branches.coffee create mode 100644 app/templates/branches.hbs create mode 100644 tests/unit/controllers/branches-test.coffee diff --git a/app/controllers/branches.coffee b/app/controllers/branches.coffee new file mode 100644 index 00000000..9b0549c7 --- /dev/null +++ b/app/controllers/branches.coffee @@ -0,0 +1,17 @@ +`import Ember from 'ember'` +`import { gravatarImage } from 'travis/utils/urls'` +`import GithubUrlPropertievs from 'travis/mixins/github-url-properties'` + +BranchesController = Ember.Controller.extend + + actions: + tiggerBuild: (branch) -> + console.log('trigger build') + + viewAllBuilds: (branch) -> + console.log('view all builds') + # updateFilter: (value) -> + # @set('_lastFilterValue', value) + # Ember.run.throttle this, @updateFilter, [], 200, false + +`export default BranchesController` diff --git a/app/controllers/builds.coffee b/app/controllers/builds.coffee index f89bba63..956c9dbb 100644 --- a/app/controllers/builds.coffee +++ b/app/controllers/builds.coffee @@ -41,10 +41,6 @@ Controller = Ember.ArrayController.extend false ).property('tab', 'repo.builds', 'repo.branches') - displayNewBranchRows: (-> - true if @get('tab') == 'branches' - ).property('tab', 'repo.builds', 'repo.branches') - noticeData: (-> return { repo: @get('repo'), diff --git a/app/router.coffee b/app/router.coffee index 8808ad21..7dfb7326 100644 --- a/app/router.coffee +++ b/app/router.coffee @@ -46,11 +46,11 @@ Router.map -> @route 'search', path: '/search/:phrase' @resource 'repo', path: '/:owner/:name', -> @route 'index', path: '/' + @resource 'branches', path: '/branches' @resource 'build', path: '/builds/:build_id' @resource 'job', path: '/jobs/:job_id' @resource 'builds', path: '/builds' @resource 'pullRequests', path: '/pull_requests' - @resource 'branches', path: '/branches' @resource 'requests', path: '/requests' @resource 'caches', path: '/caches' if config.endpoints.caches @resource 'request', path: '/requests/:request_id' diff --git a/app/routes/branches.coffee b/app/routes/branches.coffee index c58239b4..0dce5361 100644 --- a/app/routes/branches.coffee +++ b/app/routes/branches.coffee @@ -1,5 +1,25 @@ -`import AbstractBuildsRoute from 'travis/routes/abstract-builds'` +`import Ember from 'ember'` +`import TravisRoute from 'travis/routes/basic'` +`import config from 'travis/config/environment'` + +Route = TravisRoute.extend + + model: (params) -> + apiEndpoint = config.apiEndpoint + repoId = @modelFor('repo').get('id') + + options = {} + if @get('auth.signedIn') + options.headers = { Authorization: "token #{@auth.token()}" } + + $.ajax("#{apiEndpoint}/repos/#{repoId}/branch/master", options).then (response) -> + + console.log(response) + # response.repositories.sortBy('last_build.finished_at').filter( (repo) -> + # repo.last_build + # ).map( (repo) -> + # Ember.Object.create(repo) + # ) -Route = AbstractBuildsRoute.extend(contentType: 'branches') `export default Route` diff --git a/app/routes/settings/index.coffee b/app/routes/settings/index.coffee index d9845989..bb33bbe5 100644 --- a/app/routes/settings/index.coffee +++ b/app/routes/settings/index.coffee @@ -9,29 +9,6 @@ Route = TravisRoute.extend repo.fetchSettings().then (settings) -> - console.log(settings) repo.set('settings', settings) - # return { - - # settings: (-> - # $.ajax('https://api.travis-ci.org/v3/repos/#{repo.id}/settings', { - # headers: { - # Authorization: 'token ' + @auth.token() - # } - # }).then (response) -> - # console.log(response); - # return response - # ) - # env_vars: (-> - # $.ajax('/settings/env_vars?repository_id={repo.id}', { - # headers: { - # Authorization: 'token ' + @auth.token() - # } - # }).then (response) -> - # console.log(response); - # return response - # ) - # } - `export default Route` diff --git a/app/templates/branches.hbs b/app/templates/branches.hbs new file mode 100644 index 00000000..2a9c6027 --- /dev/null +++ b/app/templates/branches.hbs @@ -0,0 +1,25 @@ + +
+

Default Branch

+
+ + +
+

Active Branches

+
+ + + +
+

Inactive Branches

+
+ + +{{!-- {{#if content.isLoaded}} --}} + +{{branch-row build=build}} + + +{{!-- {{else}} + {{loading-indicator}} +{{/if}} --}} \ No newline at end of file diff --git a/app/templates/builds.hbs b/app/templates/builds.hbs index 6c2d69de..b771f6d0 100644 --- a/app/templates/builds.hbs +++ b/app/templates/builds.hbs @@ -1,13 +1,7 @@ {{#if content.isLoaded}}