diff --git a/app/controllers/ad_banners_controller.rb b/app/controllers/ad_banners_controller.rb index bc7e926..287825e 100644 --- a/app/controllers/ad_banners_controller.rb +++ b/app/controllers/ad_banners_controller.rb @@ -13,7 +13,7 @@ class AdBannersController < ApplicationController def image_widget(adbanner) images = [] - adbanner.ad_images.can_display.each_with_index do |b,i| + adbanner.ad_images.can_display.desc(:created_at).each_with_index do |b,i| if b.language_enabled.include?(I18n.locale.to_s) image_link = OrbitHelper.is_mobile_view ? b.file.mobile.url : b.file.url klass = i == 0 ? "active" : "" diff --git a/app/views/admin/ad_banners/_index.html.erb b/app/views/admin/ad_banners/_index.html.erb index 70a75d6..74d0e11 100644 --- a/app/views/admin/ad_banners/_index.html.erb +++ b/app/views/admin/ad_banners/_index.html.erb @@ -240,7 +240,7 @@ data-cycle-timeout="5000" > <% if !banner.ad_images.can_display.blank? %> - <% banner.ad_images.can_display.each do |image| %> + <% banner.ad_images.can_display.desc(:created_at).each do |image| %> <% if image.exchange_item == '1' %>
<% elsif image.exchange_item == '2' %> @@ -300,7 +300,7 @@ <%= t("new_image") %> - <% banner.ad_images.each_with_index do |image,idx| %> + <% banner.ad_images.desc(:created_at).each_with_index do |image,idx| %>
<% if image.exchange_item == '1' %>
" style="background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;">