Skip to content

Commit

Permalink
Use font-awesome-rails to handle icons
Browse files Browse the repository at this point in the history
  • Loading branch information
olejrosendahl committed Oct 13, 2015
1 parent b982359 commit 6d1a19b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

# Changelog

## [0.2.0] 2015-10-13
### Fixes
- Use `font-awesome-rails` to handle icons.

## [0.1.2] 2015-10-02
### Changed
- Depend on rails instead of railties.
Expand Down
5 changes: 4 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
PATH
remote: .
specs:
tabs_for (0.1.2)
tabs_for (0.2.0)
font-awesome-rails (~> 4.0)
rails (>= 3.2, < 5.0)

GEM
Expand Down Expand Up @@ -54,6 +55,8 @@ GEM
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
erubis (2.7.0)
font-awesome-rails (4.4.0.0)
railties (>= 3.2, < 5.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
http-cookie (1.0.2)
Expand Down
3 changes: 2 additions & 1 deletion app/helpers/tabs_for/rails/tabs_for_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def identifier(attribute)
end

class TabBuilder < ViewBuilder
include FontAwesome::Rails::IconHelper

def tab(attribute, options = {})
content = if options[:label]
Expand Down Expand Up @@ -73,7 +74,7 @@ def human_name(attribute_name)
end

def wrap_with_icon(content, options = {})
content_tag(:i, " ".html_safe + content, :class => options[:icon])
fa_icon(options[:icon], text: content)
end

end
Expand Down
1 change: 1 addition & 0 deletions lib/tabs_for.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
require "tabs_for/version"
require "tabs_for/engine"
require "font-awesome-rails"
2 changes: 1 addition & 1 deletion lib/tabs_for/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module TabsFor
VERSION = "0.1.2"
VERSION = "0.2.0"
end
1 change: 1 addition & 0 deletions tabs_for.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 1.9.3'

spec.add_dependency "rails", ">= 3.2", "< 5.0"
spec.add_dependency "font-awesome-rails", "~> 4.0"

spec.add_development_dependency "coveralls"
spec.add_development_dependency "sqlite3"
Expand Down
2 changes: 1 addition & 1 deletion test/tabs_for_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def assert_pane(id, text)
end

test "#tab given the icon option renders the given icon" do
with_concat_tabs_for(object) { |b| b.tab(:name, icon: "fa fa-building") {} }
with_concat_tabs_for(object) { |b| b.tab(:name, icon: "building") {} }
assert_select "i[class=\"fa fa-building\"]"
end

Expand Down

0 comments on commit 6d1a19b

Please sign in to comment.