Skip to content

Instantly share code, notes, and snippets.

@danveloper
Created July 26, 2013 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danveloper/6089781 to your computer and use it in GitHub Desktop.
Save danveloper/6089781 to your computer and use it in GitHub Desktop.
Grails Countdown Timer TagLib
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>
"""
}
}
<!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>
@pledbrook
Copy link

You know tags are supposed to verify their args, right? ;) Seriously though, thanks for this. Will add to talk submission app when I get the chance (AKA when I feel like it).

@pledbrook
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment