From de7422c1fa5d4c35b07ea58a6f3e91a0f94b7981 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Wed, 27 Jan 2016 13:13:17 +0100 Subject: include link to photos --- .../org/xapek/yvesf/classifieds/Dumper.groovy | 26 +++++++++++++++++++--- .../org/xapek/yvesf/classifieds/Model.groovy | 15 +++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy b/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy index 623c786..ccadd56 100644 --- a/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy +++ b/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy @@ -9,7 +9,7 @@ class Dumper { static dump(ClassifiedsList classifiedList, PrintWriter writer) { new MarkupBuilder(writer).rss(version: '2.0', 'xmlns:atom': 'http://www.w3.org/2005/Atom') { channel { - title('Glocals') + title('Glocals Classifieds Feed') description('glocal classifieds feed') link('https://www.xapek.org/git/yvesf/classifieds') classifiedList.each { Classified classified -> @@ -20,7 +20,7 @@ class Dumper { pubDate(classified.formattedDate) author("${classified.mem_id}@noemail.local (${classified.mem_name})") description(getDescription(classified) + classified.description) - } + } } } } @@ -38,9 +38,29 @@ class Dumper { th('Views') td(classified.views) } + tr { + th('Available') + td(classified.available) + } + tr { + th('Rooms') + td(classified.rooms) + } tr { th('Member') - td(classified.mem_name) + td { + a(classified.mem_name, referrerpolicy: 'no-referrer', href: classified.memberProfileLink) + } + } + if (classified.images) { + tr { + th('Images') + td { + classified.images.eachWithIndex { String url, Integer i -> + a("Photo ${i + 1}", referrerpolicy: 'no-referrer', href: url) + } + } + } } br() } diff --git a/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy b/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy index ac5ca13..cced09b 100644 --- a/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy +++ b/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy @@ -38,6 +38,7 @@ class Model { //28 ="type" -> "Apts / Housing for rent" //29 ="views" -> "8" String available + String rooms String location String city String type @@ -50,6 +51,10 @@ class Model { String mem_id String description String date + Object photo1 + Object photo2 + Object photo3 + Object photo4 Classified(Map map) { metaClass.properties.each { MetaProperty property -> @@ -76,6 +81,16 @@ class Model { String getComposedLocation() { return location + (city != location ? ', ' + city : '') } + + Collection getImages() { + return [photo1,photo2,photo3,photo4] + .grep { it instanceof String } + .collect { "http://www.glocals.com/sites/glocals${it}" } + } + + String getMemberProfileLink() { + return "http://www.glocals.com/members/member_profile/${id}" + } } static class ClassifiedsList extends ArrayList { -- cgit v1.2.1