diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb index b9f76636bd6aed01b82e5e86b52f1d293fb59e0d..06a081142d9601c9c79a8fee47e088915554a69e 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb @@ -1,17 +1,17 @@ <% -$class = "block block-call_to_action" +class_name = "block block-call_to_action" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end -$image_class = "call_to_action--with" + (@block.template.image.empty? ? "out" : "") + "-image" +image_class = "call_to_action--with" + (@block.template.image.empty? ? "out" : "") + "-image" %> -<section class="block block-call_to_action"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> - <div class="call_to_action <%= $image_class %>"> + <div class="call_to_action <%= image_class %>"> <div> <% unless @block.title.blank? %> <h2><%= @block.title %></h2> diff --git a/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb b/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb index 1be71e833ea3c6e71f390bff03dba5d6877661ed..838aa58f37f665c868037905aa36990f93b8c255 100644 --- a/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb @@ -1,19 +1,19 @@ <% -$class = "block block-chapter" +class_name = "block block-chapter" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end if @block.template.image[:id] #TODO comment vérifier proprement la présence de l'image? - $class += " block-chapter--with-image" + class_name += " block-chapter--with-image" end -$class += " block-chapter--" + @block.template.layout +class_name += " block-chapter--" + @block.template.layout %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <div class="chapter"> diff --git a/app/views/admin/communication/blocks/templates/contact/_preview.html.erb b/app/views/admin/communication/blocks/templates/contact/_preview.html.erb index 9a617582b13cab08266f6fa1c5ab33d85cae7e28..5c37e6e40126cab800221fa2d984ebb908175d53 100644 --- a/app/views/admin/communication/blocks/templates/contact/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/contact/_preview.html.erb @@ -1,11 +1,11 @@ <% -$class = "block block-contact" +class_name = "block block-contact" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <% unless @block.title.blank? && @block.template.description.blank? %> diff --git a/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb b/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb index fdd161bde54b44ad473f41e1ef64b24d634e20d6..f1df7239485769a17ed013d1a5f3ab414b250324 100644 --- a/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb @@ -1,10 +1,10 @@ <% -$class = "block block-datatable" +class_name = "block block-datatable" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <% unless @block.title.blank? && @block.template.description.blank? %> diff --git a/app/views/admin/communication/blocks/templates/definitions/_preview.html.erb b/app/views/admin/communication/blocks/templates/definitions/_preview.html.erb index 6770c718db2441be651771243356072bc485a695..0673ec78f459ffbb22726e9d679b4812547841ff 100644 --- a/app/views/admin/communication/blocks/templates/definitions/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/definitions/_preview.html.erb @@ -1,11 +1,11 @@ <% - $class = "block block-definitions" + class_name = "block block-definitions" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <% unless @block.title.blank? && @block.template.description.blank? %> diff --git a/app/views/admin/communication/blocks/templates/files/_preview.html.erb b/app/views/admin/communication/blocks/templates/files/_preview.html.erb index a79859be33e3df7d10e5e7d3408151aa73015e31..f9ebe021d0db9bb41f3a4614bea4539abd712014 100644 --- a/app/views/admin/communication/blocks/templates/files/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_preview.html.erb @@ -1,11 +1,11 @@ <% -$class = "block block-files" +class_name = "block block-files" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <% unless @block.title.blank? && @block.template.description.blank? %> diff --git a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb index 1930887a150cc86d8c272c88c9b40751c2b36762..c392691021f29c9ce39d518c0ae3ccf97f55d52d 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb @@ -1,13 +1,13 @@ <% -$class = "block block-gallery" +class_name = "block block-gallery" if @block.title.present? - $class += " block-with-title" + class_name += " block-with-title" end -$class += " block-gallery--" + @block.template.layout +class_name += " block-gallery--" + @block.template.layout %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <% if @block.title.present? || @block.template.description.present? %> diff --git a/app/views/admin/communication/blocks/templates/image/_preview.html.erb b/app/views/admin/communication/blocks/templates/image/_preview.html.erb index cdb2997ed03d37cf8861f6581f40d0430957d78f..622c48b2622e888d83869233070bd71aeca2f71c 100644 --- a/app/views/admin/communication/blocks/templates/image/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/image/_preview.html.erb @@ -1,11 +1,11 @@ <% -$class = "block block-image" +class_name = "block block-image" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <% unless @block.title.blank? %> diff --git a/app/views/admin/communication/blocks/templates/key_figures/_preview.html.erb b/app/views/admin/communication/blocks/templates/key_figures/_preview.html.erb index 4ca7f51f60737fd74aff8d0b24c857cfe1225354..27615c8ef0dec5bbc05b650d4595453da39d95db 100644 --- a/app/views/admin/communication/blocks/templates/key_figures/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/key_figures/_preview.html.erb @@ -1,10 +1,10 @@ <% -$class = "block block-key_figures" +class_name = "block block-key_figures" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <% unless @block.title.blank? && @block.template.description.blank? %> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb index 54ee97c8f71c681e952276e524813a864cfd5129..7dae993fea68d01ee3438556aeb1026ab95a56c1 100644 --- a/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb @@ -1,34 +1,52 @@ -<div class="top"> - <div class="description"> - <%= block_component_preview :description %> - </div> -</div> - -<div class="persons"> - <% @block.template.elements.each do |element| - person = element.person - next if person.nil? - %> - <div> - <article class="person" itemscope itemtype="https://schema.org/Person"> - <div class="description"> - <h3 class="name" itemprop="name"> - <% if @block.template.with_link %> - <%= link_to person, [:admin, person] %> - <% else %> - <%= element.person %> - <% end %> - </h3> - <p itemprop="jobTitle"><%= element.role %></p> +<% +class_name = "block block-organization_chart" +unless @block.title.blank? + class_name += " block-with-title" +end +%> +<section class="<%= class_name %>"> + <div class="container"> + <div class="block-content"> + <% unless @block.title.blank? && @block.template.description.blank? %> + <div class="top"> + <% unless @block.title.blank? %> + <h2><%= @block.title %></h2> + <% end %> + <% unless @block.template.description.blank? %> + <div class="description"> + <p><%= block_component_preview :description %></p> + </div> + <% end %> </div> - <% if @block.template.with_photo %> - <div class="avatar" itemprop="image"> - <% if person.best_picture.attached? %> - <%= kamifusen_tag person.best_picture, class: 'img-fluid rounded-circle' %> + <% end %> + + <div class="persons"> + <% @block.template.elements.each do |element| + person = element.person + next if person.nil? + %> + <article class="person" itemscope itemtype="https://schema.org/Person"> + <div class="description"> + <h3 class="name" itemprop="name"> + <% if @block.template.with_link %> + <%= link_to person, [:admin, person] %> + <% else %> + <%= element.person %> + <% end %> + </h3> + <p itemprop="jobTitle"><%= element.role %></p> + </div> + <% if @block.template.with_photo %> + <div class="avatar" itemprop="image"> + <% if person.best_picture.attached? %> + <%= kamifusen_tag person.best_picture, class: 'img-fluid rounded-circle' %> + <% end %> + </div> <% end %> - </div> + </article> <% end %> - </article> + </div> + </div> - <% end %> -</div> \ No newline at end of file + </div> +</section> diff --git a/app/views/admin/communication/blocks/templates/pages/_preview.html.erb b/app/views/admin/communication/blocks/templates/pages/_preview.html.erb index 4f49735e43270a02a91cb66e0da9c775ef0f626e..42f0873509ba6bec96c72a782d8ebf2352379e5e 100644 --- a/app/views/admin/communication/blocks/templates/pages/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_preview.html.erb @@ -1,49 +1,60 @@ -<% if @block.data %> +<% +class_name = "block block-pages" +unless @block.title.blank? + class_name += " block-with-title" +end +class_name += " block-pages--" + @block.template.layout +%> +<section class="<%= class_name %>" style="display: none;"> + <div class="container"> + <div class="block-content"> + <% if @block.data %> + <% if @block.template.page %> + <%#= @block.template.page.slug %> + <% end %> + + <% if @block.template.show_main_description %> + <p></p> + <% end %> + + <% if @block.template.layout === "list" %> + + <ul> + <% @block.template.elements.each do |element| %> + <li> + <%#= element %> + </li> + <% end %> + </ul> + + <% elsif @block.template.layout === "cards" %> + + <div class="cards"> + <% @block.template.elements.each do |element| %> + <article class="card"> + <%# <%= element %> + <% if @block.template.show_description %> + <p><%#= element.summary %></p> + <% end %> + </article> + <% end %> + </div> + + <% else %> + + <div class="grid"> + <% @block.template.elements.each do |element| %> + <article> + <%# <%= element %> + <% if @block.template.show_description %> + <p><%#= element.summary %></p> + <% end %> + </article> + <% end %> + </div> + <% end %> -<% if @block.template.page %> - <%= @block.template.page.slug %> - <% end %> - - <% if @block.template.show_main_description %> - <p></p> - <% end %> - - <% if @block.template.layout === "list" %> - - <ul> - <% @block.template.elements.each do |element| %> - <li> - <%= element %> - </li> - <% end %> - </ul> - - <% elsif @block.template.layout === "cards" %> - - <div class="cards"> - <% @block.template.elements.each do |element| %> - <article class="card"> - <%= element %> - <% if @block.template.show_description %> - <p><%#= element.summary %></p> - <% end %> - </article> <% end %> </div> - - <% else %> - - <div class="grid"> - <% @block.template.elements.each do |element| %> - <article> - <%= element %> - <% if @block.template.show_description %> - <p><%#= element.summary %></p> - <% end %> - </article> - <% end %> - </div> - - <% end %> - -<% end %> + </div> +</section> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb index 6a226b15dd2672707d4e5ee35a4c08ff7b40619d..34110c536bb3e56c60530999f5c84ccf8a2941d0 100644 --- a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb @@ -1,24 +1,46 @@ -<div class="top"> - <div class="description"> - <%= block_component_preview :description %> - </div> -</div> +<% +class_name = "block block-partners" +unless @block.title.blank? + class_name += " block-with-title" +end +class_name += " block-partners--" + @block.template.layout +%> +<section class="<%= class_name %>"> + <div class="container"> + <div class="block-content"> -<div class="organizations"> - <% @block.template.elements.each do |element| %> - <article class="organization"> - <h3> - <% if element.best_url %> - <a href="<%= element.best_url %>" target="_blank"> - <% end %> - <%= element.best_name %> - <% if element.best_url%> - </a> + <% unless @block.title.blank? && @block.template.description.blank? %> + <div class="top"> + <% unless @block.title.blank? %> + <h2><%= @block.title %></h2> + <% end %> + <% unless @block.template.description.blank? %> + <div class="description"> + <p><%= block_component_preview :description %></p> + </div> + <% end %> + </div> + <% end %> + + <div class="grid organizations"> + <% @block.template.elements.each do |element| %> + <article class="organization"> + <h3> + <% if element.best_url %> + <a href="<%= element.best_url %>" target="_blank"> + <% end %> + <%= element.best_name %> + <% if element.best_url%> + </a> + <% end %> + </h3> + <div class="media"> + <%= kamifusen_tag element.best_logo, width: 600%> + </div> + </article> <% end %> - </h3> - <div class="media"> - <%= kamifusen_tag element.best_logo, width: 600%> </div> - </article> - <% end %> -</div> \ No newline at end of file + + </div> + </div> +</section> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/posts/_preview.html.erb b/app/views/admin/communication/blocks/templates/posts/_preview.html.erb index f6e2422c3e90fc4f2dc7ce0b8fd4735a47ee83ef..0d73386078540ecaa076a29d2db3ed8cbbeb7d8f 100644 --- a/app/views/admin/communication/blocks/templates/posts/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_preview.html.erb @@ -1,20 +1,38 @@ -<div class="posts"> - <% if @block.data %> - <% @block.template.selected_posts.each do |post| %> - <div> - <article class="post"> - <div> - <p class="title"><%= post %></p> - <p><%= post.summary %></p> - <time datetime="<%= post.published_at %>"><%= post.published_at.to_date %></time> - </div> - <% if post.best_featured_image.attached? %> - <div class="media"> - <%= kamifusen_tag post.best_featured_image %> - </div> +<% +$class = "block block-posts" +unless @block.title.blank? + $class += " block-with-title" +end +$class += " block-posts--" + @block.template.layout +%> +<section class="<%= $class %>"> + <div class="container"> + <div class="block-content"> + <% unless @block.title.blank? %> + <div class="top"> + <h2><%= @block.title %></h2> + </div> + <% end %> + <div class="list"> + <% if @block.data %> + <% @block.template.selected_posts.each do |post| %> + <article class="post" itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting"> + <div class="post-content"> + <a href="#"><%= post %></a> + <p itemprop="articleBody"><%= post.summary %></p> + </div> + <div class="post-meta"> + <time itemprop="datePublished" datetime="<%= post.published_at %>"><%= post.published_at.to_date %></time> + </div> + <% if post.best_featured_image.attached? %> + <div class="media"> + <%= kamifusen_tag post.best_featured_image %> + </div> + <% end %> + </article> <% end %> - </article> + <% end %> </div> - <% end %> - <% end %> -</div> + </div> + </div> +</section> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/programs/_preview.html.erb b/app/views/admin/communication/blocks/templates/programs/_preview.html.erb index 7b067c7450bf12bfa07765f21a6ef83f642e0295..adda2a10c96ddae8c77b783cac0f71414345269d 100644 --- a/app/views/admin/communication/blocks/templates/programs/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/programs/_preview.html.erb @@ -1,7 +1,19 @@ -<ol class="programs"> - <% @block.template.selected_programs.each do |program| %> - <li> - <%= program %></p> - </li> - <% end %> -</ol> +<% +$class = "block block-programs" +unless @block.title.blank? + $class += " block-with-title" +end +%> +<section class="<%= $class %>" style="display: none;"> + <div class="container"> + <div class="block-content"> + <ol class="programs"> + <% @block.template.selected_programs.each do |program| %> + <li> + <%= program %></p> + </li> + <% end %> + </ol> + </div> + </div> +</section> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb b/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb index ff8f7921a6131a2a9963d9a012c45f47fe15284b..acbde3057d1016f290d11505a273d7966dbe4fed 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb @@ -1,12 +1,12 @@ <% - $class = "block block-timeline" + class_name = "block block-timeline" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end - $class += " block-timeline--" + @block.template.layout + class_name += " block-timeline--" + @block.template.layout %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <% if @block.template.layout == "vertical" %> <div class="block-content"> diff --git a/app/views/admin/communication/blocks/templates/video/_preview.html.erb b/app/views/admin/communication/blocks/templates/video/_preview.html.erb index 62a19434c45d78bf9c6684524b477f0e404091a2..5876a6ccb8503c3bfff23607bad534040799b0d8 100644 --- a/app/views/admin/communication/blocks/templates/video/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/video/_preview.html.erb @@ -1,10 +1,10 @@ <% -$class = "block block-video" +class_name = "block block-video" unless @block.title.blank? - $class += " block-with-title" + class_name += " block-with-title" end %> -<section class="<%= $class %>"> +<section class="<%= class_name %>"> <div class="container"> <div class="block-content"> <% unless @block.title.blank? %>