diff options
-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 : '') } } |