add delete env-var functionality

This commit is contained in:
Lisa Passing 2015-07-16 15:46:39 +02:00
parent 99f828ef65
commit 004d890a08
3 changed files with 14 additions and 58 deletions

View File

@ -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`

View File

@ -12,39 +12,10 @@
{{travis-switch active=public}}
</div>
<div class="form-elem">
<input type="submit" value="Add" class="form-submit {{if isSaving "saving"}}" disabled={{isSaving}} />
{{#if isSaving}}
{{loading-indicator}}
{{else}}
<input type="submit" value="Add" class="form-submit" />
{{/if}}
</div>
</form>
{{!--
<form class="env-var" {{action "save" on="submit"}}>
{{#travis-field "name"}}
{{input value=name class="env-name" placeholder="Name"}} {{travis-errors "name"}}
{{/travis-field}}
<span class="equals">=</span>
{{#if showValueField}}
<div class="field value value--extra">
{{#label for="value" class="value"}}Value:{{/label}}
{{input value=value class="env-value" placeholder="Value"}}
</div>
{{else}}
<div class="field name">
<span class="value value-display secure">{{value}}</span>
</div>
{{/if}}
<div class="field field--switch">
{{travis-switch active=public}}
{{#label for="secure" class="public"}}Display value in build logs{{/label}}
</div>
<div class="actions">
<input type="submit" {{bind-attr value=actionType class=":submit-env-var isSaving:saving" disabled=isSaving}} />
<span class="or">or</span>
<a href="#" class="cancel-env-var" {{action "cancel"}}>Cancel</a>
</div>
</form>
--}}

View File

@ -5,9 +5,13 @@
</div>
<div class="env-var-action">
<div class="tooltip">
<a href="#" title="">
<span class="icon-delete"></span>
</a>
<div class="tooltip-bubble">Delete</div>
{{#if isDeleting}}
{{loading-indicator}}
{{else}}
<a href="#" title="" {{action "delete" on="click"}}>
<span class="icon-delete"></span>
</a>
<div class="tooltip-bubble">Delete</div>
{{/if}}
</div>
</div>