Search code examples
grailsgrails-plugingrails-2.0

How to use actionSubmitImage tag with asset pipeline plugin in grails


The documentation for actionSubmitImage tag uses resource plugin. How could it be changed to use asset-pipeline plugin.

For example:

<g:actionSubmitImage action="unassign" value="${message(code: 'default.button.unassign.label', default: 'Unassign')}" 
   onclick="return confirm('${message(code: 'default.button.unassign.confirm.message', default: 'Are you sure to unassign the schema?')}');" 
   title="Remove owner for the current schema" 
   src="${resource(dir: 'skin', file: 'user_delete.png')}" style="display:inline;"/>

How does the src attribute change?


Solution

  • The src tag src="${resource(dir: 'skin', file: 'user_delete.png')}" should be change to src="${assetPath(src: 'skin/delete.png')}". assetPath gives the path to the assets directory.

    <g:actionSubmitImage action="drop" value="${message(code: 'default.button.unassign.label', default: 'Drop')}" 
    onclick="return confirm('${message(code: 'default.button.drop.confirm.message', default: 'Are you sure to drop the schema?')}');" 
    title="Drop schema"
    src="${assetPath(src: 'skin/delete.png')}"/>