Allows displaying information by Theme below text area in followup - #9290
Allows displaying information by Theme below text area in followup#9290robvandijk wants to merge 7 commits into
Conversation
|
BTW I have to add info at more locations. I will add these to this PR, once I've heard from you which solution you prefer (checking if partials supplied by themes exist, or splitting views into smaller partials to be overridden by themes). |
|
Our usual way of providing theme hooks is a blank partial (example), though I'm not adverse to adding hooks like this, as it avoids a blank template in core. If we went down this approach it would be nice to add a helper so we could do something like: <%= render_theme_partial 'request/name_of_partial' %>In this case though its not obvious what the proposed template is meant to do. Its name (" |
It was a quick example of the direction I was thinking of, and far from perfect. Thanks for the suggestions. I added helper I have also created a PR for the Woo-knop theme, see mysociety/wob-knop-theme#47. It depends on the |
garethrees
left a comment
There was a problem hiding this comment.
Thanks for the updates. I've made a couple of naming suggestions with a view to what would make it easier for longer term maintenance, and I think a couple of the render_theme_partial calls could be removed where the main partial is small enough to just override in its entirity.
After these updates I think this would be good to merge, so once you've made them just squash it all in to a single commit.
| <%= f.text_area :body, :rows => 20, :cols => 60 %> | ||
| </p> | ||
|
|
||
| <%= render_theme_partial 'request/below_request' %> |
There was a problem hiding this comment.
This should be prefixed alaveteli_pro/info_request_batches. I don't think we should assume that the contents of these will definitely be the same across e.g. request, pro request, batch request, etc.
I'd actually nest this under form, too, to make it super clear its part of the form (rather than e.g. a view/preview step.
Overall I'd make this alaveteli_pro/info_request_batches/form/below_request_body_field.
| </p> | ||
| <% end %> | ||
|
|
||
| <%= render_theme_partial 'request/below_request' %> |
There was a problem hiding this comment.
Similar to the comment above, I'd make this alaveteli_pro/info_requests/form/below_request_body_field.
| 'to it, will be displayed publicly on this website.') %> | ||
| </p> | ||
| <% end %> | ||
| <%= render_theme_partial 'followups/below_followup_message' %> |
There was a problem hiding this comment.
I'd call this followups/preview/below_followup_message
| </div> | ||
| <% end %> | ||
|
|
||
| <%= render_theme_partial 'request/below_request' %> |
There was a problem hiding this comment.
Would call this request/preview/below_request
| <p> | ||
| <%= o.text_area :body, rows: 15, cols: 55 %> | ||
| </p> | ||
| <%= render_theme_partial 'followups/below_followup_message' %> |
There was a problem hiding this comment.
Similar to the comment above, I'd make this followups/form/below_request_body_field.
In this case we haven't extracted the form to a partial, so the namespacing doesn't quite match reality, but I think we ought to extract the form (which can be done later) so might as well get this piece right now.
|
|
||
| <%= render partial: 'new_message_text_length' %> | ||
|
|
||
| <%= render_theme_partial 'request/below_request' %> |
There was a problem hiding this comment.
I'd call this request/form/below_request_body_field.
Thanks Gareth for the quick response. Will get back to this after my holidays. Will process the suggested naming changes. I'm wondering about removing some of the |
I think there's a tradeoff between maintenance of core vs maintenance of the theme here. I think we want to balance this – and I completely appreciate its not a good balance right now – but more I also want to be a bit judicious about where they're included, especially as its a new idea that may or may not work out in the long run. If taken way too far we could end up with them before, in the middle of and after nearly every template! Having come back and looked at this today, I think it does feel like even some of the ones I didn't initially suggest to be overrides take the idea a bit far – Happy to jump on a call to hash out some heuristics for when an override/include hook is most appropriate. |
|
Processed most of the proposed changes, except for the |
What does this do?
It allows a Theme to display information below the text area in
followupWhy was this needed?
We need to inform the user about the option to pass a telephone number for contact information
Implementation notes
We discussed this today by email. My initial thought was to extract a part of the view into a partial, and then to make adjustments to that smaller partial (smaller templates are better for maintenance purposes). Then I realized that here (and in other upcoming cases) I just want to add information, not to change any existing parts. Therefore I created this PR using a kind of plug-in mechanism for themes to be able to add info at certain (important) locations.
If you don't like this approach I can change this PR to the earlier discussed solution by extracting smaller partials (although that will require some more maintenance in the future).
Have you updated the changelog? If this is not necessary, put square brackets around this: [skip changelog]