aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2013-01-28 01:29:42 +0000
committerDave Whiteland <dave@mysociety.org>2013-01-28 01:29:42 +0000
commit6445ffb92514bf16478afd29bb168b81d34f243c (patch)
tree0d8d919db80bff2201c96a585dcae4aa92f42015
parentbdff3463d11642dd7b756f32b71f6e454edd458a (diff)
wire up the Message Manager detach button (for marking incoming messages as not-a-reply if MM gets it wrong)
-rw-r--r--templates/web/fixmybarangay/footer.html15
-rw-r--r--templates/web/fixmybarangay/report/_message_manager.html17
2 files changed, 26 insertions, 6 deletions
diff --git a/templates/web/fixmybarangay/footer.html b/templates/web/fixmybarangay/footer.html
index a79d30d4e..afdeabc60 100644
--- a/templates/web/fixmybarangay/footer.html
+++ b/templates/web/fixmybarangay/footer.html
@@ -86,12 +86,15 @@
<p>
If you detach the message, it will appear as a new, available message (instead of being a reply).
</p>
- <!--
- echo $this->Form->create(array('id' => 'detach-form','default'=>false));
- echo $this->Form->input('msg_id', array('type'=>'hidden', 'name'=>'msg_id', 'id'=>'detach_msg_id'));
- echo $this->Form->submit(__('Detach Message'), array('id' => 'detach-submit'));
- echo $this->Form->end();
- -->
+ <form action="/dummy" id="detach-form" onsubmit="event.returnValue = false; return false;" method="post" accept-charset="utf-8">
+ <div style="display:none;">
+ <input type="hidden" name="_method" value="POST">
+ </div>
+ <input type="hidden" name="msg_id" id="detach_msg_id">
+ <div class="submit">
+ <input id="detach-submit" type="submit" value="Detach Message">
+ </div>
+ </form>
</div>
</div>
<div style="display:none">
diff --git a/templates/web/fixmybarangay/report/_message_manager.html b/templates/web/fixmybarangay/report/_message_manager.html
index 5f6b515e5..e4177167d 100644
--- a/templates/web/fixmybarangay/report/_message_manager.html
+++ b/templates/web/fixmybarangay/report/_message_manager.html
@@ -122,6 +122,12 @@ $(document).ready(function() {
dummy_busy = false;
}
+ var dummy_detach_cleanup = function(data) {
+ reset_timeout();
+ dummy_busy = false;
+ mm_refresh_messages(); // refresh because detached message now appears in the list
+ }
+
var custom_tooltips;
if (problem_id) { // this page is viewing, not creating
custom_tooltips = {tt_radio: "Select before clicking 'Copy to Update' to add this message as an update"};
@@ -198,6 +204,17 @@ $(document).ready(function() {
{callback:dummy_hide_cleanup});
}
});
+
+ $('#detach-submit').click(function(e) {
+ e.preventDefault();
+ if (! dummy_busy) {
+ dummy_busy = true;
+ message_manager.mark_as_not_a_reply(
+ $('#detach_msg_id').val(),
+ {callback:dummy_detach_cleanup});
+ }
+ });
+
$("a#reply").fancybox({onClosed: function(){dummy_busy=false;}});
// only show on problem display page