Created
July 26, 2013 15:27
-
-
Save danveloper/6089781 to your computer and use it in GitHub Desktop.
Grails Countdown Timer TagLib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CountdownTagLib { | |
static namespace = "ct" | |
def down = { args -> | |
out << """ | |
<span id='conf-countdown'></span> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-countdown/1.6.1/jquery.countdown.min.js"></script> | |
<script> | |
(function() { | |
\$("#conf-countdown").countdown({ until: new Date($args.year, ${Integer.parseInt(args.month)-1}, $args.day) }); | |
})(); | |
</script> | |
""" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<ct:down month="12" year="2013" day="25" /> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made a few changes to integrate with Resources: https://github.com/pledbrook/talk-submissions/blob/master/grails-app/taglib/cacoethes/UtilTagLib.groovy#L5