Browse Source

ui: handle empty kv index

pull/98/head
Jack Pearkes 11 years ago
parent
commit
375febc3b0
  1. 4
      ui/index.html
  2. 13
      ui/javascripts/app/routes.js

4
ui/index.html

@ -73,7 +73,7 @@
<script type="text/x-handlebars" data-template-name="kv/show">
<div class="row">
<h5><a class="subtle" href="" {{action 'linkToKey' topModel.grandParentKey }}>{{topModel.parentKey}}</a></h5>
<h5><a class="subtle" href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a></h5>
</div>
<div class="row">
@ -117,7 +117,7 @@
<div {{ bind-attr class=":form-group newKey.keyValid:valid" }}>
<div class="input-group">
<span class="input-group-addon">{{topModel.parentKey}}</span>
<span class="input-group-addon">{{parentKey}}</span>
{{ input value=newKey.Key class="form-control" required=true }}
</div>
</div>

13
ui/javascripts/app/routes.js

@ -93,8 +93,19 @@ App.KvShowRoute = App.BaseRoute.extend({
},
setupController: function(controller, model) {
// If we don't have any k/v, we need to set some basic
// stuff so we can create them
if (model.length == 0) {
var parentKey = "/";
var grandParentKey = "/";
} else {
var parentKey = model[0].parentKey;
var grandParentKey = model[0].grandParentKey;
}
controller.set('content', model);
controller.set('topModel', model[0]);
controller.set('parentKey', parentKey);
controller.set('grandParentKey', grandParentKey);
controller.set('newKey', App.Key.create());
}
});

Loading…
Cancel
Save