discourse/app/views/layouts/application.html.erb

146 lines
4.8 KiB
Plaintext
Raw Normal View History

2013-02-06 03:16:51 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><%=t :title%></title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="" name="description">
<meta content="" name="author">
<%-
canonical = capture{yield :canonical}
if canonical
%>
<meta rel="canonical" href="<%= canonical %>">
<%-
end
%>
<link rel="icon" type="image/png" href=<%=SiteSetting.favicon_url%>>
<%= javascript_include_tag "preload_store" %>
<%#
The fonts are loaded outside of the stylesheet so that we can dynamically change
the path. This is to get around CDN caching on the Origin:
https://forums.aws.amazon.com/thread.jspa?threadID=114646
%>
<%- font_domain = "#{request.protocol}#{request.host_with_port}" %>
<style>
@font-face {
font-family: 'FontAwesome';
src: url('<%=asset_path "fontawesome-webfont.eot" %>?<%= font_domain %>');
src: url('<%=asset_path "fontawesome-webfont.eot" %>?<%= font_domain %>#iefix') format('embedded-opentype'),
url('<%=asset_path "fontawesome-webfont.woff" %>?<%= font_domain %>') format('woff'),
url('<%=asset_path "fontawesome-webfont.ttf" %>?<%= font_domain %>') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'zocial';
src: url('/assets/zocial-regular-webfont.woff?<%= font_domain %>') format('woff'),
url('/assets/zocial-regular-webfont.ttf?<%= font_domain %>') format('truetype'),
url('/assets/zocial-regular-webfont.svg?<%= font_domain %>#zocialregular') format('svg');
font-weight: normal;
font-style: normal;
}
</style>
<%- unless SiteCustomization.override_default_style(session[:preview_style]) %>
<%=stylesheet_link_tag "application"%>
2013-02-06 03:16:51 +08:00
<%- end %>
<%- if mini_profiler_enabled? %>
<%- Rack::MiniProfiler.step "stylsheet" do%>
<%= stylesheet_link_tag "admin"%>
<%-end%>
<%- elsif admin? %>
<%= stylesheet_link_tag "admin"%>
<%-end%>
<%=SiteCustomization.custom_stylesheet(session[:preview_style])%>
<%=csrf_meta_tags%>
</head>
<body>
<%=SiteCustomization.custom_header(session[:preview_style])%>
<section id='main'>
<section id='loading-message' style='display:none'><%= t :loading %>...</section>
<noscript data-path="<%= request.env['PATH_INFO'] %>">
<header class="d-header">
<div class="container">
<div class="contents">
<div class="row">
<div class="title span13">
<a href="/"><img src="<%=SiteSetting.logo_url%>" alt="<%=SiteSetting.title%>" id="site-logo"></a>
</div>
</div>
</div>
</div>
</header>
<div id="main-outlet" class="container">
<%= yield %>
</div>
</noscript>
</section>
<%- if @preloaded.present? %>
<script>
<%- @preloaded.each do |key, json| %>
PreloadStore.store("<%= key %>", <%= raw json %>)
<% end %>
</script>
<%- end %>
<%= yield :data %>
<footer id='bottom'></footer>
<%- if mini_profiler_enabled? %>
<%- Rack::MiniProfiler.step "application" do %>
<%= javascript_include_tag "application" %>
<%-end%>
<%- Rack::MiniProfiler.step "admin" do %>
<%= javascript_include_tag "admin"%>
<%-end%>
<%- else %>
<%= javascript_include_tag "application" %>
<%- if admin? %>
<%= javascript_include_tag "admin"%>
<%- end %>
<%- end%>
<script>
Discourse.CDN = '<%= Rails.configuration.action_controller.asset_host %>';
Discourse.BaseUrl = '<%= RailsMultisite::ConnectionManagement.current_hostname %>';
Discourse.Environment = '<%= Rails.env %>';
window.Discourse.Router.map(function() {
return Discourse.routeBuilder.call(this);
});
Discourse.start()
Discourse.initialize()
</script>
<%- if Rails.env == "production" and SiteSetting.ga_tracking_code.present? %>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<%= SiteSetting.ga_tracking_code %>']);
_gaq.push(['_setCustomVar', 1, 'Anonymous', <%= !current_user %>, 2]);
_gaq.push(['_trackPageview']);
(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);
})();
</script>
<%-end%>
</body>
</html>