Be able to render a single flag not as a list item #8

Open
gmarziou opened this Issue Jul 25, 2012 · 6 comments

Comments

Projects
None yet
3 participants

Hi,

It would be great to be able to render a single flag without ul/li tags but I suppose this is not your target use case.
So maybe it should be clarified in the README.

Thanks

Owner

kristianmandrup commented Jul 25, 2012

Just form and patch it in order to fulfill your specific needs. Should be easy... would be nice to set the wrapper tag as a global or individual option, or to disable it entirely...

Owner

kristianmandrup commented Jul 26, 2012

I just updated the REDME to reflect the API better, updated stylesheets for better styling options and improved customization options (also described briefly in README). Please play around with it... The specs still need an update to reflect the latest changes.

How exactly can I use the following on the read me (I am trying to remove the list tag)

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

Thanks!

Owner

kristianmandrup commented Jul 11, 2013

The rendering of the flags are based on CSS sprites, CSS classes. Simply add a new css file which lets you add a flag without being contained in a wrapper.

.f16 .flag {
    background:url(<%= asset_path 'flags/flags16.png' %>) no-repeat;
}

.f16 .ad{background-position:0 -336px;}

Should be changed to something like:

.f16.flag {
    background:url(<%= asset_path 'flags/flags16.png' %>) no-repeat;
}

f16.flag.ad{background-position:0 -336px;}

Use it like: <span class="f16 flag ad"></span>

Hope this helps you move forward. Please feel free to experiment and make a pull request with README updates and feature improvements for this. Thanks!

Thanks very much for the prompt response, I'm not exactly sure what you mean. Can you possibly elaborate?

I added the second code to a CSS file in my app, nothing changed.

My view is set up like this:

= flag_list 32 do
  = flag "#{@user.location.downcase}", :country => :us

How can I change it to remove the li and ul tags?

thanks again and I would love to make some pull requests for the app, I will make some ASAP with some ideas I have

Owner

kristianmandrup commented Jul 11, 2013

Ah, for my example the current view helper methods most likely won't work. So you have to experiment the "old school" way, using pure CSS and HTML. In fact, I would clone my repo, then experiment with a static HTML file using a CSS file which references the flag sprite map correctly. Then migrate what works into the gem and improve the view helpers to support this scenario. Thanks.

@jspanjers jspanjers added a commit to world-flags/world-flags that referenced this issue Apr 25, 2015

@jspanjers jspanjers Allow rendering single flags 1ef0f97

@jspanjers jspanjers added a commit to world-flags/world-flags that referenced this issue Apr 26, 2015

@jspanjers jspanjers Allow rendering single flags 28dc967

@jspanjers jspanjers added a commit to world-flags/world-flags that referenced this issue Apr 26, 2015

@jspanjers jspanjers Allow rendering single flags 600757c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment