ui: add a create key shortcut into breadcrumbs

this fixes #100
This commit is contained in:
Jack Pearkes 2014-05-16 13:38:45 -07:00
parent 246ad6c681
commit 9832cce4c5
2 changed files with 6 additions and 3 deletions

View File

@ -92,7 +92,7 @@
<script type="text/x-handlebars" data-template-name="kv/show">
<div class="row">
<h4 class="breadcrumbs"><a href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a></h4>
<h4 class="breadcrumbs"><a href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a> <a href="" {{action 'linkToKey' parentKey }}>+</a></h4>
</div>
<div class="row">
@ -169,7 +169,7 @@
<div class="row">
<div class="col-md-5">
<div class="row">
<h4 class="breadcrumbs"><a href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a></h4>
<h4 class="breadcrumbs"><a href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a> <a href="" {{action 'linkToKey' parentKey }}>+</a></h4>
</div>
</div>
</div>

View File

@ -42,7 +42,10 @@ App.BaseRoute = Ember.Route.extend({
// Used to link to keys that are not objects,
// like parents and grandParents
linkToKey: function(key) {
if (key.slice(-1) === '/' || key === this.rootKey) {
if (key == "/") {
this.transitionTo('kv.show', "")
}
else if (key.slice(-1) === '/' || key === this.rootKey) {
this.transitionTo('kv.show', key)
} else {
this.transitionTo('kv.edit', key)