Changes suggested in PR:
* Delete all things related to banner images and styles (in code) * Add a new test to check that the banner is showing correctly * Update the specs accordingly to match the changes Update dev_seed to set a random background_color and a font_color for banners (and remove everything about image and style) Add a rake task to migrate the banner style to backgroun_color and font_color (so that the banners have the same colors than before)
This commit is contained in:
@@ -24,21 +24,13 @@ App.Banners =
|
||||
change: ->
|
||||
App.Banners.update_banner("#js-banner-description", $(this).val())
|
||||
|
||||
$("#banner_style").on
|
||||
change: ->
|
||||
App.Banners.update_style("#js-banner-style", $(this).val())
|
||||
|
||||
$("#banner_image").on
|
||||
change: ->
|
||||
App.Banners.update_style("#js-banner-image", $(this).val())
|
||||
|
||||
$("#banner_background_color_picker").on
|
||||
change: ->
|
||||
App.Banners.update_background_color("#js-banner-style", "#banner_background_color", $(this).val());
|
||||
App.Banners.update_background_color("#js-banner-background", "#banner_background_color", $(this).val());
|
||||
|
||||
$("#banner_background_color").on
|
||||
change: ->
|
||||
App.Banners.update_background_color("#js-banner-style", "#banner_background_color_picker", $(this).val());
|
||||
App.Banners.update_background_color("#js-banner-background", "#banner_background_color_picker", $(this).val());
|
||||
|
||||
$("#banner_font_color_picker").on
|
||||
change: ->
|
||||
|
||||
@@ -2,8 +2,6 @@ class Admin::BannersController < Admin::BaseController
|
||||
|
||||
has_filters %w{all with_active with_inactive}, only: :index
|
||||
|
||||
before_action :banner_styles, only: [:edit, :new, :create, :update]
|
||||
before_action :banner_imgs, only: [:edit, :new, :create, :update]
|
||||
before_action :banner_sections, only: [:edit, :new, :create, :update]
|
||||
|
||||
respond_to :html, :js
|
||||
@@ -39,7 +37,7 @@ class Admin::BannersController < Admin::BaseController
|
||||
private
|
||||
|
||||
def banner_params
|
||||
attributes = [:title, :description, :target_url, :style, :image,
|
||||
attributes = [:title, :description, :target_url,
|
||||
:post_started_at, :post_ended_at,
|
||||
:background_color, :font_color,
|
||||
web_section_ids: []]
|
||||
|
||||
@@ -77,12 +77,10 @@
|
||||
<%= f.submit(class: "button expanded", value: t("admin.banners.edit.form.submit_button")) %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="js-banner-style" class="<%= @banner.style %> banner" style="background-color:<%= @banner.background_color %>">
|
||||
<div id="js-banner-image" class="<%= @banner.image %>">
|
||||
<%= link_to @banner.target_url do %>
|
||||
<h2 id="js-banner-title" style="color:<%= @banner.font_color %>"><%= @banner.title %></h2>
|
||||
<h3 id="js-banner-description" style="color:<%= @banner.font_color %>"><%= @banner.description %></h3>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="js-banner-background" class="banner" style="background-color:<%= @banner.background_color %>">
|
||||
<%= link_to @banner.target_url do %>
|
||||
<h2 id="js-banner-title" style="color:<%= @banner.font_color %>"><%= @banner.title %></h2>
|
||||
<h3 id="js-banner-description" style="color:<%= @banner.font_color %>"><%= @banner.description %></h3>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -37,13 +37,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="<%= banner.style %> banner" style="background-color:<%= banner.background_color %>">
|
||||
<div class="<%= banner.image %>">
|
||||
<%= link_to banner.target_url do %>
|
||||
<h2 style="color:<%= banner.font_color %>"><%= banner.title %></h2>
|
||||
<h3 style="color:<%= banner.font_color %>"><%= banner.description %></h3>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="banner" style="background-color:<%= banner.background_color %>">
|
||||
<%= link_to banner.target_url do %>
|
||||
<h2 style="color:<%= banner.font_color %>"><%= banner.title %></h2>
|
||||
<h3 style="color:<%= banner.font_color %>"><%= banner.description %></h3>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<% banner = @banners.sample %>
|
||||
<div class="<%= banner.style %>">
|
||||
<div class="<%= banner.image %>">
|
||||
<%= link_to banner.target_url do %>
|
||||
<h2><%=banner.title %></h2>
|
||||
<h3><%=banner.description %></h3>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="banner" style="background-color:<%= banner.background_color %>">
|
||||
<%= link_to banner.target_url do %>
|
||||
<h2 style="color:<%= banner.font_color %>"><%=banner.title %></h2>
|
||||
<h3 style="color:<%= banner.font_color %>"><%=banner.description %></h3>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user