From 50e9986dda4bf812a8307e6fdac247ff0c1534eb Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 21 Aug 2014 16:39:15 +0200 Subject: [PATCH] Fixes after merging ps-env-vars --- assets/scripts/app/controllers.coffee | 2 +- .../{repo_settings.coffee => settings.coffee} | 15 +-------- assets/scripts/app/helpers/handlebars.coffee | 5 +++ .../scripts/app/templates/repo/settings.hbs | 33 ------------------- assets/styles/components/travis-switch.sass | 2 +- assets/styles/settings.sass | 6 +++- assets/styles/tabs.sass | 2 +- config.ru | 2 +- 8 files changed, 15 insertions(+), 52 deletions(-) rename assets/scripts/app/controllers/{repo_settings.coffee => settings.coffee} (67%) delete mode 100644 assets/scripts/app/templates/repo/settings.hbs diff --git a/assets/scripts/app/controllers.coffee b/assets/scripts/app/controllers.coffee index d44c02a0..a8c9be07 100644 --- a/assets/scripts/app/controllers.coffee +++ b/assets/scripts/app/controllers.coffee @@ -61,7 +61,7 @@ require 'controllers/job' require 'controllers/profile' require 'controllers/repos' require 'controllers/repo' -require 'controllers/repo_settings' +require 'controllers/settings' require 'controllers/stats' require 'controllers/current_user' require 'controllers/request' diff --git a/assets/scripts/app/controllers/repo_settings.coffee b/assets/scripts/app/controllers/settings.coffee similarity index 67% rename from assets/scripts/app/controllers/repo_settings.coffee rename to assets/scripts/app/controllers/settings.coffee index 3cf63526..e4e0e0bb 100644 --- a/assets/scripts/app/controllers/repo_settings.coffee +++ b/assets/scripts/app/controllers/settings.coffee @@ -1,17 +1,4 @@ -Travis.RepoSettingsController = Em.ObjectController.extend - tabs: - index: "General Settings" - env_vars: "Environment Variables" - ssh_key: "SSH Key" - - init: -> - @_super.apply this, arguments - - tabs = [] - @set('_tabs', tabs) - for own id, name of @get('tabs') - tabs.pushObject Travis.Tab.create(id: id, name: name) - +Travis.SettingsIndexController = Em.ObjectController.extend settings: Ember.computed.alias('model.settings') settingsChanged: (-> diff --git a/assets/scripts/app/helpers/handlebars.coffee b/assets/scripts/app/helpers/handlebars.coffee index c08285b2..bc555d96 100644 --- a/assets/scripts/app/helpers/handlebars.coffee +++ b/assets/scripts/app/helpers/handlebars.coffee @@ -103,9 +103,14 @@ Travis.ErrorsView = Ember.View.extend template: Ember.Handlebars.compile("{{#each view.errors}}{{message}}{{/each}}") classNames: ['error'] classNameBindings: ['codes'] + attributeBindings: ['style'] + style: (-> + 'display: none' unless @get('show') + ).property('show') codes: (-> @get('errors').mapBy('code') ).property('@errors') + show: Ember.computed.notEmpty('errors.[]') Ember.Handlebars.helper('travis-errors', (name, options) -> errors = @get('errors').for(name) diff --git a/assets/scripts/app/templates/repo/settings.hbs b/assets/scripts/app/templates/repo/settings.hbs deleted file mode 100644 index 005597a9..00000000 --- a/assets/scripts/app/templates/repo/settings.hbs +++ /dev/null @@ -1,33 +0,0 @@ -
-

Settings: {{#link-to "repo" this}}{{slug}}{{/link-to}}

- - {{#travis-tabs}} - {{#travis-tab "general" "General Settings"}} - {{#settings-form}} -

- Build only if .travis.yml is present - {{travis-switch action="save" active=settings.builds_only_with_travis_yml}} -

- -

- Build pushes - {{travis-switch action="save" active=settings.build_pushes}} -

- -

- Build pull requests - {{travis-switch action="save" active=settings.build_pull_requests}} -

- -

-

- {{input value=settings.maximum_number_of_builds size="4" pattern='/^[0-9]+$/'}} -

- -

- {{/settings-form}} - {{/travis-tab}} - {{/travis-tabs}} -
diff --git a/assets/styles/components/travis-switch.sass b/assets/styles/components/travis-switch.sass index eeda994f..c93ddc64 100644 --- a/assets/styles/components/travis-switch.sass +++ b/assets/styles/components/travis-switch.sass @@ -12,7 +12,7 @@ p.settings-row display: inline-block float: left width: 5em - height: 1.55em + height: 1.45em margin: 20px 0 50px 0 padding: 0.42em 1.5em background-color: #F5F5F5 diff --git a/assets/styles/settings.sass b/assets/styles/settings.sass index 727ffcc2..1ef4bc68 100644 --- a/assets/styles/settings.sass +++ b/assets/styles/settings.sass @@ -195,6 +195,10 @@ margin-top: 20px margin-bottom: 30px border-bottom: 1px solid #f1f1f1 + + span.error + margin-left: 0 + label.name, label.value display: none @@ -204,7 +208,7 @@ .field.name, .field.value float: left padding-bottom: 0 - height: 33px + min-height: 33px line-height: 33px span.equals diff --git a/assets/styles/tabs.sass b/assets/styles/tabs.sass index c118bab6..d62aac2e 100644 --- a/assets/styles/tabs.sass +++ b/assets/styles/tabs.sass @@ -89,7 +89,7 @@ #tab_build, #tab_job, #tab_request, - #tab_requests + #tab_requests, #tab_caches, #tab_settings display: none diff --git a/config.ru b/config.ru index b693786f..ab243006 100644 --- a/config.ru +++ b/config.ru @@ -32,6 +32,6 @@ run Travis::Web::App.build( ga_code: ENV['GA_CODE'], root: File.expand_path('../public', __FILE__), server_start: Time.now, - caches_enabled: ENV['CACHES_ENABLED'] + caches_enabled: ENV['CACHES_ENABLED'], ssh_key_enabled: ENV['SSH_KEY_ENABLED'] )