Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR attempts to solve #220.
Started looking at this and it will be tricky, but I like the concept. First I replaced all instance variables with helper methods, which I got working. Unfortunately our code is a bit hard to follow. The service object is modified during the request cycle by different parts of the code, so things need to happen in a particular order for things to work, which is why we set the instance variables in the order that we do. Not nice, we should try and fix that as well.
Then I tried replacing the helper methods with locals, which is what we want. That way, variables aren't automatically available to all views and partials, but have to be explicitly passed, which is nice. However, we have a problem with some of our view helpers, such as the translation and form helpers. They require access to
resource_class
andresource_parents
. We could pass them to the translation helper, but it's trickier with the form helper which mimics the Rails helper.Do we want to expose some things as helper methods, available everywhere and some things passed down as locals?