문제

I am trying to edit the output on the world-flags gem, in the documentation it says the following:

You can customize the output by the flag view helper methods:

WorldFlags.flag_list_tag = :div
WorldFlags.flag_tag = :span
WorldFlags.flag_text = ''

I have tried many things but can't seem to get it to work, where abouts should i place these methods to customise output? Thanks!

도움이 되었습니까?

해결책 2

I was not able to edit the output of the world flags gem by using the view helper methods in the question. However I was able to remove the bullets from the ul tags by using the following CSS:

ul {
    list-style-type: none;
}

The ul and li tags still remain, and I don't think there is currently a way to remove them using the world-flags gem unless you edit the gem yourself.

Hopefully this feature is added to future versions of the gem.

다른 팁

Have you tried to create a file in config/initializers directory (for example, "world_flags_config.rb") and put this code to that file? Make sure to reload your server after doing this.

Another approach is to use a div instead of a span.

In config/initializers/world_flags_config.rb set the following:

WorldFlags.flag_list_tag = :div
WorldFlags.flag_tag = :div
WorldFlags.flag_text = ''

And in your views you could do this:

<div class="f32"><%= flag(:ar, "Argentina") %></div>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top