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 14a84f4a4f
commit ea8761a50e
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"> <script type="text/x-handlebars" data-template-name="kv/show">
<div class="row"> <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 class="row"> <div class="row">
@ -169,7 +169,7 @@
<div class="row"> <div class="row">
<div class="col-md-5"> <div class="col-md-5">
<div class="row"> <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> </div>
</div> </div>

View File

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