i've been trying add icons save, delete, etc. buttons. have 5 buttons using <g:actionsubmit>
tag call action in controller perform corresponding functions. problem fontawesome , bootstrap's glyphicons require <i class="icon-***">
tag used so:
<a href="http://google.com"> <i class="icon-ok"></i> google </a>
in grails format of tag in between initial tag not possible (at least actionsubmit
). value attribute string displayed. there work around this? keep in mind still need map buttons action controller why i've had issue using straight <button>
tag recommended bootstrap.
update:
i'm having lot of problems using current 2 answers. both work adding icons, i'm getting nuisances i'm having hack lot of things fix. thought solution having problems implementing it. i'd write own tag lib using base of taglib actionsubmit tag lib below:
def actionsubmit = {attrs -> attrs.tagname = "actionsubmit" if (!attrs.value) { throwtagerror("tag [$attrs.tagname] missing required attribute [value]") } // add action , value def value = attrs.remove('value') def action = attrs.action ? attrs.remove('action') : value out << "<input type=\"submit\" name=\"_action_${action}\" value=\"${value}\" " // process remaining attributes outputattributes(attrs) // close tag out << '/>' }
the change need make give ability take the
<i class="icon-ok"></i>
tag in between a:
<g:actionsubmit ...> </g:actionsubmit>
does have suggestions or implementation?
try passing class name remotelink, creates link uses ajax call remote function , can add fontawesome classes it.
<g:remotelink class="btn icon-ok" action="index" > click (without tag) </g:remotelink>
or
<g:remotelink action="index" > <i class="btn icon-ok">click (with tag) </i> </g:remotelink>
both approaches should work.
Comments
Post a Comment