{"action":"opened","issue":{"url":"https://api.github.com/repos/sul-dlss/argo/issues/536","repository_url":"https://api.github.com/repos/sul-dlss/argo","labels_url":"https://api.github.com/repos/sul-dlss/argo/issues/536/labels{/name}","comments_url":"https://api.github.com/repos/sul-dlss/argo/issues/536/comments","events_url":"https://api.github.com/repos/sul-dlss/argo/issues/536/events","html_url":"https://github.com/sul-dlss/argo/issues/536","id":134434194,"number":536,"title":"refactor the Contents view","user":{"login":"drh-stanford","id":1861171,"avatar_url":"https://avatars.githubusercontent.com/u/1861171?v=3","gravatar_id":"","url":"https://api.github.com/users/drh-stanford","html_url":"https://github.com/drh-stanford","followers_url":"https://api.github.com/users/drh-stanford/followers","following_url":"https://api.github.com/users/drh-stanford/following{/other_user}","gists_url":"https://api.github.com/users/drh-stanford/gists{/gist_id}","starred_url":"https://api.github.com/users/drh-stanford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drh-stanford/subscriptions","organizations_url":"https://api.github.com/users/drh-stanford/orgs","repos_url":"https://api.github.com/users/drh-stanford/repos","events_url":"https://api.github.com/users/drh-stanford/events{/privacy}","received_events_url":"https://api.github.com/users/drh-stanford/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sul-dlss/argo/labels/Technical%20Debt","name":"Technical Debt","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-17T23:34:17Z","updated_at":"2016-02-17T23:34:17Z","closed_at":null,"body":"The `default_contents.html.erb` needs refactoring. It's not DRY and has some anti-patterns for MVC.\r\n\r\nSome comments on how we might revise the view:\r\n\r\n- We really shouldn't be assigning variables in the view like this. This is an actual use case for moving logic to a helper.\r\n\r\n- There is a big opportunity to break this out into multiple partials. I could see something like _default_contents_resource.html.erb and _default_contents_file.html.erb. Each of those individual partials could be passed the locals it needs to render properly.\r\n\r\n- ContentMetadata resources could be broken out into their own classes. This would be useful for testing purposes and maintainability. sul-embed does something similar here with its Resources and ResourceFile classes generating objects based off of purlxml: https://github.com/sul-dlss/sul-embed/blob/master/app/models/embed/purl.rb#L138-L204\r\n"}}