ui: add delete key functionality

This commit is contained in:
Jack Pearkes 2014-04-30 10:16:50 -04:00
parent be2675815f
commit b650892899
4 changed files with 27 additions and 6 deletions

View File

@ -111,9 +111,7 @@
{{ textarea value=newKey.value class="form-control"}}
</div>
<div class="form-group">
<button {{ action "createKey"}} {{bind-attr disabled=newKey.isInvalid }} {{ bind-attr class=":btn newKey.isValid:btn-success:btn-default" }}>Create</button>
</div>
<button {{ action "createKey"}} {{bind-attr disabled=newKey.isInvalid }} {{ bind-attr class=":btn newKey.isValid:btn-success:btn-default" }}>Create</button>
</form>
</div>
</div>
@ -159,9 +157,8 @@
<div class="form-group">
{{ textarea value=model.value class="form-control"}}
</div>
<div class="form-group">
<button {{ action "updateKey"}} {{bind-attr disabled=isLoading }} {{ bind-attr class=":btn isLoading:btn-warning:btn-success" }}>Update</button>
</div>
<button {{ action "updateKey"}} {{bind-attr disabled=isLoading }} {{ bind-attr class=":btn isLoading:btn-warning:btn-success" }}>Update</button>
<button {{ action "deleteKey"}} {{bind-attr disabled=isLoading }} {{ bind-attr class=":btn :pull-right isLoading:btn-warning:btn-danger" }}>Delete</button>
</form>
</div>
</div>

View File

@ -114,6 +114,16 @@ App.KvEditController = Ember.Controller.extend({
this.set('isLoading', false)
}, 500);
},
deleteKey: function() {
var key = this.get("model");
this.set('isLoading', true);
Ember.run.later(this, function() {
this.set('isLoading', false)
}, 500);
}
}

View File

@ -222,6 +222,7 @@ Socket connect timed out
<a href="#" class="btn btn-primary">Primary button</a>
<a href="#" class="btn btn-success">Success button</a>
<a href="#" class="btn btn-warning">Warning button</a>
<a href="#" class="btn btn-danger">Danger button</a>
</div>
</div>

View File

@ -55,4 +55,17 @@
}
&.btn-danger {
color: $red;
background-color: transparent;
border: 2px solid $red;
&:hover {
background-color: lighten($red, 38%);
color: darken($red, 10%);
}
}
}