diff options
author | Yves Fischer <yves.fischer@cern.ch> | 2016-01-27 13:13:17 +0100 |
---|---|---|
committer | Yves Fischer <yves.fischer@cern.ch> | 2016-01-27 13:13:17 +0100 |
commit | de7422c1fa5d4c35b07ea58a6f3e91a0f94b7981 (patch) | |
tree | 07bd93e0ee7df2d7eea35645dc74abc48fea232a | |
parent | c3d5f9c53dbd13e4c611a62ea8b2387a3d1cd881 (diff) | |
download | glocals-classifieds-de7422c1fa5d4c35b07ea58a6f3e91a0f94b7981.tar.gz glocals-classifieds-de7422c1fa5d4c35b07ea58a6f3e91a0f94b7981.zip |
include link to photos
-rw-r--r-- | src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy | 26 | ||||
-rw-r--r-- | src/main/groovy/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) - } + } } } } @@ -39,8 +39,28 @@ class Dumper { 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<String> 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<Classified> { |