Open jonashaag opened 9 years ago
Here's a guide to polyfills, including ones for SVG.
https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills
Yeah so i'm not sure how we're going to do that in a backward compatible way ... but we can't miss support for the new awesome admin theme for sure !!!! PR welcome ;)
How can we replace the icons currently? e.g. how can I change the HTML to be something like and let font-awesome take care of my icons?
@aidanlister CSS: https://github.com/yourlabs/jquery-autocomplete-light/blob/master/src/style.css#L132
But I see a PNG icon there, @jonashaag what GIF are you talking about exactly ?
Oh, I think you're talking about these:
./templates/autocomplete_light/widget.html: <img src="{% static 'admin/img/icon_addlink.gif' %}" width="10" height="10" alt="{% trans 'Add another' %}" />
./templates/autocomplete_light/model_template/choice.html: <img src="{% static 'admin/img/icon_changelink.gif' %}" />
@aidanlister for now you can override the template blocks. A collective solution would be welcome here
I'd simply include the new SVG icons in the distribution until support for anything pre 1.9 is dropped.
I battled the CSS for a while ... too hard.
.autocomplete-light-widget
max-width: 375px
.deck
.remove
position: relative
top: 2px
display: inline-block
font-family: 'Glyphicons Halflings'
font-style: normal
font-weight: 400
line-height: 100%
background-image: none !important
color: #999 !important
text-indent: 0 !important
height: auto !important
width: auto !important
&:before
content: "\e014"
&:hover
color: #333 !important
Stuck with the actual content that is added: ˣ
I can't work out how to show my icon but hide the text added.
@aidanlister Docs for this part are not awesome I recon but basically it's taking the .remove:last
element it finds in the widget element to create new ones.
So, you can change that in the remove_template block of widget.html.
Great thanks for the help. I copied autocomplete_light/widget.html
into my app and changed the block to:
{% block remove_template %}
<span style="display:none" class="remove">
<i class="fa fa-times-circle"></i>
</span>
{% endblock %}
And here's the CSS I needed:
.autocomplete-light-widget
max-width: 375px
.deck span[data-value] .remove
background-image: none
color: #999
text-indent: 0
&:hover
color: #333
It looks very pretty, is consistent with the rest of the site and saves an image load :)
Pretty cool, we might want that in ! Would you consider making a pull request with that ?
Then you'd need a dependency on font-awesome which I don't think makes sense for everyone ... do you still want a pull request?
Oh no, my bad, we can't depend on font-awesome directly.
I'm still unsure how we're going to support both 1.8 and 1.9 admin on this.
A hacky workaround for individuals in need of a fix right away: copy over icon_addlink.gif from the pre-1.9 installation to Lib\site-packages\django\contrib\admin\static\admin\img
.
Anyone wants to make a PR to just bundle it ?
I don't think we'll find a better way to support both 1.8 and 1.9 without bundling it.
Thanks !!
What do you mean with 'just bundle'? Would it make sense to actually move over to the SVG instead of the GIF (now Django is doing this as well)? Where does django-autocomplete-light get the info from where to load the GIF (to be changed to the SVG included with the future version of this package)?
Oh, it doesn't matter what it bundles (gifs or svgs) as long as it works on dj 18 and 19 imho
Using the images directly from django admin was a feature: respect the admin theme. But since this breaks a more important feature (remove selected choices ^^) then it doesn't matter anymore, particularely since dj19 was released as stable and no better way of supporting it was proposed by the community, let's lower our expectations and get it to work ^^
The GIF icons have been replaced by SVG ones in Django 1.9