diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-04-25 18:40:45 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-04-25 18:40:45 +0100 |
commit | 3f79008df3d35f1458e33c28b7d3e8ba55376add (patch) | |
tree | 51d444c1cda377e6c4cc96654ef2b988ede31052 /web/cobrands/fixmybarangay/messages.js | |
parent | f61481437045a6e721891355c039882493f42e14 (diff) |
Pull in texts from message manager, pre-fill detail box if selected.
Diffstat (limited to 'web/cobrands/fixmybarangay/messages.js')
-rw-r--r-- | web/cobrands/fixmybarangay/messages.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/web/cobrands/fixmybarangay/messages.js b/web/cobrands/fixmybarangay/messages.js new file mode 100644 index 000000000..aebf35156 --- /dev/null +++ b/web/cobrands/fixmybarangay/messages.js @@ -0,0 +1,26 @@ +$(function(){ + + var mm = $('#message_manager'); + + $.getJSON('/cobrands/fixmybarangay/test-texts.json', function(data) { + var items = []; + $.each(data, function(k, v) { + var item = $('<input type="radio"/>').attr({ + 'id': 'mm_text_' + v.id, + 'name': 'mm_text', + 'value': v.text + }).wrap('<p/>').parent().html(); + var label = $('<label/>', { + 'class': 'inline', + 'for': 'mm_text_' + v.id + }).text(v.text).wrap('<p/>').parent().html(); + item = '<li><p>' + item + ' ' + label + '</p></li>'; + items.push(item); + }); + mm.html(items.join('')); + mm.find('input').click(function(){ + $('#form_detail').val( $('input[name=mm_text]:checked').val() ); + }); + }); + +}); |