samvera-deprecated / curation_concerns

A Hydra-based Rails Engine that extends an application, adding the ability to Create, Read, Update and Destroy (CRUD) objects (based on Hydra::Works) and providing a generator for defining object types with custom workflows, views, access controls, etc.
Other
15 stars 27 forks source link

WorkShowPresenter should handle representations #645

Open awead opened 8 years ago

awead commented 8 years ago

The WorkShowPresenter knows what the representation_id is, so we could have it return a representation as well, ex.

def resentation
  return unless representation_id
  ::FileSet.load_instance_from_solr(representation_id)
end
jcoyne commented 8 years ago

@awead is this to enable the logic on this view to move into the presenter? https://github.com/projecthydra-labs/curation_concerns/blob/c50eb158422eab073babceef3dfa0fd1f6052ab5/app/views/curation_concerns/base/_representative_media.html.erb#L1

awead commented 8 years ago

Yes. By coincidence, we recently discussed this same idea at Penn State and came up with our own guidelines: https://github.com/psu-stewardship/etda/wiki/Model-View-Controller-Presenter These include the idea that views should not have logic. If you let the presenter deal with the representative, you could refactor media_display so _representative_media.html.erb can be removed and replaced it with <%= media_display(presenter) %>.