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}}