diff --git a/app/assets/javascripts/banners.js b/app/assets/javascripts/banners.js index 9ae732ee4..583015a89 100644 --- a/app/assets/javascripts/banners.js +++ b/app/assets/javascripts/banners.js @@ -4,23 +4,23 @@ initialize: function() { $("[data-js-banner-title]").on({ change: function() { - $("#js-banner-title").text($(this).val()); + $(".banner h2").text($(this).val()); } }); $("[data-js-banner-description]").on({ change: function() { - $("#js-banner-description").text($(this).val()); + $(".banner h3").text($(this).val()); } }); $("[name='banner[background_color]']").on({ change: function() { - $("#js-banner-background").css("background-color", $(this).val()); + $(".banner").css("background-color", $(this).val()); } }); $("[name='banner[font_color]']").on({ change: function() { - $("#js-banner-title").css("color", $(this).val()); - $("#js-banner-description").css("color", $(this).val()); + $(".banner h2").css("color", $(this).val()); + $(".banner h3").css("color", $(this).val()); } }); } diff --git a/app/views/admin/banners/_form.html.erb b/app/views/admin/banners/_form.html.erb index a3589c90e..bf8fc89b7 100644 --- a/app/views/admin/banners/_form.html.erb +++ b/app/views/admin/banners/_form.html.erb @@ -84,15 +84,9 @@
<%= f.submit(class: "button expanded", value: t("admin.banners.edit.form.submit_button")) %>
+ - +
+ <%= render "shared/banner", banner: @banner %>
<% end %> diff --git a/app/views/admin/banners/index.html.erb b/app/views/admin/banners/index.html.erb index a466c6b7f..4b3e97230 100644 --- a/app/views/admin/banners/index.html.erb +++ b/app/views/admin/banners/index.html.erb @@ -35,12 +35,7 @@ <%= t("admin.banners.index.preview") %> - + <%= render "shared/banner", banner: banner %> diff --git a/app/views/shared/_banner.html.erb b/app/views/shared/_banner.html.erb index 3a632b20b..48f315a94 100644 --- a/app/views/shared/_banner.html.erb +++ b/app/views/shared/_banner.html.erb @@ -1,4 +1,4 @@ -<% banner = @banners.sample %> +<% banner ||= @banners.sample %>