aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorpezholio <pezholio@gmail.com>2017-05-24 11:28:07 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-06-20 17:59:59 +0100
commitac9be7b3038693fd5076d1c37648e059bf459527 (patch)
tree00ce676daa3aba6a2d8966cf0ceda6532460f943 /web
parent27ac8579d461c6d43e10693d2210fcba90b9baac (diff)
Move `toggle_shortlist` to `utils`
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/fixmystreet/staff.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js
index 370a16618..7f248acb8 100644
--- a/web/cobrands/fixmystreet/staff.js
+++ b/web/cobrands/fixmystreet/staff.js
@@ -121,9 +121,9 @@ $.extend(fixmystreet.set_up, {
} else if ('shortlist-up' === whatUserWants) {
$item.insertBefore( $item.prev() );
} else if ('shortlist-remove' === whatUserWants) {
- fixmystreet.hooks.toggle_shortlist($submitButton, 'add', report_id);
+ fixmystreet.utils.toggle_shortlist($submitButton, 'add', report_id);
} else if ('shortlist-add' === whatUserWants) {
- fixmystreet.hooks.toggle_shortlist($submitButton, 'remove', report_id);
+ fixmystreet.utils.toggle_shortlist($submitButton, 'remove', report_id);
}
// Items have moved around. We need to make sure the "up" button on the
@@ -141,9 +141,9 @@ $.extend(fixmystreet.set_up, {
} else if ('shortlist-up' === whatUserWants) {
$item.insertAfter( $item.next() );
} else if ('shortlist-remove' === whatUserWants) {
- fixmystreet.hooks.toggle_shortlist($submitButton, 'remove', report_id);
+ fixmystreet.utils.toggle_shortlist($submitButton, 'remove', report_id);
} else if ('shortlist-add' === whatUserWants) {
- fixmystreet.hooks.toggle_shortlist($submitButton, 'add', report_id);
+ fixmystreet.utils.toggle_shortlist($submitButton, 'add', report_id);
}
fixmystreet.update_list_item_buttons($list);
}).complete(function() {
@@ -391,15 +391,6 @@ $.extend(fixmystreet.hooks, {
$(this).data('autopopulated', false);
});
}
- },
-
- toggle_shortlist: function(btn, sw, id) {
- btn.attr('class', 'item-list__item__shortlist-' + sw);
- btn.attr('title', btn.data('label-' + sw));
- if (id) {
- sw += '-' + id;
- }
- btn.attr('name', 'shortlist-' + sw);
}
});
@@ -420,7 +411,7 @@ $.extend(fixmystreet.maps, {
$form = $item.find('form'),
$submit = $form.find("input[type='submit']" );
- fixmystreet.hooks.toggle_shortlist($submit, 'remove', problemId);
+ fixmystreet.utils.toggle_shortlist($submit, 'remove', problemId);
items.push({
'url': '/report/' + $item.data('report-id'),
@@ -462,5 +453,13 @@ $.extend(fixmystreet.utils, {
},
priorities_type_format: function(data) {
return data.name;
+ },
+ toggle_shortlist: function(btn, sw, id) {
+ btn.attr('class', 'item-list__item__shortlist-' + sw);
+ btn.attr('title', btn.data('label-' + sw));
+ if (id) {
+ sw += '-' + id;
+ }
+ btn.attr('name', 'shortlist-' + sw);
}
});