diff --git a/app/adapters/application.js b/app/adapters/application.js index 77427849..033ecc5a 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -7,6 +7,16 @@ export default DS.ActiveModelAdapter.extend({ host: config.apiEndpoint, coalesceFindRequests: true, + // Before Ember Data 2.0 the default behaviour of running `findAll` was to get + // new records only when there're no records in the store. This will change + // to a different strategy in 2.0: when you run `findAll` it will not get any + // new data initially, but it will try loading new data in the background. + // + // I'm disabling the new behaviour for now. + shouldBackgroundReloadRecord() { + return false; + }, + ajaxOptions(url, type, options) { var base, hash, token; diff --git a/app/adapters/env-var.js b/app/adapters/env-var.js index 4aaca486..2c688d13 100644 --- a/app/adapters/env-var.js +++ b/app/adapters/env-var.js @@ -7,7 +7,7 @@ export default ApplicationAdapter.extend({ buildURL(type, id, record) { var delimiter, repoId, url; url = this._super.apply(this, arguments); - if (record && (repoId = Ember.get(record, 'repo.id'))) { + if (record && record.belongsTo('repo') && (repoId = record.belongsTo('repo').id)) { delimiter = url.indexOf('?') !== -1 ? '&' : '?'; url = "" + url + delimiter + "repository_id=" + repoId; } @@ -15,12 +15,12 @@ export default ApplicationAdapter.extend({ }, updateRecord(store, type, record) { - var data, id, serializer; + var data, serializer; data = {}; - serializer = store.serializerFor(type.typeKey); + serializer = store.serializerFor(type.modelName); serializer.serializeIntoHash(data, type, record); - id = Ember.get(record, 'id'); - return this.ajax(this.buildURL(type.typeKey, id, record), "PATCH", { + var id = record.id; + return this.ajax(this.buildURL(type.modelName, id, record), "PATCH", { data: data }); } diff --git a/app/adapters/ssh-key.js b/app/adapters/ssh-key.js index 25e9113a..749040f4 100644 --- a/app/adapters/ssh-key.js +++ b/app/adapters/ssh-key.js @@ -4,24 +4,24 @@ import ApplicationAdapter from 'travis/adapters/application'; export default ApplicationAdapter.extend({ namespace: 'settings', - find(store, type, id, record) { + findRecord(store, type, id, record) { return this.ajax(this.urlPrefix() + '/ssh_key/' + id, 'GET'); }, deleteRecord(store, type, record) { - var id; - id = Ember.get(record, 'id'); + var id = record.id; return this.ajax(this.urlPrefix() + '/ssh_key/' + id, "DELETE"); }, createRecord(store, type, record) { - var data, id, serializer; + var data, serializer; data = {}; - serializer = store.serializerFor(type.typeKey); + serializer = store.serializerFor(type.modelName); serializer.serializeIntoHash(data, type, record, { includeId: true }); - id = Ember.get(record, 'id'); + + var id = record.id; return this.ajax(this.urlPrefix() + '/ssh_key/' + id, "PATCH", { data: data }); diff --git a/app/app.js b/app/app.js index e4aed0e2..f56a9fcf 100644 --- a/app/app.js +++ b/app/app.js @@ -5,7 +5,7 @@ import config from './config/environment'; Ember.MODEL_FACTORY_INJECTIONS = true; -Ember.LinkView.reopen({ +Ember.LinkComponent.reopen({ attributeBindings: ['alt'] }); diff --git a/app/components/add-ssh-key.js b/app/components/add-ssh-key.js index 648ed32d..0bf3a0d9 100644 --- a/app/components/add-ssh-key.js +++ b/app/components/add-ssh-key.js @@ -11,7 +11,7 @@ export default Ember.Component.extend({ var model = this.get('store').recordForId('ssh_key', id); if (model) { - this.get('store').dematerializeRecord(model._internalModel); + this.get('store').unloadRecord(model); var typeMap = this.get('store').typeMapFor(model.constructor); var idToRecord = typeMap.idToRecord; delete idToRecord[id]; @@ -62,7 +62,8 @@ export default Ember.Component.extend({ } this.set('isSaving', true); if (this.isValid()) { - ssh_key = this.get('model').setProperties({ + ssh_key = this.get('model'); + ssh_key.setProperties({ description: this.get('description'), value: this.get('value') }); diff --git a/app/views/build.js b/app/components/build-wrapper.js similarity index 60% rename from app/views/build.js rename to app/components/build-wrapper.js index 0e981f04..9ea0f843 100644 --- a/app/views/build.js +++ b/app/components/build-wrapper.js @@ -1,11 +1,10 @@ +import Ember from 'ember'; import { colorForState } from 'travis/utils/helpers'; -import BasicView from 'travis/views/basic'; import Polling from 'travis/mixins/polling'; -export default BasicView.extend(Polling, { +export default Ember.Component.extend({ classNameBindings: ['color'], - buildBinding: 'controller.build', - pollModels: 'controller.build', + pollModels: 'build', color: function() { return colorForState(this.get('build.state')); diff --git a/app/views/builds.js b/app/components/builds-wrapper.js similarity index 70% rename from app/views/builds.js rename to app/components/builds-wrapper.js index eca5f332..b3a1ecb3 100644 --- a/app/views/builds.js +++ b/app/components/builds-wrapper.js @@ -1,12 +1,15 @@ -import BasicView from 'travis/views/basic'; +import Ember from 'ember'; import Polling from 'travis/mixins/polling'; -export default BasicView.extend(Polling, { +export default Ember.Component.extend({ + store: Ember.inject.service('store'), + pollHook: function(store) { var contentType, repositoryId; - contentType = this.get('controller.contentType'); - repositoryId = this.get('controller.repo.id'); - store = this.get('controller.store'); + contentType = this.get('contentType'); + repositoryId = this.get('repo.id'); + store = this.get('store'); + if (contentType === 'builds') { return store.query('build', { event_type: 'push', diff --git a/app/components/env-var.js b/app/components/env-var.js index 92f935a6..6442130b 100644 --- a/app/components/env-var.js +++ b/app/components/env-var.js @@ -8,7 +8,7 @@ export default Ember.Component.extend({ actionType: 'Save', showValueField: Ember.computed.alias('public'), - value: function(key, value) { + value: function(key) { if (this.get('envVar.public')) { return this.get('envVar.value'); } else { diff --git a/app/components/job-log.js b/app/components/job-log.js index 37f31999..c4d01e9e 100644 --- a/app/components/job-log.js +++ b/app/components/job-log.js @@ -3,36 +3,24 @@ import Ember from 'ember'; export default Ember.Component.extend({ logBinding: 'job.log', - didInsertElement() { - return this.setupLog(); - }, + didReceiveAttrs: function(options) { + this._super(...arguments); - logDidChange: function() { - return this.setupLog(); - }.observes('log'), + if(options.oldAttrs && options.oldAttrs.job) { + this.teardownLog(options.oldAttrs.job.value); + } - logWillChange: function() { - return this.teardownLog(); - }.observesBefore('log'), - - willDestroyElement() { - return this.teardownLog(); - }, - - teardownLog() { - var job; - job = this.get('job'); - if (job) { - return job.unsubscribe(); + if(options.newAttrs && options.newAttrs.job) { + this.setupLog(options.newAttrs.job.value); } }, - setupLog() { - var job; - job = this.get('job'); - if (job) { - job.get('log').fetch(); - return job.subscribe(); - } + teardownLog(job) { + job.unsubscribe(); + }, + + setupLog(job) { + job.get('log').fetch(); + job.subscribe(); } }); diff --git a/app/views/job.js b/app/components/job-wrapper.js similarity index 70% rename from app/views/job.js rename to app/components/job-wrapper.js index 032e5161..5b190528 100644 --- a/app/views/job.js +++ b/app/components/job-wrapper.js @@ -3,10 +3,8 @@ import { colorForState } from 'travis/utils/helpers'; import { githubCommit } from 'travis/utils/urls'; import Polling from 'travis/mixins/polling'; -export default Ember.View.extend(Polling, { - pollModels: 'controller.job.build', - repoBinding: 'controller.repo', - jobBinding: 'controller.job', +export default Ember.Component.extend({ + pollModels: 'job.build', commitBinding: 'job.commit', currentItemBinding: 'job', @@ -16,5 +14,5 @@ export default Ember.View.extend(Polling, { urlGithubCommit: function() { return githubCommit(this.get('repo.slug'), this.get('commit.sha')); - }.property('repo.slug', 'commit.sha'), + }.property('repo.slug', 'commit.sha') }); diff --git a/app/components/log-content.js b/app/components/log-content.js index 0fd30781..b21cfe6c 100644 --- a/app/components/log-content.js +++ b/app/components/log-content.js @@ -68,14 +68,14 @@ export default Ember.Component.extend({ console.log('log view: did insert'); } this._super.apply(this, arguments); - return this.createEngine(); + Ember.run.scheduleOnce('afterRender', this, 'createEngine'); }, willDestroyElement() { if (Log.DEBUG) { console.log('log view: will destroy'); } - return this.teardownLog(); + Ember.run.scheduleOnce('afterRender', this, 'teardownLog'); }, teardownLog(log) { @@ -121,7 +121,7 @@ export default Ember.Component.extend({ this.engine.limit = this.limit; this.logFolder = new LogFolder(this.$('#log')); this.lineSelector = new LinesSelector(this.$('#log'), this.scroll, this.logFolder); - return this.observeParts(log); + this.observeParts(log); } }, @@ -158,7 +158,7 @@ export default Ember.Component.extend({ if (Log.DEBUG) { console.log('log view: parts did change'); } - if (this.get('state') !== 'inDOM') { + if (this.get('_state') !== 'inDOM') { return; } ref = parts.slice(start, start + added); diff --git a/app/views/application.js b/app/components/popup-click-handler.js similarity index 61% rename from app/views/application.js rename to app/components/popup-click-handler.js index f706832f..c810b87b 100644 --- a/app/views/application.js +++ b/app/components/popup-click-handler.js @@ -1,18 +1,17 @@ -import BasicView from 'travis/views/basic'; import Ember from 'ember'; -export default BasicView.extend({ +export default Ember.Component.extend({ popup: Ember.inject.service(), classNames: ['application'], click(event) { - var targetAndParents; - targetAndParents = $(event.target).parents().andSelf(); + var targetAndParents = $(event.target).parents().andSelf(); + if (!(targetAndParents.hasClass('open-popup') || targetAndParents.hasClass('popup'))) { this.get('popup').close(); } if (!targetAndParents.hasClass('menu') && !targetAndParents.is('#tools > a')) { - return $('.menu').removeClass('display'); + $('.menu').removeClass('display'); } } }); diff --git a/app/components/profile-accounts-wrapper.js b/app/components/profile-accounts-wrapper.js new file mode 100644 index 00000000..83423d73 --- /dev/null +++ b/app/components/profile-accounts-wrapper.js @@ -0,0 +1,6 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + classNames: ['profile-orglist', 'columns', 'medium-4'], + tagName: 'aside', +}); diff --git a/app/components/repo-wrapper.js b/app/components/repo-wrapper.js new file mode 100644 index 00000000..1ca2bd7f --- /dev/null +++ b/app/components/repo-wrapper.js @@ -0,0 +1,7 @@ +import Polling from 'travis/mixins/polling'; +import Ember from 'ember'; + +export default Ember.Component.extend(Polling, { + pollModels: 'repo', + classNameBindings: ['isLoading:loading'] +}); diff --git a/app/views/repos-list-tabs.js b/app/components/repos-list-tabs.js similarity index 78% rename from app/views/repos-list-tabs.js rename to app/components/repos-list-tabs.js index c24cc7f5..3524e1fc 100644 --- a/app/views/repos-list-tabs.js +++ b/app/components/repos-list-tabs.js @@ -1,13 +1,14 @@ import Ember from 'ember'; -export default Ember.View.extend({ - templateName: 'repos/list/tabs', - tabBinding: 'controller.tab', - currentUserBinding: 'controller.currentUser.model', +export default Ember.Component.extend({ + auth: Ember.inject.service(), + + currentUserBinding: 'auth.currentUser', + classRecent: function() { if (this.get('tab') === 'recent') { return 'active'; - } else if (this.get('tab') === 'search' && this.get('controller').auth.get('signedIn')) { + } else if (this.get('tab') === 'search' && this.get('auth.signedIn')) { return 'hidden'; } }.property('tab'), diff --git a/app/views/status-image-input.js b/app/components/status-image-input.js similarity index 100% rename from app/views/status-image-input.js rename to app/components/status-image-input.js diff --git a/app/components/status-images.js b/app/components/status-images.js new file mode 100644 index 00000000..7ced75f0 --- /dev/null +++ b/app/components/status-images.js @@ -0,0 +1,24 @@ +import Ember from 'ember'; +import { format as formatStatusImage } from 'travis/utils/status-image-formats'; + +export default Ember.Component.extend({ + popup: Ember.inject.service(), + + id: 'status-images', + attributeBindings: ['id'], + classNames: ['popup', 'status-images'], + formats: ['Image URL', 'Markdown', 'Textile', 'Rdoc', 'AsciiDoc', 'RST', 'Pod', 'CCTray'], + + actions: { + close() { + return this.get('popup').close(); + } + }, + + statusString: function() { + let format = this.get('format') || this.get('formats.firstObject'), + branch = this.get('branch') || 'master'; + + return formatStatusImage(format, this.get('repo.slug'), branch); + }.property('format', 'repo.slug', 'branch') +}); diff --git a/app/components/travis-layout.js b/app/components/travis-layout.js new file mode 100644 index 00000000..6e705e67 --- /dev/null +++ b/app/components/travis-layout.js @@ -0,0 +1,3 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({}); diff --git a/app/controllers/accounts.js b/app/controllers/accounts.js index 6f6fd118..38e5364f 100644 --- a/app/controllers/accounts.js +++ b/app/controllers/accounts.js @@ -1,3 +1,3 @@ import Ember from 'ember'; -export default Ember.ArrayController.extend(); +export default Ember.Controller.extend(); diff --git a/app/controllers/builds.js b/app/controllers/builds.js index dff591ff..a1c57d46 100644 --- a/app/controllers/builds.js +++ b/app/controllers/builds.js @@ -1,49 +1,33 @@ import Ember from 'ember'; -export default Ember.ArrayController.extend({ +export default Ember.Controller.extend({ sortAscending: false, sortProperties: ['number'], repoController: Ember.inject.controller('repo'), repoBinding: 'repoController.repo', tabBinding: 'repoController.tab', - isLoadedBinding: 'content.isLoaded', - isLoadingBinding: 'content.isLoading', + isLoadedBinding: 'model.isLoaded', + isLoadingBinding: 'model.isLoading', showMore() { var id, number, type; id = this.get('repo.id'); - number = this.get('lastObject.number'); - type = this.get('tab') === "builds" ? 'push' : 'pull_request'; - return this.get('content').load(this.olderThanNumber(id, number, type)); + number = this.get('model.lastObject.number'); + type = this.get('tab') === "model" ? 'push' : 'pull_request'; + return this.get('model').load(this.olderThanNumber(id, number, type)); }, displayShowMoreButton: function() { - return this.get('tab') !== 'branches' && parseInt(this.get('lastObject.number')) > 1; - }.property('tab', 'lastObject.number'), + return this.get('tab') !== 'branches' && parseInt(this.get('model.lastObject.number')) > 1; + }.property('tab', 'model.lastObject.number'), displayPullRequests: function() { - if (this.get('tab') === 'pull_requests') { - if (Ember.isEmpty(this.get('repo.pullRequests.content'))) { - return true; - } else { - return false; - } - } else { - return false; - } - }.property('tab', 'repo.builds', 'repo.pullRequests'), + return this.get('tab') === 'pull_requests'; + }.property('tab'), displayBranches: function() { - if (this.get('tab') === 'branches') { - if (Ember.isEmpty(this.get('repo.branches.content.content'))) { - return true; - } else { - return false; - } - } else { - return false; - } - }.property('tab', 'repo.builds', 'repo.branches'), + return this.get('tab') === 'branches'; + }.property('tab'), noticeData: function() { return { diff --git a/app/controllers/error.js b/app/controllers/error.js index 38e5364f..344c515b 100644 --- a/app/controllers/error.js +++ b/app/controllers/error.js @@ -1,3 +1,15 @@ import Ember from 'ember'; -export default Ember.Controller.extend(); +export default Ember.Controller.extend({ + layoutName: Ember.computed({ + get(key) { + if(this._layoutName) { + return 'layouts/' + this._layoutName; + } + }, + + set(key, value) { + return this._layoutName = value; + } + }) +}); diff --git a/app/controllers/loading.js b/app/controllers/loading.js index 38e5364f..344c515b 100644 --- a/app/controllers/loading.js +++ b/app/controllers/loading.js @@ -1,3 +1,15 @@ import Ember from 'ember'; -export default Ember.Controller.extend(); +export default Ember.Controller.extend({ + layoutName: Ember.computed({ + get(key) { + if(this._layoutName) { + return 'layouts/' + this._layoutName; + } + }, + + set(key, value) { + return this._layoutName = value; + } + }) +}); diff --git a/app/controllers/repo.js b/app/controllers/repo.js index bdda7a44..2e03d10c 100644 --- a/app/controllers/repo.js +++ b/app/controllers/repo.js @@ -1,11 +1,16 @@ import Ember from 'ember'; -import { githubRepo } from 'travis/utils/urls'; +import { githubRepo, statusImage } from 'travis/utils/urls'; +import config from 'travis/config/environment'; + export default Ember.Controller.extend({ + popup: Ember.inject.service(), + jobController: Ember.inject.controller('job'), buildController: Ember.inject.controller('build'), buildsController: Ember.inject.controller('builds'), reposController: Ember.inject.controller('repos'), + reposBinding: 'reposController.repos', currentUserBinding: 'auth.currentUser', classNames: ['repo'], @@ -14,6 +19,21 @@ export default Ember.Controller.extend({ builds: Ember.computed.alias('buildsController.content'), job: Ember.computed.alias('jobController.job'), + isEmpty: function() { + return this.get('repos.isLoaded') && this.get('repos.length') === 0; + }.property('repos.isLoaded', 'repos.length'), + + statusImageUrl: function() { + return statusImage(this.get('repo.slug')); + }.property('repo.slug'), + + actions: { + statusImages() { + this.get('popup').open('status-images'); + return false; + } + }, + slug: function() { return this.get('repo.slug'); }.property('repo.slug'), diff --git a/app/controllers/repos.js b/app/controllers/repos.js index 33d7cd2c..71b64b70 100644 --- a/app/controllers/repos.js +++ b/app/controllers/repos.js @@ -1,5 +1,4 @@ import Ember from 'ember'; -import limit from 'travis/utils/computed-limit'; import Repo from 'travis/models/repo'; import Config from 'travis/config/environment'; @@ -202,7 +201,7 @@ var Controller = Ember.Controller.extend({ Ember.run.cancel(this.searchLater); } this.searchLater = Ember.run.later(this, (function() { - this.transitionTo('main.search', phrase.replace(/\//g, '%2F')); + this.transitionToRoute('main.search', phrase.replace(/\//g, '%2F')); }), 500); }, diff --git a/app/controllers/requests.js b/app/controllers/requests.js index 816c3f35..e1f16b96 100644 --- a/app/controllers/requests.js +++ b/app/controllers/requests.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -export default Ember.ArrayController.extend({ +export default Ember.Controller.extend({ repoController: Ember.inject.controller('repo'), lintUrl: function() { diff --git a/app/controllers/top.js b/app/controllers/top.js index 27cc673d..de6962d5 100644 --- a/app/controllers/top.js +++ b/app/controllers/top.js @@ -102,5 +102,17 @@ export default Ember.Controller.extend({ }, showCta: function() { return !this.get('auth.signedIn') && !this.get('config.pro') && !this.get('landingPage'); - }.property('auth.signedIn', 'landingPage') + }.property('auth.signedIn', 'landingPage'), + + classProfile: function() { + var classes = ['profile menu']; + + if (this.get('tab') === 'profile') { + classes.push('active'); + } + + classes.push(this.get('controller.auth.state') || 'signed-out'); + + return classes.join(' '); + }.property('tab', 'auth.state') }); diff --git a/app/mixins/polling.js b/app/mixins/polling.js index 0213671e..001b9edb 100644 --- a/app/mixins/polling.js +++ b/app/mixins/polling.js @@ -3,6 +3,12 @@ import Ember from 'ember'; export default Ember.Mixin.create({ polling: Ember.inject.service(), + init() { + this.set('currentPollModels', {}); + + return this._super(...arguments); + }, + didInsertElement() { this._super.apply(this, arguments); return this.startPolling(); @@ -17,16 +23,20 @@ export default Ember.Mixin.create({ return this.pollModel(key); }, - pollModelWillChange(sender, key, value) { - return this.stopPollingModel(key); - }, - pollModel(property) { - var addToPolling, model; - addToPolling = () => { + var model = this.get(property), + currentPollModels = this.get('currentPollModels'); + + if(currentPollModels[property]) { + this.get('polling').stopPolling(currentPollModels[property]); + } + currentPollModels[property] = model; + + var addToPolling = () => { return this.get('polling').startPolling(model); }; - if (model = this.get(property)) { + + if (model) { if (model.then) { return model.then(function(resolved) { return addToPolling(resolved); @@ -38,8 +48,8 @@ export default Ember.Mixin.create({ }, stopPollingModel(property) { - var model; - if (model = this.get(property)) { + var model = this.get(property); + if (model) { return this.get('polling').stopPolling(model); } }, @@ -54,7 +64,6 @@ export default Ember.Mixin.create({ pollModels.forEach( (property) => { this.pollModel(property); this.addObserver(property, this, 'pollModelDidChange'); - return Ember.addBeforeObserver(this, property, this, 'pollModelWillChange'); }); } if (this.pollHook) { @@ -63,15 +72,15 @@ export default Ember.Mixin.create({ }, stopPolling() { - var pollModels; - if (pollModels = this.get('pollModels')) { + var pollModels = this.get('pollModels'); + + if (pollModels) { if (!Ember.isArray(pollModels)) { pollModels = [pollModels]; } pollModels.forEach( (property) => { this.stopPollingModel(property); this.removeObserver(property, this, 'pollModelDidChange'); - return Ember.removeBeforeObserver(this, property, this, 'pollModelWillChange'); }); } return this.get('polling').stopPollingHook(this); diff --git a/app/models/repo.js b/app/models/repo.js index 89ead250..3a9ba036 100644 --- a/app/models/repo.js +++ b/app/models/repo.js @@ -220,7 +220,7 @@ Repo.reopenClass({ return promise; } else { login = reposIdsOrlogin; - return store.find('repo', { + return store.query('repo', { member: login, orderBy: 'name' }); @@ -253,7 +253,7 @@ Repo.reopenClass({ }); }); } else { - return store.find('repo', { + return store.query('repo', { search: query, orderBy: 'name' }); @@ -299,7 +299,7 @@ Repo.reopenClass({ return repo; }); } else { - promise = store.find('repo', { + promise = store.query('repo', { slug: slug }).then(function(repos) { return repos.get('firstObject') || (function() { diff --git a/app/routes/auth.js b/app/routes/auth.js index 42b86f76..f0707b5c 100644 --- a/app/routes/auth.js +++ b/app/routes/auth.js @@ -5,7 +5,7 @@ export default TravisRoute.extend({ renderTemplate() { $('body').attr('id', 'auth'); - return this.render('auth.signin'); + return this.render('signin'); }, deactivate() { diff --git a/app/services/popup.js b/app/services/popup.js index 89c51b97..2a866c97 100644 --- a/app/services/popup.js +++ b/app/services/popup.js @@ -9,11 +9,6 @@ export default Ember.Service.extend({ }, close() { - var view; - if (view = Ember.View.currentPopupView) { - view.destroy(); - Ember.View.currentPopupView = null; - } return $('.popup').removeClass('display'); } }); diff --git a/app/templates/account.hbs b/app/templates/account.hbs index c68f5a7b..19bdae4a 100644 --- a/app/templates/account.hbs +++ b/app/templates/account.hbs @@ -1,14 +1,15 @@ {{#if allHooks.isLoaded}}
+ {{#if config.billingEndpoint}}
- {{#if view.subscribed}} + {{#if subscribeButtonInfo.subscribed}} Subscription active! {{else}} - {{#if view.education}} + {{#if subscribeButtonInfo.education}} Educational account! @@ -42,19 +43,19 @@
  1. - + Flick the repo switch
    Flick the repository switch on
  2. - + Add .travis.yml file
    Add .travis.yml file to your repository
  3. - + Do a git push
    Trigger your first build with a git push
  4. diff --git a/app/templates/application.hbs b/app/templates/application.hbs index c24cd689..47326c47 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -1 +1,3 @@ -{{outlet}} +{{#popup-click-handler}} + {{outlet}} +{{/popup-click-handler}} diff --git a/app/templates/build.hbs b/app/templates/build.hbs index 5ae9f8fb..02804d4e 100644 --- a/app/templates/build.hbs +++ b/app/templates/build.hbs @@ -1,3 +1,4 @@ +{{#build-wrapper build=build}} {{#if loading}} {{loading-indicator}} {{else}} @@ -16,3 +17,4 @@ {{/if}} {{/if}} +{{/build-wrapper}} diff --git a/app/templates/builds.hbs b/app/templates/builds.hbs index 06990ad0..87829b57 100644 --- a/app/templates/builds.hbs +++ b/app/templates/builds.hbs @@ -1,6 +1,7 @@ -{{#if content.isLoaded}} +{{#builds-wrapper contentType=contentType repo=repo}} +{{#if model.isLoaded}}
      - {{#each controller as |build|}} + {{#each model as |build|}} {{builds-item build=build}} {{else}} {{no-builds repo=noticeData isPR=displayPullRequests isBranch=displayBranches}} @@ -18,3 +19,4 @@ {{else}} {{loading-indicator}} {{/if}} +{{/builds-wrapper}} diff --git a/app/templates/components/repos-empty.hbs b/app/templates/components/repos-empty.hbs index d537537e..24601341 100644 --- a/app/templates/components/repos-empty.hbs +++ b/app/templates/components/repos-empty.hbs @@ -6,7 +6,7 @@

      You're only two steps away from using Travis:

        -
      • Hook up {{#link-to "profile.index" class="signed-in"}}one or more of your GitHub repositories{{/link-to}} with Travis.
      • +
      • Hook up {{#link-to "profile" class="signed-in"}}one or more of your GitHub repositories{{/link-to}} with Travis.
      • Push some code!
      diff --git a/app/templates/repos/list/tabs.hbs b/app/templates/components/repos-list-tabs.hbs similarity index 50% rename from app/templates/repos/list/tabs.hbs rename to app/templates/components/repos-list-tabs.hbs index fc8723a8..b7a2d294 100644 --- a/app/templates/repos/list/tabs.hbs +++ b/app/templates/components/repos-list-tabs.hbs @@ -1,16 +1,16 @@
        -
      • - My Repositories +
      • + My Repositories
      • {{#if config.pro}} -
      • - Running ({{startedJobsCount}}/{{allJobsCount}}) +
      • + Running ({{startedJobsCount}}/{{allJobsCount}})
      • {{/if}} -
      • +
      • {{#link-to "profile" trackEvent="add-repository-from-list" title="Add New Repository"}} {{/link-to}} diff --git a/app/templates/components/status-images.hbs b/app/templates/components/status-images.hbs new file mode 100644 index 00000000..24bcf4cd --- /dev/null +++ b/app/templates/components/status-images.hbs @@ -0,0 +1,25 @@ + +

        + + {{#if branches.isLoaded}} + {{#x-select value=branch}} + {{#each branches as |branch|}} + {{#x-option value=branch.commit.branch}}{{branch.commit.branch}}{{/x-option}} + {{/each}} + {{/x-select}} + {{else}} + {{loading-indicator}} + {{/if}} +

        + +

        + + {{status-image-input value=statusString class="url" rows=3}} +

        diff --git a/app/templates/dashboard.hbs b/app/templates/dashboard.hbs index c24cd689..70454b53 100644 --- a/app/templates/dashboard.hbs +++ b/app/templates/dashboard.hbs @@ -1 +1,3 @@ -{{outlet}} +{{#travis-layout layoutName="layouts/dashboard" class="dashboard"}} + {{outlet}} +{{/travis-layout}} diff --git a/app/templates/env-vars/_form.hbs b/app/templates/env-vars/_form.hbs deleted file mode 100644 index f7f25979..00000000 --- a/app/templates/env-vars/_form.hbs +++ /dev/null @@ -1,27 +0,0 @@ -
        - {{#travis-field "name"}} - {{#label for="name" class="name"}}Name:{{/label}} - {{input value=name class="env-name" placeholder="Name"}} {{travis-errors "name"}} - {{/travis-field}} - = - {{#if showValueField}} -
        - {{#label for="value" class="value"}}Value:{{/label}} - {{input value=value class="env-value" placeholder="Value"}} -
        - {{else}} -
        - {{value}} -
        - {{/if}} -
        - {{travis-switch active=public}} - {{#label for="secure" class="public"}}Display value in build logs{{/label}} -
        - -
        - - or - Cancel -
        -
        diff --git a/app/templates/env-vars/index.hbs b/app/templates/env-vars/index.hbs deleted file mode 100644 index 04eb7bef..00000000 --- a/app/templates/env-vars/index.hbs +++ /dev/null @@ -1 +0,0 @@ -{{#link-to "env_vars.new" class="add-env-var"}}Add a new variable{{/link-to}} diff --git a/app/templates/env-vars/new.hbs b/app/templates/env-vars/new.hbs deleted file mode 100644 index 1afee20f..00000000 --- a/app/templates/env-vars/new.hbs +++ /dev/null @@ -1 +0,0 @@ -{{partial 'env_vars/form'}} diff --git a/app/templates/error404.hbs b/app/templates/error404.hbs index cc397661..fb95f1fe 100644 --- a/app/templates/error404.hbs +++ b/app/templates/error404.hbs @@ -1,3 +1,4 @@ +{{#travis-layout layoutName="layouts/error" class="error error404"}}
        @@ -8,3 +9,4 @@

        404: Something's Missing

        We're sorry! It seems like this page cannot be found.

        +{{/travis-layout}} diff --git a/app/templates/first-sync.hbs b/app/templates/first-sync.hbs index d72e62d3..3cff22a1 100644 --- a/app/templates/first-sync.hbs +++ b/app/templates/first-sync.hbs @@ -1,3 +1,4 @@ +{{#travis-layout layoutName="layouts/simple"}}
        {{#if isSyncing}} @@ -23,3 +24,4 @@ {{/unless}}
        +{{/travis-layout}} diff --git a/app/templates/helpers/travis-errors.hbs b/app/templates/helpers/travis-errors.hbs deleted file mode 100644 index 394cd011..00000000 --- a/app/templates/helpers/travis-errors.hbs +++ /dev/null @@ -1 +0,0 @@ -{{#each view.errors as |error|}}{{error.message}}{{/each}} diff --git a/app/templates/home-pro.hbs b/app/templates/home-pro.hbs index 45319ab5..c3cdc5bb 100644 --- a/app/templates/home-pro.hbs +++ b/app/templates/home-pro.hbs @@ -1,3 +1,4 @@ +{{#travis-layout layoutName="layouts/landing-page" class="landing-pro"}}
        @@ -89,3 +90,4 @@
        +{{/travis-layout}} diff --git a/app/templates/home.hbs b/app/templates/home.hbs index cc41929d..89ba15ce 100644 --- a/app/templates/home.hbs +++ b/app/templates/home.hbs @@ -1,3 +1,4 @@ +{{#travis-layout layoutName="layouts/landing-page"}}
        @@ -248,3 +249,4 @@
        +{{/travis-layout}} diff --git a/app/templates/insufficient-oauth-permissions.hbs b/app/templates/insufficient-oauth-permissions.hbs index 5403a743..78073a0b 100644 --- a/app/templates/insufficient-oauth-permissions.hbs +++ b/app/templates/insufficient-oauth-permissions.hbs @@ -1,3 +1,4 @@ +{{#travis-layout layoutName="layouts/simple"}}
        @@ -23,3 +24,4 @@ {{/if}}
      +{{/travis-layout}} diff --git a/app/templates/job.hbs b/app/templates/job.hbs index 11a6a833..86cf7b02 100644 --- a/app/templates/job.hbs +++ b/app/templates/job.hbs @@ -1,3 +1,4 @@ +{{#job-wrapper repo=repo job=job}} {{#if job.isLoaded}} {{build-header item=job user=auth.currentUser commit=job.commit repo=repo}} @@ -9,3 +10,4 @@ {{loading-indicator}}
{{/if}} +{{/job-wrapper}} diff --git a/app/templates/loading.hbs b/app/templates/loading.hbs index 18503769..6350bd7a 100644 --- a/app/templates/loading.hbs +++ b/app/templates/loading.hbs @@ -1 +1,3 @@ -{{loading-indicator}} \ No newline at end of file +{{#travis-layout layoutName=layoutName}} + {{loading-indicator}} +{{/travis-layout}} diff --git a/app/templates/logo.hbs b/app/templates/logo.hbs index f37a6e5e..10b99210 100644 --- a/app/templates/logo.hbs +++ b/app/templates/logo.hbs @@ -1,3 +1,4 @@ +{{#travis-layout layoutName="layouts/landing-page" class="landing-pro"}}
@@ -142,4 +143,5 @@
- \ No newline at end of file + +{{/travis-layout}} diff --git a/app/templates/main.hbs b/app/templates/main.hbs index c24cd689..25a79202 100644 --- a/app/templates/main.hbs +++ b/app/templates/main.hbs @@ -1 +1,3 @@ -{{outlet}} +{{#travis-layout layoutName="layouts/home" class="main"}} + {{outlet}} +{{/travis-layout}} diff --git a/app/templates/not-found.hbs b/app/templates/not-found.hbs index 2f69fa59..a233a312 100644 --- a/app/templates/not-found.hbs +++ b/app/templates/not-found.hbs @@ -1 +1,3 @@ -The requested page was not found. +{{#travis-layout layoutName="layouts/simple"}} + The requested page was not found. +{{/travis-layout}} diff --git a/app/templates/owner.hbs b/app/templates/owner.hbs index 8cebd903..8a2ae6ed 100644 --- a/app/templates/owner.hbs +++ b/app/templates/owner.hbs @@ -1,3 +1,4 @@ +{{#travis-layout layoutName="layouts/profile" class="owner"}}
@@ -36,3 +37,4 @@ --}}
+{{/travis-layout}} diff --git a/app/templates/plans.hbs b/app/templates/plans.hbs index 54bf849c..c9084cb7 100644 --- a/app/templates/plans.hbs +++ b/app/templates/plans.hbs @@ -1,3 +1,4 @@ +{{#travis-layout layoutName="layouts/landing-page" class="landing-pro"}}
@@ -133,3 +134,4 @@
+{{/travis-layout}} diff --git a/app/templates/profile/accounts.hbs b/app/templates/profile-accounts.hbs similarity index 91% rename from app/templates/profile/accounts.hbs rename to app/templates/profile-accounts.hbs index 03b7513b..dbd2d495 100644 --- a/app/templates/profile/accounts.hbs +++ b/app/templates/profile-accounts.hbs @@ -1,3 +1,4 @@ +{{#profile-accounts-wrapper}}
    {{org-item account=user}} @@ -18,3 +19,4 @@ Review and add your authorized organizations.

{{/if}} +{{/profile-accounts-wrapper}} diff --git a/app/templates/profile.hbs b/app/templates/profile.hbs index f5977610..6fcedf7e 100644 --- a/app/templates/profile.hbs +++ b/app/templates/profile.hbs @@ -1,3 +1,5 @@ +{{#travis-layout layoutName="layouts/profile" class="profile-view"}}
{{outlet}} -
\ No newline at end of file + +{{/travis-layout}} diff --git a/app/templates/repo.hbs b/app/templates/repo.hbs index 5c0141a1..f92280cc 100644 --- a/app/templates/repo.hbs +++ b/app/templates/repo.hbs @@ -1,4 +1,5 @@ -{{#if view.isEmpty}} +{{#repo-wrapper repo=repo isLoading=isLoading}} +{{#if isEmpty}} {{repos-empty}} {{else}} @@ -7,11 +8,11 @@

{{#link-to "owner" repo.owner}}{{repo.owner}}{{/link-to}} / {{#link-to "repo" repo}}{{repo.name}}{{/link-to}}

@@ -38,4 +39,7 @@ {{else}} {{loading-indicator}} {{/if}} -{{/if}} \ No newline at end of file +{{/if}} +{{/repo-wrapper}} + +{{status-images repo=repo branches=repo.branches}} diff --git a/app/templates/repos.hbs b/app/templates/repos.hbs index 0451b2af..75026c0f 100644 --- a/app/templates/repos.hbs +++ b/app/templates/repos.hbs @@ -1,10 +1,10 @@ -{{view 'repos-list-tabs'}} +{{repos-list-tabs tab=tab showMyRepositories=(action "showMyRepositories") showRunningJobs=(action "showRunningJobs")}} {{#if showRunningJobs}} +{{/travis-layout}} diff --git a/app/templates/top.hbs b/app/templates/top.hbs index b91d555d..f3e14815 100644 --- a/app/templates/top.hbs +++ b/app/templates/top.hbs @@ -51,7 +51,7 @@ {{/unless}} {{/if}} -
  • +
  • {{#if auth.signedOut}} {{/if}} diff --git a/app/utils/computed-limit.js b/app/utils/computed-limit.js index e594acef..72f9a601 100644 --- a/app/utils/computed-limit.js +++ b/app/utils/computed-limit.js @@ -1,30 +1,12 @@ import Ember from 'ember'; var limit = function(dependentKey, limitKey) { - var options = { - addedItem: function(array, item, changeMeta) { - var limit = Ember.get(this, limitKey); - if (changeMeta.index < limit) { - array.insertAt(changeMeta.index, item); - if (Ember.get(array, "length") > limit) { - array.popObject(); - } - } - return array; - }, - removedItem: function(array, item, changeMeta) { - var limit = Ember.get(this, limitKey); - if (changeMeta.index < limit && changeMeta.index < Ember.get(array, 'length')) { - array.removeAt(changeMeta.index, 1); - var toPush = changeMeta.arrayChanged.objectAt(limit); - if (toPush) { - array.pushObject(toPush); - } - } - return array; - } - }; - return Ember.arrayComputed(dependentKey, limitKey, options); + return Ember.computed(dependentKey, dependentKey + ".[]", function() { + var limit = Ember.get(this, limitKey), + array = this.get(dependentKey); + + return array.toArray().slice(0, limit); + }); }; export default limit; diff --git a/app/utils/status-image-formats.js b/app/utils/status-image-formats.js index edb3b136..4e6e1afc 100644 --- a/app/utils/status-image-formats.js +++ b/app/utils/status-image-formats.js @@ -57,4 +57,5 @@ format = function(version, slug, branch) { } }; +export { format }; export default format; diff --git a/app/utils/test-auth.js b/app/utils/test-auth.js index 5d616a31..860bfa06 100644 --- a/app/utils/test-auth.js +++ b/app/utils/test-auth.js @@ -13,7 +13,7 @@ export default Ember.Object.extend({ signInForTests(user) { this.set('state', 'signed-in'); - if ((user.constructor.typeKey != null) !== 'user') { + if ((user.constructor.modelName != null) !== 'user') { this.store.push({ data: { type: 'user', diff --git a/app/views/.gitkeep b/app/views/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/app/views/accounts-info.js b/app/views/accounts-info.js deleted file mode 100644 index 8330dd5d..00000000 --- a/app/views/accounts-info.js +++ /dev/null @@ -1,10 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - templateName: 'profile/tabs/user', - userBinding: 'controller.user', - - gravatarUrl: function() { - return location.protocol + "//www.gravatar.com/avatar/" + (this.get('user.gravatarId')) + "?s=200&d=mm"; - }.property('user.gravatarId') -}); diff --git a/app/views/application/loading.js b/app/views/application/loading.js deleted file mode 100644 index 074c4433..00000000 --- a/app/views/application/loading.js +++ /dev/null @@ -1,3 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend(); diff --git a/app/views/auth/signin.js b/app/views/auth/signin.js deleted file mode 100644 index 09f8180b..00000000 --- a/app/views/auth/signin.js +++ /dev/null @@ -1,5 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend({ - layoutName: 'layouts/simple' -}); diff --git a/app/views/basic.js b/app/views/basic.js deleted file mode 100644 index 8712a88a..00000000 --- a/app/views/basic.js +++ /dev/null @@ -1,3 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend(); diff --git a/app/views/dashboard.js b/app/views/dashboard.js deleted file mode 100644 index a76fc0df..00000000 --- a/app/views/dashboard.js +++ /dev/null @@ -1,6 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend({ - layoutName: 'layouts/dashboard', - classNames: ['dashboard'] -}); diff --git a/app/views/dashboard/loading.js b/app/views/dashboard/loading.js deleted file mode 100644 index 8712a88a..00000000 --- a/app/views/dashboard/loading.js +++ /dev/null @@ -1,3 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend(); diff --git a/app/views/error.js b/app/views/error.js deleted file mode 100644 index a742a7ce..00000000 --- a/app/views/error.js +++ /dev/null @@ -1,10 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend({ - layoutName: function() { - var name; - if (name = this.get('controller.layoutName')) { - return 'layouts/' + name; - } - }.property('controller.layoutName') -}); diff --git a/app/views/error404.js b/app/views/error404.js deleted file mode 100644 index 27e2da03..00000000 --- a/app/views/error404.js +++ /dev/null @@ -1,6 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - layoutName: 'layouts/error', - classNames: ['error error404'] -}); diff --git a/app/views/first-sync.js b/app/views/first-sync.js deleted file mode 100644 index 9f2f62c1..00000000 --- a/app/views/first-sync.js +++ /dev/null @@ -1,5 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - layoutName: 'layouts/simple' -}); diff --git a/app/views/home-pro.js b/app/views/home-pro.js deleted file mode 100644 index 3a0039ff..00000000 --- a/app/views/home-pro.js +++ /dev/null @@ -1,6 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - classNames: ['landing-pro'], - layoutName: 'layouts/landing-page' -}); diff --git a/app/views/home.js b/app/views/home.js deleted file mode 100644 index 9c3fb90a..00000000 --- a/app/views/home.js +++ /dev/null @@ -1,5 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - layoutName: 'layouts/landing-page' -}); diff --git a/app/views/hooks.js b/app/views/hooks.js deleted file mode 100644 index 5aee8248..00000000 --- a/app/views/hooks.js +++ /dev/null @@ -1,11 +0,0 @@ -import BasicView from 'travis/views/basic'; -import { githubAdmin as githubAdminUrl } from 'travis/utils/urls'; - -export default BasicView.extend({ - templateName: 'profile/tabs/hooks', - userBinding: 'controller.user', - - urlGithubAdmin: function() { - return githubAdminUrl(this.get('hook.slug')); - }.property('hook.slug') -}); diff --git a/app/views/insufficient-oauth-permissions.js b/app/views/insufficient-oauth-permissions.js deleted file mode 100644 index 9f2f62c1..00000000 --- a/app/views/insufficient-oauth-permissions.js +++ /dev/null @@ -1,5 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - layoutName: 'layouts/simple' -}); diff --git a/app/views/loading.js b/app/views/loading.js deleted file mode 100644 index 44f7ec9b..00000000 --- a/app/views/loading.js +++ /dev/null @@ -1,10 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend({ - layoutName: (function() { - var name; - if (name = this.get('controller.layoutName')) { - return 'layouts/' + name; - } - }).property('controller.layoutName') -}); diff --git a/app/views/logo.js b/app/views/logo.js deleted file mode 100644 index 3a0039ff..00000000 --- a/app/views/logo.js +++ /dev/null @@ -1,6 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - classNames: ['landing-pro'], - layoutName: 'layouts/landing-page' -}); diff --git a/app/views/main.js b/app/views/main.js deleted file mode 100644 index 7d576766..00000000 --- a/app/views/main.js +++ /dev/null @@ -1,6 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend({ - layoutName: 'layouts/home', - classNames: ['main'] -}); diff --git a/app/views/not-found.js b/app/views/not-found.js deleted file mode 100644 index 09f8180b..00000000 --- a/app/views/not-found.js +++ /dev/null @@ -1,5 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend({ - layoutName: 'layouts/simple' -}); diff --git a/app/views/owner.js b/app/views/owner.js deleted file mode 100644 index 93d95f46..00000000 --- a/app/views/owner.js +++ /dev/null @@ -1,6 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend({ - layoutName: 'layouts/profile', - classNames: ['owner'] -}); diff --git a/app/views/plans.js b/app/views/plans.js deleted file mode 100644 index 3a0039ff..00000000 --- a/app/views/plans.js +++ /dev/null @@ -1,6 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - classNames: ['landing-pro'], - layoutName: 'layouts/landing-page' -}); diff --git a/app/views/profile-accounts.js b/app/views/profile-accounts.js deleted file mode 100644 index 9416f803..00000000 --- a/app/views/profile-accounts.js +++ /dev/null @@ -1,8 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - tabBinding: 'controller.tab', - classNames: ['profile-orglist', 'columns', 'medium-4'], - tagName: 'aside', - templateName: 'profile/accounts' -}); diff --git a/app/views/profile-tabs.js b/app/views/profile-tabs.js deleted file mode 100644 index 66de72bd..00000000 --- a/app/views/profile-tabs.js +++ /dev/null @@ -1,21 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - templateName: 'profile/tabs', - tabBinding: 'controller.tab', - activate() { - return this.get('controller').activate(event.target.name); - }, - - classHooks: function() { - return this.get('tab') === 'hooks' ? 'active' : null; - }.property('tab'), - - classUser: function() { - return this.get('tab') === 'user' ? 'active' : null; - }.property('tab'), - - displayUser: function() { - return this.get('controller.account.login') === this.get('controller.user.login'); - }.property('controller.account.login', 'controller.user.login') -}); diff --git a/app/views/profile.js b/app/views/profile.js deleted file mode 100644 index 8e701730..00000000 --- a/app/views/profile.js +++ /dev/null @@ -1,12 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - templateName: 'profile/show', - layoutName: 'layouts/profile', - classNames: ['profile-view'], - accountBinding: 'controller.account', - - name: function() { - return this.get('account.name') || this.get('account.login'); - }.property('account.name', 'account.login') -}); diff --git a/app/views/repo-show-tabs.js b/app/views/repo-show-tabs.js deleted file mode 100644 index d670f07f..00000000 --- a/app/views/repo-show-tabs.js +++ /dev/null @@ -1,56 +0,0 @@ -import Ember from 'ember'; - -export default Ember.View.extend({ - templateName: 'repos/show/tabs', - tabBinding: 'controller.tab', - contextBinding: 'controller', - - classCurrent: function() { - return this.get('tab') === 'current' ? 'active' : null; - }.property('tab'), - - classBuilds: function() { - return this.get('tab') === 'builds' ? 'active' : null; - }.property('tab'), - - classPullRequests: function() { - return this.get('tab') === 'pull_requests' ? 'active' : null; - }.property('tab'), - - classBranches: function() { - return this.get('tab') === 'branches' ? 'active' : null; - }.property('tab'), - - classBuild: function() { - var classes, tab; - tab = this.get('tab'); - classes = []; - if (tab === 'build') { - classes.push('active'); - } - if (tab === 'build' || tab === 'job') { - classes.push('display-inline'); - } - return classes.join(' '); - }.property('tab'), - - classJob: function() { - return this.get('tab') === 'job' ? 'active' : null; - }.property('tab'), - - classRequests: function() { - return this.get('tab') === 'requests' ? 'active' : null; - }.property('tab'), - - classCaches: function() { - return this.get('tab') === 'caches' ? 'active' : null; - }.property('tab'), - - classSettings: function() { - return this.get('tab') === 'settings' ? 'active' : null; - }.property('tab'), - - classRequest: function() { - return this.get('tab') === 'request' ? 'active' : null; - }.property('tab') -}); diff --git a/app/views/repo.js b/app/views/repo.js deleted file mode 100644 index 102c711c..00000000 --- a/app/views/repo.js +++ /dev/null @@ -1,39 +0,0 @@ -import { statusImage } from 'travis/utils/urls'; -import StatusImagesView from 'travis/views/status-images'; -import BasicView from 'travis/views/basic'; -import config from 'travis/config/environment'; -import Polling from 'travis/mixins/polling'; -import Ember from 'ember'; - -export default BasicView.extend(Polling, { - popup: Ember.inject.service(), - reposBinding: 'reposController', - repoBinding: 'controller.repo', - buildBinding: 'controller.build', - jobBinding: 'controller.job', - tabBinding: 'controller.tab', - pollModels: 'controller.repo', - classNameBindings: ['controller.isLoading:loading'], - - isEmpty: function() { - return this.get('repos.isLoaded') && this.get('repos.length') === 0; - }.property('repos.isLoaded', 'repos.length'), - - statusImageUrl: function() { - return statusImage(this.get('controller.repo.slug')); - }.property('controller.repo.slug'), - - actions: { - statusImages() { - var view; - this.get('popup').close(); - view = StatusImagesView.create({ - toolsView: this, - container: this.container - }); - BasicView.currentPopupView = view; - view.appendTo($('body')); - return false; - } - } -}); diff --git a/app/views/repos-list.js b/app/views/repos-list.js deleted file mode 100644 index 574515b5..00000000 --- a/app/views/repos-list.js +++ /dev/null @@ -1,39 +0,0 @@ -import Ember from 'ember'; -import { colorForState } from 'travis/utils/helpers'; -import Polling from 'travis/mixins/polling'; - -export default Ember.CollectionView.extend({ - elementId: '', - tagName: 'ul', - emptyView: Ember.View.extend({ - templateName: 'repos-list/empty' - }), - - itemViewClass: Ember.View.extend(Polling, { - pollModels: 'repo', - repoBinding: 'content', - classNames: ['repo'], - classNameBindings: ['color', 'selected'], - - selected: function() { - return this.get('content') === this.get('controller.selectedRepo'); - }.property('controller.selectedRepo'), - - color: function() { - return colorForState(this.get('repo.lastBuildState')); - }.property('repo.lastBuildState'), - - scrollTop() { - if (window.scrollY > 0) { - return $('html, body').animate({ - scrollTop: 0 - }, 200); - } - }, - - click() { - this.scrollTop(); - return this.get('controller').transitionToRoute('/' + this.get('repo.slug')); - } - }) -}); diff --git a/app/views/signin.js b/app/views/signin.js deleted file mode 100644 index c4f364a5..00000000 --- a/app/views/signin.js +++ /dev/null @@ -1,5 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - templateName: 'auth/signin' -}); diff --git a/app/views/status-images.js b/app/views/status-images.js deleted file mode 100644 index 98340987..00000000 --- a/app/views/status-images.js +++ /dev/null @@ -1,43 +0,0 @@ -import Ember from 'ember'; -import format from 'travis/utils/status-image-formats'; - -export default Ember.View.extend({ - templateName: 'status_images', - classNames: ['popup', 'status-images'], - classNameBindings: ['display'], - repoBinding: 'toolsView.repo', - buildBinding: 'toolsView.build', - jobBinding: 'toolsView.job', - branchesBinding: 'repo.branches', - formats: ['Image URL', 'Markdown', 'Textile', 'Rdoc', 'AsciiDoc', 'RST', 'Pod', 'CCTray'], - - didInsertElement() { - this._super(...arguments); - this.setStatusImageBranch(); - this.setStatusImageFormat(); - this.show(); - }, - - show() { - return this.set('display', true); - }, - - actions: { - close() { - return this.destroy(); - } - }, - - setStatusImageFormat: (function() { - this.set('statusImageFormat', this.formats[0]); - }), - - setStatusImageBranch: function() { - var branch = this.get('repo.branches').findProperty('commit.branch', this.get('build.commit.branch')); - this.set('statusImageBranch', branch); - }.observes('repo.branches', 'repo.branches.isLoaded', 'build.commit.branch'), - - statusString: function() { - return format(this.get('statusImageFormat'), this.get('repo.slug'), this.get('statusImageBranch.commit.branch')); - }.property('statusImageFormat', 'repo.slug', 'statusImageBranch.commit.branch') -}); diff --git a/app/views/team.js b/app/views/team.js deleted file mode 100644 index 3a0039ff..00000000 --- a/app/views/team.js +++ /dev/null @@ -1,6 +0,0 @@ -import BasicView from 'travis/views/basic'; - -export default BasicView.extend({ - classNames: ['landing-pro'], - layoutName: 'layouts/landing-page' -}); diff --git a/app/views/top.js b/app/views/top.js deleted file mode 100644 index c097864c..00000000 --- a/app/views/top.js +++ /dev/null @@ -1,36 +0,0 @@ -import BasicView from 'travis/views/basic'; -var View; - -View = BasicView.extend({ - tabBinding: 'controller.tab', - - classHome: function() { - return this.get('tab') === 'home' ? 'active' : null; - }.property('tab'), - - classStats: function() { - return this.get('tab') === 'stats' ? 'active' : null; - }.property('tab'), - - classProfile: function() { - var classes = ['profile menu']; - - if (this.get('tab') === 'profile') { - classes.push('active'); - } - - classes.push(this.get('controller.auth.state') || 'signed-out'); - - return classes.join(' '); - }.property('tab', 'controller.auth.state'), - - showProfile() { - $('#top .profile ul').show(); - }, - - hideProfile() { - $('#top .profile ul').hide(); - } -}); - -export default View; diff --git a/config/deprecation-workflow.js b/config/deprecation-workflow.js index 3757f4a7..2e570961 100644 --- a/config/deprecation-workflow.js +++ b/config/deprecation-workflow.js @@ -1,22 +1,26 @@ window.deprecationWorkflow = window.deprecationWorkflow || {}; window.deprecationWorkflow.config = { workflow: [ - { handler: "silence", matchMessage: "Ember.LinkView is deprecated. Please use Ember.LinkComponent." }, - { handler: "silence", matchMessage: "Calling store.find() with a query object is deprecated. Use store.query() instead." }, - { handler: "silence", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." }, - { handler: "silence", matchMessage: "Ember.arrayComputed is deprecated. Replace it with plain array methods" }, - { handler: "silence", matchMessage: "The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page" }, - { handler: "silence", matchMessage: "Usage of `state` is deprecated, use `_state` instead." }, - { handler: "silence", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." }, - { handler: "silence", matchMessage: "Ember.addBeforeObserver is deprecated and will be removed in the near future." }, - { handler: "silence", matchMessage: "`Ember.ArrayController` is deprecated." }, - { handler: "silence", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." }, - { handler: "silence", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." }, - { handler: "silence", matchMessage: "RestAdapter#find has been deprecated and renamed to `findRecord`." }, - { handler: "silence", matchMessage: "Using the same function as getter and setter is deprecated." }, - { handler: "silence", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." }, - { handler: "silence", matchMessage: "A property of was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation." }, - { handler: "silence", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." }, - { handler: "silence", matchMessage: "Usage of `typeKey` has been deprecated and will be removed in Ember Data 2.0. It has been replaced by `modelName` on the model class." } + // DONE + { handler: "log", matchMessage: "Ember.LinkView is deprecated. Please use Ember.LinkComponent." }, + { handler: "log", matchMessage: "Calling store.find() with a query object is deprecated. Use store.query() instead." }, + { handler: "log", matchMessage: new RegExp("A property of .*? was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation.") }, + { handler: "log", matchMessage: "Ember.arrayComputed is deprecated. Replace it with plain array methods" }, + // this will still emit deprecations, because we use state property in + // request-icon compoenent, that makes Ember.js think that we're using + // internal component's state + { handler: "log", matchMessage: "Usage of `state` is deprecated, use `_state` instead." }, + { handler: "log", matchMessage: "RestAdapter#find has been deprecated and renamed to `findRecord`." }, + { handler: "log", matchMessage: "Usage of `typeKey` has been deprecated and will be removed in Ember Data 2.0. It has been replaced by `modelName` on the model class." }, + { handler: "log", matchMessage: "Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead." }, + { handler: "log", matchMessage: "Using the same function as getter and setter is deprecated." }, + { handler: "log", matchMessage: "`Ember.ArrayController` is deprecated." }, + { handler: "log", matchMessage: "The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false." }, + { handler: "log", matchMessage: "Function#observesBefore is deprecated and will be removed in the near future." }, + { handler: "log", matchMessage: "Ember.addBeforeObserver is deprecated and will be removed in the near future." }, + { handler: "log", matchMessage: "Ember.removeBeforeObserver is deprecated and will be removed in the near future." }, + { handler: "log", matchMessage: "Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead." }, + { handler: "log", matchMessage: "The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page" }, + { handler: "log", matchMessage: "Ember.View is deprecated. Consult the Deprecations Guide for a migration strategy." }, ] }; diff --git a/package.json b/package.json index ad4ffb6f..aacf826c 100644 --- a/package.json +++ b/package.json @@ -39,8 +39,10 @@ "ember-cli-sauce": "^1.1.0", "ember-cli-uglify": "1.2.0", "ember-data": "1.13.15", + "ember-data-filter": "1.13.0", "ember-disable-proxy-controllers": "^1.0.1", "ember-export-application-global": "^1.0.4", - "ember-try": "0.0.7" + "ember-try": "0.0.7", + "emberx-select": "2.0.2" } } diff --git a/tests/.jshintrc b/tests/.jshintrc index fc1b8922..51c88317 100644 --- a/tests/.jshintrc +++ b/tests/.jshintrc @@ -33,6 +33,7 @@ "exists", "fillIn", "click", + "select", "keyEvent", "triggerEvent", "find", diff --git a/tests/test-helper.js b/tests/test-helper.js index e6cfb70f..35461bf4 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -1,4 +1,6 @@ import resolver from './helpers/resolver'; +import registerSelectHelper from './helpers/register-select-helper'; +registerSelectHelper(); import { setResolver } from 'ember-qunit';