add show_for_class option to config #42

Merged
merged 1 commit into from May 23, 2012

Conversation

Projects
None yet
2 participants
Collaborator

nashby commented May 23, 2012

closes #39

lib/show_for/helper.rb
@@ -13,7 +13,7 @@ def show_for(object, html_options={}, &block)
tag = html_options.delete(:show_for_tag) || ShowFor.show_for_tag
html_options[:id] ||= dom_id(object)
- html_options[:class] = "show_for #{dom_class(object)} #{html_options[:class]}".rstrip
+ html_options[:class] = "show_for #{dom_class(object)} #{html_options[:class]} #{ShowFor.show_for_class}".squeeze(" ")
@carlosantoniodasilva

carlosantoniodasilva May 23, 2012

Collaborator

If show_for_class is nil/blank, it'll leave an empty space at the end of :class, I think rstrip needs to stay.

@nashby

nashby May 23, 2012

Collaborator

Actually not at the end. There is ShowFor.show_for_class and the end. So it will be something like "show_for user[:space:][:space]show_for_class"

@nashby

nashby May 23, 2012

Collaborator

Ah, sorry. Do you mean to use squeeze and rstrip together?

@carlosantoniodasilva

carlosantoniodasilva May 23, 2012

Collaborator

Yes, both :)

@nashby

nashby May 23, 2012

Collaborator

I've updated PR and I've decided to extract it to the private method. Is it OK?

@carlosantoniodasilva

carlosantoniodasilva May 23, 2012

Collaborator

Ok, great, thanks.

carlosantoniodasilva added a commit that referenced this pull request May 23, 2012

Merge pull request #42 from nashby/issue-39
add show_for_class option to config

@carlosantoniodasilva carlosantoniodasilva merged commit 766d35f into plataformatec:master May 23, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment