aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/cobrands/fixmystreet/base.scss8
-rw-r--r--web/cobrands/fixmystreet/fixmystreet.js41
2 files changed, 43 insertions, 6 deletions
diff --git a/web/cobrands/fixmystreet/base.scss b/web/cobrands/fixmystreet/base.scss
index 546f4cb33..6dbcdc601 100644
--- a/web/cobrands/fixmystreet/base.scss
+++ b/web/cobrands/fixmystreet/base.scss
@@ -421,6 +421,14 @@ textarea.form-error {
@include border-radius(0 0.25em 0.25em 0.25em);
}
+ul.error {
+ background:#ff0000;
+ color:#fff;
+ padding:0 0.5em;
+ margin:0 0 0 -0.5em;
+ @include border-radius(0.25em);
+}
+
// don't display valid error boxes as now the page jump
// won't be until the user submits, which is fine
div.label-valid,
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js
index 16b1b15ef..68e870201 100644
--- a/web/cobrands/fixmystreet/fixmystreet.js
+++ b/web/cobrands/fixmystreet/fixmystreet.js
@@ -373,28 +373,57 @@ $(function(){
$('<p id="sub_map_links" />').insertAfter($('#map'));
}
- // Open list of wards on council page
- // TODO Change chevron when open to point down
- $('#council_wards_link').toggle(function(e){
- var $this = $(this), d = $('#council_wards');
+// A sliding drawer from the bottom of the page
+// TODO Not have independent scrolling; height broken in IE6 (at least). Think fixing former will fix latter.
+$.fn.drawer = function(id, ajax) {
+ this.toggle(function(){
+ var $this = $(this), d = $('#' + id);
if (!$this.addClass('hover').data('setup')) {
+ if (!d.length) {
+ d = $('<div id="' + id + '">');
+ }
d.css({
backgroundColor: 'white',
height: $(window).height() - $('.content').offset().top - $('.shadow-wrap').height(),
- display: 'none',
+ display: 'none', zIndex: 1001, position: 'relative',
overflow: 'auto',
padding: '1em'
}).removeClass('hidden-js');
+ if (ajax) {
+ var href = $this.attr('href') + ';ajax=1';
+ d.load(href);
+ }
d.find('h2').css({ marginTop: 0 });
$('.shadow-wrap').append(d);
$this.data('setup', true);
}
d.animate( { height: 'show' } );
}, function(e){
- var $this = $(this), d = $('#council_wards');
+ var $this = $(this), d = $('#' + id);
$this.removeClass('hover');
d.animate( { height: 'hide' } );
});
+};
+
+ $('#council_wards_link').drawer('council_wards', false);
+ $('#updates_link').drawer('updates_ajax', true);
+
+ // Go directly to RSS feed if RSS button clicked on alert page
+ // (due to not wanting around form to submit, though good thing anyway)
+ $('.shadow-wrap').on('click', '#alert_rss_button', function(e){
+ e.preventDefault();
+ var feed = $('input[name=feed][type=radio]:checked').nextAll('a').attr('href');
+ window.location.href = feed;
+ });
+ $('.shadow-wrap').on('click', '#alert_email_button', function(e){
+ e.preventDefault();
+ var form = $('<form/>').attr({ method:'post', action:"/alert/subscribe" });
+ $('#alerts input[type=text], #alerts input[type=hidden], #alerts input[type=radio]:checked').each(function() {
+ var $v = $(this);
+ $('<input/>').attr({ name:$v.attr('name'), value:$v.val(), type:'hidden' }).appendTo(form);
+ });
+ form.submit();
+ });
//add permalink on desktop, force hide on mobile
$('#sub_map_links').append('<a href="#" id="map_permalink">Permalink</a>');