/
application.html.haml
65 lines (65 loc) · 3.45 KB
/
application.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
!!! 1.0
%html{:xmlns => "http://www.w3.org/1999/xhtml", :'xml:lang' => "en", :lang => "en"}
%head
%meta{:'http-equiv' => "content-type", :content => "text/html;charset=UTF-8"}
= yield :meta
%link{:rel => "shortcut icon", :href => "http://www.allourideas.org/favicon.ico"}
%title= t('common.title')
= stylesheet_link_tag @widget_stylesheet
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css" type="text/css" media="all" />
= stylesheet_link_tag 'ui.theme', :media => 'all'
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/jquery-ui.min.js" type="text/javascript"></script>
= javascript_include_tag 'widget/widget'
= yield :head
%script{:type => "text/javascript"}
$(document).ready(function() {
= yield :view_javascript
});
%body{:class => "lang-#{I18n.locale}"}
=javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.to_json};" if protect_against_forgery?
.content{:style => white_label_request? ? "overflow:hidden": ""}
.body{:class => white_label_request? ? 'noborder' : ''}
= render :partial => "shared/flashes"
-if session[:standard_flash]
%p.notice.example_notice#notice= session[:standard_flash]
-session[:standard_flash] = nil
-unless session[:has_voted]
-if session[:on_example]
%p.notice.example_notice#notice= t('home.student_government_explanation')
-session[:on_example] = nil
= yield
.clear
= javascript_include_tag 'jquery.ba-url.min.js', 'jquery.taconite.js', 'jquery.hint.js', 'jquery.blockUI.js','label_over', 'jquery.jqEasyCharCounter.js', 'application'
-if ['production'].include? Rails.env
%script{:type => "text/javascript"}
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-11703548-1']);
_gaq.push(['_trackPageview']);
- if @earl && !@earl.ga_code.blank?
_gaq.push(['b._setAccount', '#{h(@earl.ga_code)}']);
_gaq.push(['b._trackPageview']);
:javascript
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
:javascript
// Test if we can set and read cookies.
// If we can't, then the browser probably has 3rd party cookies disabled
// unless the user has first navigated to the domain serving the iframe source.
var cookieValue = "cookieTest" + new Date().getTime();
document.cookie = "cookieTest="+cookieValue;
if (document.cookie.indexOf("cookieTest="+cookieValue) === -1) {
var cookies_failed = document.getElementById('cookies-failed');
if (cookies_failed) {
cookies_failed.style.display = 'block';
var img = new Image();
img.src = '/cookies_blocked.gif?question_id=#{@earl.try(:question_id)}&session_id=#{@user_session.try(:session_id)}&referrer=' + encodeURIComponent(document.referrer);
}
}
else {
// cleanup test cookie
document.cookie = 'cookieTest=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}