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

better

parent efcd7b1f
No related branches found
No related tags found
No related merge requests found
class Communication::Block::Component::TimeSlot < Communication::Block::Component::Base
def from
data['from']
end
def to
data['to']
end
def present?
from && from != '0' && to && to != '0'
end
def blank?
!present?
end
def default_data
{
'from' => '0',
......
......@@ -2,7 +2,6 @@ module Communication::Website::WithStyle
extend ActiveSupport::Concern
def preview_style
return '' if url.blank?
load_style if style_outdated?
style
end
......@@ -14,6 +13,7 @@ module Communication::Website::WithStyle
load_style_from url
load_style_from "#{url}/fr" if @style.blank?
load_style_from "#{url}/en" if @style.blank?
load_style_from "https://example.osuny.org" if @style.blank?
substitute_fonts_urls_in_style!
self.update_columns style: @style,
style_updated_at: Date.today
......@@ -26,6 +26,7 @@ module Communication::Website::WithStyle
css_files.each do |css_url|
add_css_url_to_style css_url.to_s
end
rescue
end
def add_css_url_to_style(css_url)
......
<%= simple_format value %>
<% if component.present? %>
<%= component.from %><%= component.to %>
<% end %>
......@@ -2,9 +2,15 @@
<div class="col-md-6 col-xl-4">
<h3 class="h4"><%= t '.contacts' %></h3>
<%= block_component_edit :name %>
<%= block_component_edit :address %>
<%= block_component_edit :zipcode %>
<%= block_component_edit :city %>
<%= block_component_edit :address, rows: 1 %>
<div class="row">
<div class="col-md-4">
<%= block_component_edit :zipcode %>
</div>
<div class="col-md-8">
<%= block_component_edit :city %>
</div>
</div>
<%= block_component_edit :country %>
</div>
<div class="col-md-6 col-xl-8">
......
<p><%= block_component_preview :name %></p>
<div>
<%= block_component_preview :address %>
<%= block_component_preview :zipcode %>
<%= block_component_preview :city %>
<%= block_component_preview :country %>
</div>
<table class="table">
<% @block.template.elements.each do |element| %>
<tr>
<td><%= block_component_preview :title, template: element %></td>
<td><%= block_component_preview :time_slot_morning, template: element %></td>
<td><%= block_component_preview :time_slot_afternoon, template: element %></td>
</tr>
<% end %>
</table>
\ No newline at end of file
<hr>
<% @block.template.selected_programs.each do |program| %>
<p><%= program %></p>
<hr>
<% end %>
\ No newline at end of file
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