diff --git a/app/models/communication/website/with_style.rb b/app/models/communication/website/with_style.rb index 831c7c4c7565df33a653861b750b0416f205882e..b4591010d96605320df7aa64f668aa35c230d3d7 100644 --- a/app/models/communication/website/with_style.rb +++ b/app/models/communication/website/with_style.rb @@ -2,11 +2,15 @@ module Communication::Website::WithStyle extend ActiveSupport::Concern def preview_style - return '' if url.blank? + return '' unless has_style? load_style if style_outdated? style end + def has_style? + !url.blank? + end + protected def load_style diff --git a/app/views/admin/layouts/preview.html.erb b/app/views/admin/layouts/preview.html.erb index 791854a7d1449b14f88d8accfbda64a904f7c50d..fb153506c8c2df22335b0ee815d402c437a7a391 100644 --- a/app/views/admin/layouts/preview.html.erb +++ b/app/views/admin/layouts/preview.html.erb @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title><%= yield :title %></title> - <% if @website %> + <% if @website && @website.has_style? %> <link rel="stylesheet" media="all" href="<%= style_admin_communication_website_path @website.id, website_id: nil %>" /> <% else %> <%= stylesheet_link_tag 'admin', media: 'all' %>