diff options
author | Yves Fischer <yves.fischer@cern.ch> | 2016-01-26 09:51:27 +0100 |
---|---|---|
committer | Yves Fischer <yves.fischer@cern.ch> | 2016-01-26 09:51:27 +0100 |
commit | a059e48189927477c605cf44299b7bf84650d844 (patch) | |
tree | b16870bdf0c13b912154d5f33d4dbe83af1183e4 /src/main/groovy/org/xapek | |
parent | a445578f9bf6e32a1411cf185269519e9f6d4be7 (diff) | |
download | glocals-classifieds-a059e48189927477c605cf44299b7bf84650d844.tar.gz glocals-classifieds-a059e48189927477c605cf44299b7bf84650d844.zip |
write a table with more info in description
Diffstat (limited to 'src/main/groovy/org/xapek')
-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 | 2 |
2 files changed, 25 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 5fb0568..017cdf3 100644 --- a/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy +++ b/src/main/groovy/org/xapek/yvesf/classifieds/Dumper.groovy @@ -1,6 +1,7 @@ package org.xapek.yvesf.classifieds import groovy.xml.MarkupBuilder +import org.xapek.yvesf.classifieds.Model.Classified import org.xapek.yvesf.classifieds.Model.ClassifiedsList @@ -11,15 +12,36 @@ class Dumper { channel { title('Glocals') } - classifiedList.each { Model.Classified classified -> + classifiedList.each { Classified classified -> item { title("${classified.type} - ${classified.title} - ${classified.composedLocation}") guid(classified.id) author(classified.mem_name) - description(classified.description) + description(getDescription(classified) + classified.description) } } } } } + + static String getDescription(Classified classified) { + final descriptionOs = new ByteArrayOutputStream() + final description = new MarkupBuilder(new PrintWriter(descriptionOs)) + description.table { + tr { + th('Price') + td("${classified.price} ${classified.currency}") + } + tr { + th('Views') + td(classified.views) + } + tr { + th('Member') + td(classified.mem_name) + } + br() + } + return descriptionOs.toString() + } } diff --git a/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy b/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy index cd62c25..6303d3e 100644 --- a/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy +++ b/src/main/groovy/org/xapek/yvesf/classifieds/Model.groovy @@ -61,7 +61,7 @@ class Model { } String getComposedLocation() { - return "${location}, ${city}" + return location + (city != location ? ', ' + city : '') } } |