From 6f0f9d8ea2fb66bd8590274ce00f6ef20f210596 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 7 Jul 2015 14:28:16 -0800 Subject: [PATCH] Edit species --- app/pods/species/show/controller.js | 14 ++++++++++++++ app/pods/species/show/template.hbs | 6 ++++++ 2 files changed, 20 insertions(+) create mode 100644 app/pods/species/show/controller.js diff --git a/app/pods/species/show/controller.js b/app/pods/species/show/controller.js new file mode 100644 index 0000000..d9625f4 --- /dev/null +++ b/app/pods/species/show/controller.js @@ -0,0 +1,14 @@ +import Ember from 'ember'; + +export default Ember.Controller.extend({ + userCanEdit: function() { + let meta = this.store.metadataFor('species'); + let id = this.get('model.id'); + + if (meta.canEdit.indexOf( +id ) === -1) { + return false + } + return true; + }.property('model.isLoaded').readOnly(), + +}); diff --git a/app/pods/species/show/template.hbs b/app/pods/species/show/template.hbs index 11b72ba..e892234 100644 --- a/app/pods/species/show/template.hbs +++ b/app/pods/species/show/template.hbs @@ -55,3 +55,9 @@ +{{#if userCanEdit}} +
+ {{#link-to 'species.edit' model class="button-gray smaller"}} + Edit + {{/link-to}} +{{/if}}