From cfe0fd9c5a612532fdc7ae294a2717f072633e17 Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Tue, 4 Jul 2023 14:30:03 +0800 Subject: [PATCH] Fix bug. --- app/views/admin/ad_banners/_index.html.erb | 12 ++- .../admin/ad_banners/_index_table.html.erb | 80 +++++++++++-------- 2 files changed, 55 insertions(+), 37 deletions(-) diff --git a/app/views/admin/ad_banners/_index.html.erb b/app/views/admin/ad_banners/_index.html.erb index 1e85718..02a4011 100644 --- a/app/views/admin/ad_banners/_index.html.erb +++ b/app/views/admin/ad_banners/_index.html.erb @@ -225,15 +225,21 @@ <% banner.ad_images.can_display.desc(:created_at).each do |image| %> <% if image.exchange_item == '1' %>
- <% elsif image.video_snapshot %> + <% elsif image.video_snapshot.present? %>
<% elsif image.exchange_item == '2' %>
<% end %> <% end %> <% else %> -
-
+ <% + width = banner.width + height = banner.height + width = 200 if width.blank? + height = 80 if height.blank? + %> +
+
<% end %> diff --git a/app/views/admin/ad_banners/_index_table.html.erb b/app/views/admin/ad_banners/_index_table.html.erb index 81ea2b3..7b6c300 100644 --- a/app/views/admin/ad_banners/_index_table.html.erb +++ b/app/views/admin/ad_banners/_index_table.html.erb @@ -1,10 +1,10 @@ <% content_for :page_specific_css do %> <% end %> @@ -18,43 +18,55 @@ <% user_has_rights = (current_user.is_admin? ? true : (current_user.is_manager?(@module_app) ? true : current_user.is_manager_with_role?(@module_app) ? true : false)) rescue false %> <% @banners.each do |banner| %> - - + - + - - + + + <% end %>
-
- <% if !banner.ad_images.can_display.blank? %> - <% banner.ad_images.can_display.desc(:created_at).each do |image| %> -
'); background-size: cover; background-position: center;">
- <% end %> - <% else %> -
-
- <% end %> +
+
+ <% if !banner.ad_images.can_display.blank? %> + <% banner.ad_images.can_display.desc(:created_at).each do |image| %> + <% if image.exchange_item == '1' %> +
+ <% elsif image.video_snapshot.present? %> +
+ <% elsif image.exchange_item == '2' %> +
+ <% end %> + <% end %> + <% else %> + <% + width = banner.width + height = banner.height + width = 200 if width.blank? + height = 80 if height.blank? + %> +
+
+ <% end %> -
-
- <%= banner.title rescue "" %> -
+
+
+ <%= banner.title rescue "" %> +
-
- <%= banner.category.title rescue "" %> -
+ <%= banner.category.title rescue "" %> +