aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/ResultSet/ResponseTemplate.pm
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2017-11-03 16:13:59 +0100
committerMarius Halden <marius.h@lden.org>2017-11-03 16:13:59 +0100
commit42d874db498d0fabae92d0c87acf99054d92391b (patch)
treed0cf5afdee3d244c4e5da6fe1ab9acba620634df /perllib/FixMyStreet/DB/ResultSet/ResponseTemplate.pm
parent19a7c5dda85a47a68040c742791e9cd9d3e52be6 (diff)
parentdc7613329c275cd158fdde8faf1c0e301f5b7202 (diff)
Merge tag 'v2.2' into fiksgatami-dev
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/ResponseTemplate.pm')
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/ResponseTemplate.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/ResponseTemplate.pm b/perllib/FixMyStreet/DB/ResultSet/ResponseTemplate.pm
new file mode 100644
index 000000000..aa070daa3
--- /dev/null
+++ b/perllib/FixMyStreet/DB/ResultSet/ResponseTemplate.pm
@@ -0,0 +1,27 @@
+package FixMyStreet::DB::ResultSet::ResponseTemplate;
+use base 'DBIx::Class::ResultSet';
+
+use Moo;
+use HTML::Entities;
+
+with('FixMyStreet::Roles::ContactExtra');
+
+sub join_table {
+ return 'contact_response_templates';
+}
+
+sub name_column {
+ 'title';
+}
+
+sub map_extras {
+ my ($rs, @ts) = @_;
+ return map {
+ my $out = { id => encode_entities($_->text), name => encode_entities($_->title) };
+ $out->{state} = encode_entities($_->state) if $_->state;
+ $out;
+ } @ts;
+}
+
+1;
+