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

Change icon helper input params #49

Merged
merged 1 commit into from
Mar 13, 2015
Merged

Conversation

jokklan
Copy link
Contributor

@jokklan jokklan commented Sep 11, 2014

I often want to add html options like a class to my icons, but it's not very often i want to have text. That means that i end up writing nil all the time (fx. <%= icon :user, nil, class: "color-blue" %>).

This pull request should fix that problem, and still be backwards compatible :)

Before:

<%= icon :spinner, nil, class: "fa-spin" %>
#=> <i class="fa fa-spinner fa-spin"></i>

<%= icon :spinner, class: "fa-spin" %>
#=> <i class="fa fa-spinner">{ class: "fa-spin"}</i>

<%= icon :spinner, "Loading", class: "fa-spin" %>
#=> <i class="fa fa-spinner fa-spin">Loading</i>

After

<%= icon :spinner, nil, class: "fa-spin" %>
#=> <i class="fa fa-spinner fa-spin"></i>

<%= icon :spinner, class: "fa-spin" %>
#=> <i class="fa fa-spinner fa-spin"></i>

<%= icon :spinner, "Loading", class: "fa-spin" %>
#=> <i class="fa fa-spinner fa-spin">Loading</i>

Before:
```ruby
<%= icon :spinner, nil, class: "fa-spin" %>
#=> <i class="fa fa-spinner fa-spin"></i>

<%= icon :spinner, "Loading", class: "fa-spin" %>
#=> <i class="fa fa-spinner fa-spin">Loading</i>
```
After
```ruby
<%= icon :spinner, class: "fa-spin" %>
#=> <i class="fa fa-spinner fa-spin"></i>

<%= icon :spinner, "Loading", class: "fa-spin" %>
#=> <i class="fa fa-spinner fa-spin">Loading</i>
```
@jokklan
Copy link
Contributor Author

jokklan commented Oct 30, 2014

no :D?

@prdolmos
Copy link
Contributor

prdolmos commented Dec 4, 2014

I agree with this; it makes it much more readable, and I see no downside given the backwards compatibility.

@prdolmos
Copy link
Contributor

prdolmos commented Dec 5, 2014

I just noticed this is similar to #33

@raldred
Copy link

raldred commented Jan 14, 2015

+1 for consolidating these arguments. It should behave like content_tag.
I don't think there's a single instance where I use anything other than an empty string.

@supercodepoet can we get this merged please.

supercodepoet added a commit that referenced this pull request Mar 13, 2015
Change icon helper input params
@supercodepoet supercodepoet merged commit 6443a93 into FortAwesome:master Mar 13, 2015
@jokklan
Copy link
Contributor Author

jokklan commented Mar 19, 2015

Sorry you are right @trinibago, fixed here: #89, or you can revert and merge #33 which is basically the same.

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.

6 participants