diff --git a/app/controllers/API.java b/app/controllers/API.java index db9c19c..0eb0664 100644 --- a/app/controllers/API.java +++ b/app/controllers/API.java @@ -34,6 +34,14 @@ public static void listMembers() { render(members); } + public static void nextEvent() { + Event event = Event.next(); + if (request.format.equals("json")) { + renderJSONExclusion(event); + } + render(event); + } + private static void renderJSONExclusion(Object o) { throw new RenderJsonExclusion(o); } diff --git a/app/controllers/Application.java b/app/controllers/Application.java index 47345ee..a2f75bf 100644 --- a/app/controllers/Application.java +++ b/app/controllers/Application.java @@ -68,5 +68,4 @@ public static void downloadEventAttachment(Long eventId, String attachment) { notFound(); } } - } diff --git a/app/views/API/event.xml b/app/views/API/event.xml new file mode 100644 index 0000000..2e3e0d1 --- /dev/null +++ b/app/views/API/event.xml @@ -0,0 +1,15 @@ + + ${event.title} + ${event.date} + ${event.location} + ${event.description} + ${event.registrationURL} + ${event.capacity} + ${event.open} + ${event.map} + + #{list event.talks(), as : "talk"} + #{include 'API/talk.xml' /} + #{/list} + + \ No newline at end of file diff --git a/app/views/API/listEvents.xml b/app/views/API/listEvents.xml index 913bcbe..ca00831 100644 --- a/app/views/API/listEvents.xml +++ b/app/views/API/listEvents.xml @@ -1,10 +1,6 @@ #{list events, as:'event'} - - ${event.title} - ${event.date} - ${event.description} - + #{include 'API/event.xml' /} #{/list} \ No newline at end of file diff --git a/app/views/API/nextEvent.xml b/app/views/API/nextEvent.xml new file mode 100644 index 0000000..39dfbbb --- /dev/null +++ b/app/views/API/nextEvent.xml @@ -0,0 +1,2 @@ + +#{include 'API/event.xml' /} diff --git a/app/views/API/talk.xml b/app/views/API/talk.xml new file mode 100644 index 0000000..132dcab --- /dev/null +++ b/app/views/API/talk.xml @@ -0,0 +1,21 @@ + + ${talk.orderInEvent} + ${talk.title} + + ${talk.tags} + ${talk.teaser} + + ${talk.speaker.fullName} + ${talk.speaker.activity?.escapeXml()} + ${talk.speaker.company} + ${talk.speaker.url} + ${talk.speaker.personalUrl} + ${talk.speaker.description?.escapeXml()} + #{if (talk.speaker.photoUrl)} + ${talk.speaker.photoUrl} + #{/if} + #{else} + ${talk.speaker.getGravatar().escapeXml()} + #{/else} + + \ No newline at end of file diff --git a/conf/routes b/conf/routes index b74cb85..50a7a99 100644 --- a/conf/routes +++ b/conf/routes @@ -20,6 +20,7 @@ GET /remove/{eventId}/{filename} Admin.rmEventAttachment # API stuff GET /api/events.{format} API.listEvents GET /api/members.{format} API.listMembers +GET /api/nextevent.{format} API.nextEvent # Map static resources from the /app/public folder to the /public path GET /public/ staticDir:public