From ccc9e9c98ed12c401bb6543b7545c5ce87177598 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Tue, 17 Dec 2019 01:51:15 -0800 Subject: [PATCH] Try 3 for the image background --- app/views/conferences/_header.haml | 2 +- app/views/conferences/show.html.haml | 37 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/views/conferences/_header.haml b/app/views/conferences/_header.haml index 85c430e1..dbf4de08 100644 --- a/app/views/conferences/_header.haml +++ b/app/views/conferences/_header.haml @@ -1,5 +1,5 @@ - cache [conference, venue, '#splash#header'] do - #banner(style: "background_image: url('#{conference.picture_url})'") + #banner .container .row .col-md-8.col-md-offset-2#header diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index becddfb8..883b75d2 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -64,21 +64,22 @@ = render 'social_media', contact: @conference.contact = render 'footer' ) --# - content_for :script_head do --# :javascript --# var triangle_tcs = tinycolor("#{h(@conference.color)}").monochromatic(); --# var triangle_colors = triangle_tcs.map(function(t) { --# return t.toHexString(); --# }); --# $(function () { --# $(document).ready(function() { --# var triangle_width = document.body.clientWidth; --# var triangle_height = ($( "#banner" ).height() + 200 ); --# var pattern = Trianglify({ width: triangle_width, --# height: triangle_height, --# cell_size: 100, --# x_colors: triangle_colors --# }); --# $('#banner').css('background-image', 'url("' + pattern.png() + '")'); --# }); --# }); + +- content_for :script_head do + :javascript + var triangle_tcs = tinycolor("#{h(@conference.color)}").monochromatic(); + var triangle_colors = triangle_tcs.map(function(t) { + return t.toHexString(); + }); + $(function () { + $(document).ready(function() { + var triangle_width = document.body.clientWidth; + var triangle_height = ($( "#banner" ).height() + 200 ); + var pattern = Trianglify({ width: triangle_width, + height: triangle_height, + cell_size: 100, + x_colors: triangle_colors + }); + $('#banner').css('background-image', "'url(\"#{@conference.picture_url\")'"); + }); + });