Rename fa_icon to font_awesome_icon because of conflict other plugins

This commit is contained in:
Alexander Meindl 2017-10-12 15:06:38 +02:00
parent 702520eeb9
commit a16971774d
5 changed files with 18 additions and 13 deletions

View File

@ -5,7 +5,7 @@ Changelog
+++++
- Redmine 3.4 bug fixes
- Helper function fa_icon renamed to font_awesome_icon because of conflicts with redmine_bootstrap_kit
2.0.4
+++++

View File

@ -124,9 +124,9 @@ module Additionals
html_options[:title] = item[:title] if item[:title].present?
title = if item[:symbol].present? && item[:name].present?
fa_icon(item[:symbol], post_text: item[:name])
font_awesome_icon(item[:symbol], post_text: item[:name])
elsif item[:symbol].present?
fa_icon(item[:symbol])
font_awesome_icon(item[:symbol])
else
item[:name].to_s
end
@ -264,7 +264,12 @@ module Additionals
safe_join(s)
end
# obsolete, because it conflicts with redmine_bootstrap_kit
def fa_icon(name, options = {})
font_awesome_icon(name, options)
end
def font_awesome_icon(name, options = {})
post_text = ''
classes = ['fa']
classes << name

View File

@ -12,18 +12,18 @@ module Additionals
case name[0..1]
when 'r/'
link_to(fa_icon('fa-reddit', post_text: name),
link_to(font_awesome_icon('fa-reddit', post_text: name),
"https://www.reddit.com/#{name}",
class: 'external reddit',
title: l(:label_reddit_subject))
when 'u/'
link_to(fa_icon('fa-reddit-square', post_text: name),
link_to(font_awesome_icon('fa-reddit-square', post_text: name),
"https://www.reddit.com/username/#{name[2..-1]}",
class: 'external reddit',
title: l(:label_reddit_user_account))
else
name = 'r/' + name
link_to(fa_icon('fa-reddit', post_text: name),
link_to(font_awesome_icon('fa-reddit', post_text: name),
"https://www.reddit.com/#{name}",
class: 'external reddit',
title: l(:label_reddit_subject))

View File

@ -11,17 +11,17 @@ module Additionals
name = args[0].strip
case name[0]
when '@'
link_to(fa_icon('fa-twitter', post_text: name),
link_to(font_awesome_icon('fa-twitter', post_text: name),
"https://twitter.com/#{name[1..-1]}",
class: 'external twitter',
title: l(:label_twitter_account))
when '#'
link_to(fa_icon('fa-twitter-square', post_text: name),
link_to(font_awesome_icon('fa-twitter-square', post_text: name),
"https://twitter.com/hashtag/#{name[1..-1]}",
class: 'external twitter',
title: l(:label_twitter_hashtag))
else
link_to(fa_icon('fa-twitter', post_text: " @#{name}"),
link_to(font_awesome_icon('fa-twitter', post_text: " @#{name}"),
"https://twitter.com/#{name}",
class: 'external twitter',
title: l(:label_twitter_account))

View File

@ -41,14 +41,14 @@ class GlobalHelperTest < ActionView::TestCase
assert_include 'Redmine Admin', html
end
def test_fa_icon
html = fa_icon('fa-car', class: 'test')
def test_font_awesome_icon
html = font_awesome_icon('fa-car', class: 'test')
assert_include 'class="fa fa-car test"', html
html = fa_icon('fa-car', pre_text: 'Testing')
html = font_awesome_icon('fa-car', pre_text: 'Testing')
assert_include 'Testing <span', html
html = fa_icon('fa-car', post_text: 'Testing')
html = font_awesome_icon('fa-car', post_text: 'Testing')
assert_include '</span> Testing', html
end
end