-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Template whitelist for page tabs, so tabs only appears on pages with certain templates #1753
Conversation
adding tests, if this is the approach you want to use. |
@@ -17,6 +21,8 @@ def self.register(&block) | |||
|
|||
raise "A tab MUST have a name!: #{tab.inspect}" if tab.name.blank? | |||
raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank? | |||
tab.templates = ['all'] if tab.templates.blank? | |||
tab.templates = [tab.templates] unless tab.templates.is_a?(Array) |
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.
You can use this instead:
tab.templates = Array(tab.templates)
@ugisozols what do you think of this approach? |
Currently this won't work because How we configure which tabs to use for page? |
@@ -17,6 +21,8 @@ def self.register(&block) | |||
|
|||
raise "A tab MUST have a name!: #{tab.inspect}" if tab.name.blank? | |||
raise "A tab MUST have a partial!: #{tab.inspect}" if tab.partial.blank? | |||
tab.templates = ['all'] if tab.templates.blank? |
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.
I know it's nitpicky but I prefer this:
tab.templates = %w[all] if tab.templates.empty?
This is however just something i made quickly because, as i said, im not sure of the best approach. Template does however seems like an appropriate condition to determine the tabs to be used, or what do you think? |
That's strange... It passes locally, for me. |
if you look at the build you'll see only one build failed on jruby-18mode |
Seems like a good strategy - can you add tests please? |
Sure, but im currently on vacation. I will get to it as soon as i come home (about 2 weeks), if you can wait that long :) |
Hey, @jokklan — any plan to revisit this? |
I'd like to get this feature merged - anyone keen to tackle tests so that we don't break it in the future? |
Closing this in favour of #1943. |
#1735