Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes bug in taglib's markup builder by not using a markup builder.

  • Loading branch information...
commit 6257287a1e08045298228449619f6b27febc2c12 1 parent 43b052a
@hartsock hartsock authored
View
2  application.properties
@@ -1,5 +1,5 @@
#Grails Metadata file
-#Wed Mar 14 20:07:21 EDT 2012
+#Tue Mar 27 17:37:18 EDT 2012
app.grails.version=2.0.0
app.name=qrcode
app.version=0.2
View
54 grails-app/taglib/org/codehaus/groovy/grails/plugins/qrcode/QrcodeTagLib.groovy
@@ -25,10 +25,7 @@ class QrcodeTagLib {
def size = attrs.height?:attrs.width
String target = request.getRequestURL()
String src = createLink(controller:'qrcode',action:'url',params:[u:target,s:size])
- def mkp = new groovy.xml.MarkupBuilder(out)
- mkp {
- img(alt:url,src:src)
- }
+ out << """<img class="qrcode" alt="${url}" src="${src}"/>"""
}
/**
@@ -39,40 +36,37 @@ class QrcodeTagLib {
def size = attrs.height?:attrs.width
String text = attrs.text
String src = createLink(controller:'qrcode',action:'text',params:[text:text,s:size])
- def mkp = new groovy.xml.MarkupBuilder(out)
- mkp {
- img(alt:text,src:src)
- }
+ out << """<img class="qrcode" alt="${text}" src="${src}"/>"""
}
- /**
- * Example:
- * <qrcode:link />
- */
- def link = { attrs ->
- def label = attrs.label?:"qrlink"
- def size = attrs.height?:attrs.width
- String target = request.getRequestURL()
- String src = createLink(controller:'qrcode',action:'url',params:[u:target,s:size])
- out << '''<style>
-#qrcodebox span {
+ /**
+ * Example:
+ * <qrcode:link label="my text" />
+ */
+ def link = { attrs ->
+ def label = attrs.label?:"qrlink"
+ def size = attrs.height?:attrs.width
+ String target = request.getRequestURL()
+ String src = createLink(controller:'qrcode',action:'url',params:[u:target,s:size])
+ out << '''<style>
+div.qrcodebox span.qrcodespan {
display: none;
position: absolute;
}
-#qrcodebox a:hover span {
+div.qrcodebox a.qrcodeLink:hover span.qrcodespan {
display: block;
}
</style>
'''
- def mkp = new groovy.xml.MarkupBuilder(out)
- mkp {
- div('id':'qrcodebox') {
- a('class':'qrcodeLink',href:"javascript:null",label) {
- span('id':'qrcode') {
- img(alt:url,src:src)
- }
- }
- }
+ out << """
+ <div class="qrcodebox">
+ <a class="qrcodeLink" href="javascript:null">${label}
+ <span class="qrcodespan">
+ <img class="qrcode" alt="${target}" src="${src}"/>
+ </span>
+ </a>
+ </div>
+"""
}
- }
+
}
View
4 plugin.xml
@@ -1,10 +1,10 @@
-<plugin name='qrcode' version='0.2' grailsVersion='1.2.1 &gt; *'>
+<plugin name='qrcode' version='0.3' grailsVersion='2.0.0 &gt; *'>
<author>Shawn Hartsock</author>
<authorEmail>hartsock@acm.org</authorEmail>
<title>QR Code plugin</title>
<description>\
This plugin allows you to create QR codes as part of your Grails
-application.</description>
+application without the need for an external service.</description>
<documentation>http://grails.org/plugin/qrcode</documentation>
<type>QrcodeGrailsPlugin</type>
<resources>
Please sign in to comment.
Something went wrong with that request. Please try again.