From 004d890a08db7042e03d953038a007ef7d65ad32 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Thu, 16 Jul 2015 15:46:39 +0200 Subject: [PATCH] add delete env-var functionality --- app/components/env-var.coffee | 21 +------------ app/templates/components/add-env-var.hbs | 39 +++--------------------- app/templates/components/env-var.hbs | 12 +++++--- 3 files changed, 14 insertions(+), 58 deletions(-) diff --git a/app/components/env-var.coffee b/app/components/env-var.coffee index 1dbe3435..61acca7e 100644 --- a/app/components/env-var.coffee +++ b/app/components/env-var.coffee @@ -5,7 +5,6 @@ EnvVarComponent = Ember.Component.extend classNames: ['settings-envvar'] classNameBindings: ['envVar.public:is-public'] - isEditing: false isDeleting: false validates: @@ -25,24 +24,6 @@ EnvVarComponent = Ember.Component.extend delete: -> return if @get('isDeleting') @set('isDeleting', true) - - @get('model').destroyRecord() - - edit: -> - @set('isEditing', true) - - cancel: -> - @set('isEditing', false) - @get('model').revert() - - save: -> - return if @get('isSaving') - - if @isValid() - env_var = @get('model') - - # TODO: handle errors - env_var.save().then => - @set('isEditing', false) + @get('envVar').destroyRecord() `export default EnvVarComponent` diff --git a/app/templates/components/add-env-var.hbs b/app/templates/components/add-env-var.hbs index a5c97428..9bae2cc6 100644 --- a/app/templates/components/add-env-var.hbs +++ b/app/templates/components/add-env-var.hbs @@ -12,39 +12,10 @@ {{travis-switch active=public}}
- + {{#if isSaving}} + {{loading-indicator}} + {{else}} + + {{/if}}
- -{{!-- - - -
- {{#travis-field "name"}} - - {{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 -
-
- - --}} \ No newline at end of file diff --git a/app/templates/components/env-var.hbs b/app/templates/components/env-var.hbs index 5a260f16..e9c86e34 100644 --- a/app/templates/components/env-var.hbs +++ b/app/templates/components/env-var.hbs @@ -5,9 +5,13 @@
- - - -
Delete
+ {{#if isDeleting}} + {{loading-indicator}} + {{else}} + + + +
Delete
+ {{/if}}