From b5cda21304d8f0b38ddfd443d72837b0b422f3be Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 16 Nov 2015 17:53:54 +0800 Subject: [PATCH] sort added on created at desc --- app/controllers/ad_banners_controller.rb | 2 +- app/views/admin/ad_banners/_index.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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;">