app/views/admin/layouts/preview.html.erb
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title><%= @title %></title>
<% if @website %>
<link rel="stylesheet" media="all" href="<%= admin_communication_website_style_path @website.id %>" />
<% else %>
<%= stylesheet_link_tag 'admin', media: 'all' %>
<% end %>
<style>
/*
En prévisualisation il n'y a pas de menu, donc pas besoin de laisser de la place au-dessus du hero
*/
.hero {
margin-top: 0;
padding-top: 1px;
}
a {
pointer-events: none !important;
}
</style>
<% if content_for?(:leaflet_required) %>
<%= stylesheet_link_tag 'leaflet', media: 'all' %>
<%= javascript_include_tag 'leaflet' %>
<% end %>
</head>
<body class="full-width">
<%
# Il faudrait tester le ratio de l'image, comme c'est pour le hero de la preview, on met de côté car cela nécessite de tester l'image avant
classes = 'hero'
classes += " hero--image-square"
# if @image.present? && @image.attached?
# classes += ' hero--with-image'
# # TODO réparer ça :
# width, height = @image.metadata.values_at('width', 'height')
# ratio = width.present? && height.present? ? (width.to_f / height.to_f) : nil
# format = 'square'
# if ratio.present?
# format = 'landscape' if ratio > 1
# format = 'portrait' if ratio < 1
# end
# classes += " hero--image-#{format}"
# end
%>
<header class="<%= classes %>">
<div class="container">
<div class="content">
<div class="hero-text">
<% if @summary.present? %>
<hgroup>
<h1><%= @title %></h1>
<p class="lead"><%= sanitize @summary %></p>
</hgroup>
<% else %>
<h1><%= @title %></h1>
<% end %>
</div>
<figure>
<%= kamifusen_tag @image if @image.present? && @image.attached? %>
</figure>
</div>
</div>
</header>
<main class="page-with-blocks" id="main" role="main" tabindex="-1">
<div class="blocks">
<%= yield %>
</div>
</main>
</body>
<script src="https://example.osuny.org/js/preview.js"></script>
</html>