aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/update-schema1
-rw-r--r--db/downgrade_0047---0046.sql6
-rw-r--r--db/schema.sql1
-rw-r--r--db/schema_0047-response-priorities-add-description.sql6
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin/ResponsePriorities.pm1
-rw-r--r--perllib/FixMyStreet/DB/Result/ResponsePriority.pm6
-rw-r--r--t/app/controller/admin.t2
-rw-r--r--templates/web/base/admin/responsepriorities/edit.html4
-rw-r--r--templates/web/base/admin/responsepriorities/list.html4
9 files changed, 28 insertions, 3 deletions
diff --git a/bin/update-schema b/bin/update-schema
index 500e771f1..479a55c8e 100755
--- a/bin/update-schema
+++ b/bin/update-schema
@@ -194,6 +194,7 @@ else {
# By querying the database schema, we can see where we're currently at
# (assuming schema change files are never half-applied, which should be the case)
sub get_db_version {
+ return '0047' if column_exists('response_priorities', 'description');
return '0046' if column_exists('users', 'extra');
return '0045' if table_exists('response_priorities');
return '0044' if table_exists('contact_response_templates');
diff --git a/db/downgrade_0047---0046.sql b/db/downgrade_0047---0046.sql
new file mode 100644
index 000000000..2f07c44ea
--- /dev/null
+++ b/db/downgrade_0047---0046.sql
@@ -0,0 +1,6 @@
+BEGIN;
+
+ALTER TABLE response_priorities
+ DROP COLUMN description;
+
+COMMIT;
diff --git a/db/schema.sql b/db/schema.sql
index fe45fb4aa..d3bb5040e 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -134,6 +134,7 @@ CREATE TABLE response_priorities (
body_id int references body(id) not null,
deleted boolean not null default 'f',
name text not null,
+ description text,
unique(body_id, name)
);
diff --git a/db/schema_0047-response-priorities-add-description.sql b/db/schema_0047-response-priorities-add-description.sql
new file mode 100644
index 000000000..1aa856d75
--- /dev/null
+++ b/db/schema_0047-response-priorities-add-description.sql
@@ -0,0 +1,6 @@
+BEGIN;
+
+ALTER TABLE response_priorities
+ ADD COLUMN description TEXT;
+
+COMMIT;
diff --git a/perllib/FixMyStreet/App/Controller/Admin/ResponsePriorities.pm b/perllib/FixMyStreet/App/Controller/Admin/ResponsePriorities.pm
index ce17390d9..032e593c6 100644
--- a/perllib/FixMyStreet/App/Controller/Admin/ResponsePriorities.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin/ResponsePriorities.pm
@@ -69,6 +69,7 @@ sub edit : Path : Args(2) {
if ($c->req->method eq 'POST') {
$priority->deleted( $c->get_param('deleted') ? 1 : 0 );
$priority->name( $c->get_param('name') );
+ $priority->description( $c->get_param('description') );
$priority->update_or_insert;
my @live_contact_ids = map { $_->id } @live_contacts;
diff --git a/perllib/FixMyStreet/DB/Result/ResponsePriority.pm b/perllib/FixMyStreet/DB/Result/ResponsePriority.pm
index d312fbcea..6bc8474fa 100644
--- a/perllib/FixMyStreet/DB/Result/ResponsePriority.pm
+++ b/perllib/FixMyStreet/DB/Result/ResponsePriority.pm
@@ -24,6 +24,8 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 0 },
"deleted",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
+ "description",
+ { data_type => "text", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->add_unique_constraint("response_priorities_body_id_name_key", ["body_id", "name"]);
@@ -47,8 +49,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-09-07 11:01:40
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:B1swGtQzC3qRa0LUM4IyzA
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-10-17 16:37:28
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wok3cPA7cPjG4e9lnc1PIg
__PACKAGE__->many_to_many( contacts => 'contact_response_priorities', 'contact' );
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 7ba84b652..a0e013459 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -1453,6 +1453,7 @@ subtest "response priorities can be added" => sub {
my $fields = {
name => "Cat 1A",
+ description => "Fixed within 24 hours",
deleted => undef,
"contacts[".$oxfordshirecontact->id."]" => 1,
};
@@ -1466,6 +1467,7 @@ subtest "response priorities can be listed" => sub {
$mech->get_ok( "/admin/responsepriorities/" . $oxfordshire->id );
$mech->content_contains( $oxfordshire->response_priorities->first->name );
+ $mech->content_contains( $oxfordshire->response_priorities->first->description );
};
subtest "response priorities are limited by body" => sub {
diff --git a/templates/web/base/admin/responsepriorities/edit.html b/templates/web/base/admin/responsepriorities/edit.html
index 89f41a069..93b050a20 100644
--- a/templates/web/base/admin/responsepriorities/edit.html
+++ b/templates/web/base/admin/responsepriorities/edit.html
@@ -14,6 +14,10 @@
<input type="text" name="name" class="required form-control" size="30" value="[% rp.name | html %]">
</p>
<p>
+ <strong>[% loc('Description:') %] </strong>
+ <input type="text" name="description" class="form-control" size="30" value="[% rp.description | html %]">
+ </p>
+ <p>
<strong>[% loc('Categories:') %]</strong>
<ul>
[% FOR contact IN contacts %]
diff --git a/templates/web/base/admin/responsepriorities/list.html b/templates/web/base/admin/responsepriorities/list.html
index c893a4c70..a269ff909 100644
--- a/templates/web/base/admin/responsepriorities/list.html
+++ b/templates/web/base/admin/responsepriorities/list.html
@@ -4,13 +4,15 @@
<thead>
<tr>
<th> [% loc('Name') %] </th>
+ <th> [% loc('Description') %] </th>
<th> &nbsp; </th>
</tr>
</thead>
<tbody>
[% FOR p IN response_priorities %]
<tr [% 'class="is-deleted"' IF p.deleted %]>
- <td> [% p.name %] </td>
+ <td> [% p.name | html %] </td>
+ <td> [% p.description | html %] </td>
<td> <a href="[% c.uri_for('', body.id, p.id) %]" class="btn">[% loc('Edit') %]</a> </td>
</tr>
[% END %]