Permalink
Browse files

Display the list of tasks using jQuery and CoffeeScript

  • Loading branch information...
1 parent d161ce6 commit ecf41cd03cc7ceadb3a2a423766585b5a4a174af @jamesward committed Apr 1, 2015
Showing with 10 additions and 1 deletion.
  1. +4 −0 app/assets/javascripts/index.coffee
  2. +2 −0 app/views/index.scala.html
  3. +2 −1 app/views/main.scala.html
  4. +2 −0 build.sbt
@@ -0,0 +1,4 @@
+$ ->
+ $.get "/tasks", (data) ->
+ $.each data, (index, task) ->
+ $("#tasks").append $("<li>").text task.contents
@@ -4,6 +4,8 @@
@message.toUpperCase
+ <ul id="tasks"></ul>
+
@helper.form(action = routes.Application.addTask()) {
<input name="contents"/>
<input type="submit"/>
@@ -7,7 +7,8 @@
<title>@title</title>
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
<link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
- <script src="@routes.Assets.at("javascripts/hello.js")" type="text/javascript"></script>
+ <script src="@routes.Assets.at("lib/jquery/jquery.min.js")" type="text/javascript"></script>
+ <script src="@routes.Assets.at("javascripts/index.js")" type="text/javascript"></script>
</head>
<body>
@content
View
@@ -12,3 +12,5 @@ libraryDependencies ++= Seq(
cache,
javaWs
)
+
+libraryDependencies += "org.webjars" % "jquery" % "1.11.2"

0 comments on commit ecf41cd

Please sign in to comment.