diff options
-rw-r--r-- | app/assets/images/small-green-cross.png | bin | 0 -> 356 bytes | |||
-rw-r--r-- | app/assets/javascripts/general.js | 75 | ||||
-rw-r--r-- | app/assets/stylesheets/admin.scss | 8 | ||||
-rw-r--r-- | app/assets/stylesheets/main.scss | 62 | ||||
-rw-r--r-- | app/controllers/services_controller.rb | 3 | ||||
-rw-r--r-- | app/views/contact_mailer/from_admin_message.text.erb | 1 | ||||
-rw-r--r-- | app/views/layouts/default.html.erb | 18 | ||||
-rw-r--r-- | spec/controllers/services_controller_spec.rb | 2 |
8 files changed, 84 insertions, 85 deletions
diff --git a/app/assets/images/small-green-cross.png b/app/assets/images/small-green-cross.png Binary files differnew file mode 100644 index 000000000..5868f5775 --- /dev/null +++ b/app/assets/images/small-green-cross.png diff --git a/app/assets/javascripts/general.js b/app/assets/javascripts/general.js index b52131b83..529bbeb04 100644 --- a/app/assets/javascripts/general.js +++ b/app/assets/javascripts/general.js @@ -2,49 +2,56 @@ $(document).ready(function() { // flash message for people coming from other countries if(window.location.search.substring(1).search("country_name") == -1) { if (!$.cookie('has_seen_country_message')) { - $.ajax({ - url: "/country_message", - dataType: 'html', - success: function(country_message){ - if (country_message != ''){ - $('#other-country-notice').html(country_message); - $('body:not(.front) #other-country-notice').show() - } - } - }) + $.ajax({ + url: "/country_message", + dataType: 'html', + success: function(country_message){ + if (country_message != ''){ + $('#other-country-notice .popup-content').html(country_message); + $('body:not(.front) #other-country-notice').show() + } + } + }) } } - $('#other-country-notice').click(function() { - $('#other-country-notice').hide(); - $.cookie('has_seen_country_message', 1, {expires: 365, path: '/'}); + // popup messages + $('#other-country-notice .popup-close').click(function() { + $('#other-country-notice').hide('slow'); + $.cookie('has_seen_country_message', 1, {expires: 365, path: '/'}); }); + $('#everypage .popup-close').click(function() { + $('#everypage').hide('slow'); + $.cookie('seen_foi2', 1, { expires: 7, path: '/' }); + return false; + }); + // "link to this" widget $('a.link_to_this').click(function() { - var box = $('div#link_box'); - var location = window.location.protocol + "//" + window.location.hostname + $(this).attr('href'); - box.width(location.length + " em"); - box.find('input').val(location).attr('size', location.length + " em"); - box.show(); - box.find('input').select(); - box.position({ - my: "left top", - at: "left bottom", - of: this, - collision: "fit" }); - return false; - }); - + var box = $('div#link_box'); + var location = window.location.protocol + "//" + window.location.hostname + $(this).attr('href'); + box.width(location.length + " em"); + box.find('input').val(location).attr('size', location.length + " em"); + box.show(); + box.find('input').select(); + box.position({ + my: "left top", + at: "left bottom", + of: this, + collision: "fit" }); + return false; + }); + $('.close-button').click(function() { $(this).parent().hide() }); $('div#variety-filter a').each(function() { - $(this).click(function() { - var form = $('form#search_form'); - form.attr('action', $(this).attr('href')); - form.submit(); - return false; - }) - }) + $(this).click(function() { + var form = $('form#search_form'); + form.attr('action', $(this).attr('href')); + form.submit(); + return false; + }) + }) if($.cookie('seen_foi2') == 1) { $('#everypage').hide(); diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 584b0d00d..b0de2eb7b 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -22,12 +22,8 @@ body.admin { /* When the admin stylesheet is loaded (and so the user is seeing the admin navbar), pad the banner of the front end interface so that it isn't hidden, and move any special notice down too. */ -.entirebody, #banner { - padding-top: 50px; -} - -#special-notice { - margin-top: 50px; +.entirebody { + padding-top: 42px; } .admin { diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index 625245cce..6405d1dc3 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -8,7 +8,6 @@ padding:0; } #banner { -position:absolute; top:0; background-color:#F3F3F3; left:0; @@ -121,7 +120,6 @@ clear:both; top:0; text-align:left; overflow:visible; -padding-top:160px; width:900px; margin:0 auto 1.2em; } @@ -719,28 +717,45 @@ margin:60px 0 0; padding:0.5em 0; } -#everypage { -background-color:#fc9; -border:solid 2px #f60; -border-top:none; -opacity:0.97; -border-bottom-left-radius:10px; -border-bottom-right-radius:10px; -position:fixed; -width:70%; -left:15%; +.popup { +background-color:#D5FFD8; +border:solid 3px #16C132; z-index:2000; -max-height:95%; overflow:auto; -padding:4px; +text-align:center; +margin-top:2px; +} + +.popup .popup-content{ +margin:0.5em; +width: 95%; +float: left; +} + +.popup p { +margin: 0; } #everypage h2,#everypage h3 { margin:0.5em 0; } -#everypage .popup-close { - text-align: right; + +.popup .popup-close { +color:#FFF; +text-decoration:none; +display:inline-block; +border-radius:2px; +-moz-border-radius:2px; +cursor:pointer; +background: image-url('small-green-cross.png') no-repeat 0; +width:15px; +height:15px; +border:solid 0 #FFF; +text-indent:-999px; +overflow:hidden; +float:right; +padding:10px 0; } #game_sidebar { @@ -1568,17 +1583,6 @@ cursor:pointer; opacity:1; } -#other-country-notice { -background:#222; -color:#FFF; -font-size:1.1em; -width:100%; -z-index:999; -display:block; -position:absolute; -top:0; -opacity:0.9; -} p.public-body-name-prefix { color:#888; @@ -1587,10 +1591,6 @@ margin-bottom:-15px; font-size: 1.2em; } -#other-country-notice a { -color:#FFF; -} - .close-button { color:#FFF; text-decoration:none; diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 11ed4ac8f..78c494dba 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -24,9 +24,6 @@ class ServicesController < ApplicationController FastGettext.locale = old_fgt_locale end end - if !text.empty? - text += ' <span class="close-button">X</span>'.html_safe - end render :text => text, :content_type => "text/plain" # XXX workaround the HTML validation in test suite end diff --git a/app/views/contact_mailer/from_admin_message.text.erb b/app/views/contact_mailer/from_admin_message.text.erb index 4169d8d3a..3af759c5d 100644 --- a/app/views/contact_mailer/from_admin_message.text.erb +++ b/app/views/contact_mailer/from_admin_message.text.erb @@ -1,2 +1 @@ <%= raw @message %> - diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 8d69b2a08..f07c453d1 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -66,16 +66,17 @@ <% if is_admin? %> <%= render :partial => 'admin_general/admin_navbar' %> <% end %> -<% popup_banner = render(:partial => "general/popup_banner").strip %> -<% if popup_banner.present? %> -<div id="everypage" class="jshide"> - <p class="popup-close"><a href="#top" onclick="$.cookie('seen_foi2', 1, { expires: 7, path: '/' }); $('#everypage').hide('slow'); return false;"><%= _('Close') %></a></p> - <%= raw popup_banner %> - <p class="popup-close"><a href="#top" onclick="$.cookie('seen_foi2', 1, { expires: 7, path: '/' }); $('#everypage').hide('slow'); return false;"><%= _('Close') %></a></p> -</div> -<% end %> <div class="entirebody"> + <% popup_banner = render(:partial => "general/popup_banner").strip %> + <% if popup_banner.present? and ! @render_to_file %> + <div id="everypage" class="popup"> + <span class="popup-content"> + <%= raw popup_banner %> + </span> + <span class="popup-close"><a href="#top" ><%= _('Close') %></a></span> + </div> + <% end %> <%= render :partial => 'general/header' %> <div id="wrapper"> <div id="content"> @@ -96,7 +97,6 @@ <%= render :partial => 'general/footer' %> </div> -<div id="other-country-notice"></div> <div id="link_box"><span class="close-button">X</span> <%= _("Paste this link into emails, tweets, and anywhere else:") %> <br /> diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb index 399f48acb..14731f090 100644 --- a/spec/controllers/services_controller_spec.rb +++ b/spec/controllers/services_controller_spec.rb @@ -58,7 +58,7 @@ describe ServicesController, "when returning a message for people in other count FakeWeb.register_uri(:get, %r|denmark.com|, :body => "DK") get :other_country_message response.should be_success - response.body.should == 'Hello! We have an <a href="/help/alaveteli?country_name=Deutschland">important message</a> for visitors outside Deutschland <span class="close-button">X</span>' + response.body.should == 'Hello! We have an <a href="/help/alaveteli?country_name=Deutschland">important message</a> for visitors outside Deutschland' end it "should default to no message if the country_from_ip domain doesn't exist" do AlaveteliConfiguration.stub!(:gaze_url).and_return('http://12123sdf14qsd.com') |