Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customizable behaviour for activity rendering in the view #148

Merged
merged 3 commits into from
May 21, 2014

Conversation

shorrockin
Copy link

I have a project where I dynamically instrument the models for an extremely large project in order to generate activity on all models - which are then surfaced in an admin interface to provide an audit log of sorts.

For this reason it's a little bit of a headache to proactively define the views for every action. These two commits add two features that make this a bit easier for my use-case.

  1. The first commit allows it to fallback to text rendering when the fallback => :test is specified. This was the described behaviour in the docs so I assume it's what you wanted - however - I added the :fallback parameter since a few tests rely on the ActionView:MissingTemplate.
  2. The second commit allows for a default view to specified, again for situations where one is missing. When :fallback is used here, a string can be passed in which indicates the default partial to fallback to when one isn't there.

Not sure if either of these are enough value to pull them into the official version - but they're super useful to me, so I thought I'd throw them your way. tests, and README changes included. Cheers.

… partial is missing. this is in line with the docs that read 'If a view file does not exist, then p_a falls back to the old behaviour and tries to translate the activity :key using I18n#translate method (see the section below)'. However - instead of doing it by default it only exibits this behaviour when :fallback => :text is provided. This way the other tests that rely on ActionView::MissingTemplate be raised still pass. README updated to match new implementation.
…nstead of raising an exception. README updated.
@pokonski
Copy link
Member

Hi Chris,

this sounds like a very good feature to have!

The updated Readme is especially appreciated :)

Could you also document it in YARD above the method?

…arameter. Closed some dangling open brackets in the README.
@shorrockin
Copy link
Author

Cool. I've updated the YARD docs in: shorrockin@2e2f4eb

@pokonski
Copy link
Member

Much obliged 👍

pokonski added a commit that referenced this pull request May 21, 2014
customizable behaviour for activity rendering in the view
@pokonski pokonski merged commit 70aaa83 into public-activity:master May 21, 2014
pokonski added a commit that referenced this pull request May 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants