Skip to content

Commit

Permalink
Fix : timetable view
Browse files Browse the repository at this point in the history
  • Loading branch information
dboissin authored and Damien BOISSIN committed Jul 18, 2011
1 parent 0f1d811 commit 3fdc8fd
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 25 deletions.
14 changes: 14 additions & 0 deletions src/main/scala/poc/resources/DefaultRepresentations.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package poc.resources

import com.sun.jersey.api.view.ImplicitProduces


/**
* Defines the default representations to be used on resources
*
* @version $Revision: 1.1 $
*/
@ImplicitProduces(Array("text/html;qs=5"))
abstract class DefaultRepresentations {

}
7 changes: 7 additions & 0 deletions src/main/scala/poc/resources/Item.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package poc.resources

/**
* @version $Revision: 1.1 $
*/
case class Item(id: String, name: String) extends DefaultRepresentations {
}
9 changes: 9 additions & 0 deletions src/main/scala/poc/resources/Timetable.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package poc.resources

case class Timetable (
year: String,
week: String,
name: String
) extends DefaultRepresentations {
}

36 changes: 19 additions & 17 deletions src/main/scala/poc/resources/TimetableResource.scala
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
package poc.resources

import com.sun.jersey.api.view.ImplicitProduces
import javax.ws.rs.Path
import javax.ws.rs.PathParam
import javax.ws.rs.GET
import javax.ws.rs.Produces
import com.sun.jersey.api.view.Viewable
import poc.dto.TimetableDTO

@Path("/timetable")
@ImplicitProduces(Array("text/html;qs=5"))
class TimetableResource {
class TimetableResource extends DefaultRepresentations {

def blip() = {
new TimetableDTO("year", "week", "name")
@GET
def get() = new Viewable("index", this)

@Path("{year}/{week}/{name}")
def timetable(
@PathParam("year") year: String,
@PathParam("week") week: String,
@PathParam("name") name: String
)= {
Timetable(year, week, name)
}

@GET
/*@Path("/")
def cashierTimetable() = {
*/
@Path("/{year}/{week}/{name}")


@Path("{year}")
def cashierTimetable(
@PathParam("year") year:String,
@PathParam("week") week:String,
@PathParam("name") name:String) = {
@PathParam("year") year:String
) = {
println("cashier timetable")
new Viewable("index", blip)
// new TimetableDTO("2011", "34", "Blip")
Item(year, "Name of Item: " + year)
}

}
}
26 changes: 26 additions & 0 deletions src/main/webapp/WEB-INF/poc/resources/Item.index.ssp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<%--

Copyright (C) 2009-2011 the original author or authors.
See the notice.md file distributed with this work for additional
information regarding copyright ownership.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

--%>
<%@ import val it: Item %>
<h1>Item!</h1>

<p>Hello from a Item!</p>

<p>The item id is <b><%= id %></b></p>
<p>The item name is <b><%= name %></b></p>
6 changes: 6 additions & 0 deletions src/main/webapp/WEB-INF/poc/resources/Timetable.index.scaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-@import val it: Timetable

%html
%body
%h1 Timetable #{name} #{year} #{week}

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

%html
%body
%h1 Timetable #{it.blip.name}

%h1 Timetable index

This file was deleted.

0 comments on commit 3fdc8fd

Please sign in to comment.