-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
… meta tags
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,21 @@ def error!(errors, status = :unprocessable_entity) | |
respond_with_json({ errors: errors }, status: status) | ||
end | ||
|
||
# Override this method using a decorator to customize what meta tags are | ||
# injected into index.html. Most uses cases will probably want to copy | ||
# these default values into their method and add to them rather than | ||
# just replace them. | ||
def feb_meta(app) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ngottlieb
Author
Owner
|
||
{ | ||
csrf_param: request_forgery_protection_token, | ||
csrf_token: form_authenticity_token, | ||
front_end_build_version: app.id, | ||
front_end_build_params: use_params(:build_search_params).to_query, | ||
front_end_build_url: front_end_builds_best_path( | ||
use_params(:build_search_params).merge(format: :json) | ||
) | ||
} | ||
end | ||
|
||
end | ||
end |
2 comments
on commit 1396ab6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this. Looks good!
Do you mind adding a section to the README.md about how a developer can add their own meta tags?
Also, I assume you'll monkey patch feb_meta
to get custom meta. That's fine for version 1, any thoughts on the next evolution of the API?
Thanks so much for adding this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NP -- and, will do. Yeah, the way I'm using this now is to use a decorator to override feb_meta. I think it would be pretty cool to incorporate custom meta attributes into the models and UI, personally, but I could see arguments against that, too. We have relatively non-technical people using the admin interface and allowing people to change configuration variables without changing any code would be sweet.
It's a slightly different feature, but I also like the ideas mentioned in tedconf#33 for exposing a low-level hook that allows you to take custom actions on the entire HTML before it's presented. I'd like to see this handled in a way that doesn't require monkey-patching with a decorator, but the only really nice way around that I've encountered is the way Devise handles it which involves a lot of extra overhead.
Should
feb_meta
be part of the builds_controller? Seems like only builds controller would use this.