Skip to content
Snippets Groups Projects
Commit 0fbcd4d2 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

Close #431

parent fc89c0ed
No related branches found
No related tags found
No related merge requests found
...@@ -78,6 +78,10 @@ class Communication::Block < ApplicationRecord ...@@ -78,6 +78,10 @@ class Communication::Block < ApplicationRecord
@template ||= "Communication::Block::Template::#{template_kind.classify}".constantize.new self @template ||= "Communication::Block::Template::#{template_kind.classify}".constantize.new self
end end
def template_reset!
@template = nil
end
def to_s def to_s
title.blank? ? "Block #{position}" title.blank? ? "Block #{position}"
: "#{title}" : "#{title}"
......
...@@ -22,6 +22,10 @@ class Communication::Block::Template ...@@ -22,6 +22,10 @@ class Communication::Block::Template
[] []
end end
def excluded_for?(about)
about.class.in? exclude_for
end
protected protected
def build_git_dependencies def build_git_dependencies
...@@ -64,6 +68,10 @@ class Communication::Block::Template ...@@ -64,6 +68,10 @@ class Communication::Block::Template
: [] : []
end end
def exclude_for
[]
end
def university def university
block.university block.university
end end
......
...@@ -41,6 +41,10 @@ class Communication::Block::Template::Page < Communication::Block::Template ...@@ -41,6 +41,10 @@ class Communication::Block::Template::Page < Communication::Block::Template
protected protected
def exclude_for
[Education::Program]
end
def kind def kind
@kind ||= data['kind'] || 'selection' @kind ||= data['kind'] || 'selection'
end end
......
...@@ -24,6 +24,10 @@ class Communication::Block::Template::Post < Communication::Block::Template ...@@ -24,6 +24,10 @@ class Communication::Block::Template::Post < Communication::Block::Template
protected protected
def exclude_for
[Education::Program]
end
def kind def kind
@kind ||= data['kind'] || 'all' @kind ||= data['kind'] || 'all'
end end
......
...@@ -14,7 +14,13 @@ ...@@ -14,7 +14,13 @@
<hr> <hr>
<div class="row"> <div class="row">
<% kinds.each do |kind| %> <% kinds.each do |kind| %>
<% @block.template_kind = kind %> <%
@block.template_reset!
@block.template_kind = kind
about = @block.about
template = @block.template
%>
<% next if template.excluded_for?(about) %>
<div class="col-xxl-2 col-lg-3 col-md-4 d-flex"> <div class="col-xxl-2 col-lg-3 col-md-4 d-flex">
<div class="card flex-fill"> <div class="card flex-fill">
<%= image_tag "communication/blocks/templates/#{kind}.jpg", alt: '', class:"card-img-top" %> <%= image_tag "communication/blocks/templates/#{kind}.jpg", alt: '', class:"card-img-top" %>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment