added sort on created_at desc
This commit is contained in:
parent
1cf8011ca3
commit
4c1a1ec02f
|
@ -1,7 +1,7 @@
|
|||
class AdBannersController < ApplicationController
|
||||
def widget
|
||||
adbanner = Banner.find(OrbitHelper.widget_custom_value)
|
||||
images = adbanner.ad_images.can_display.collect.with_index do |b,i|
|
||||
images = adbanner.ad_images.can_display.desc(:created_at).collect.with_index do |b,i|
|
||||
image_link = OrbitHelper.is_mobile_view ? b.file.mobile.url : b.file.url
|
||||
klass = i == 0 ? "active" : ""
|
||||
caption = i == 0 ? '<div class="cycle-overlay"></div><div class="cycle-pager"></div>' : ""
|
||||
|
|
|
@ -222,7 +222,7 @@
|
|||
data-cycle-timeout="<%= banner.timeout.to_i*1000 %>"
|
||||
>
|
||||
<% 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| %>
|
||||
<div class="slide-img" style=" background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;"></div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
@ -283,7 +283,7 @@
|
|||
<a href="<%= new_admin_ad_image_path(banner: banner.id.to_s) %>" class="ad-image-new-btn">
|
||||
<i class="icon-plus"></i> <%= t("ad.new_image") %>
|
||||
</a>
|
||||
<% banner.ad_images.each_with_index do |image,idx| %>
|
||||
<% banner.ad_images.desc(:created_at).each_with_index do |image,idx| %>
|
||||
<div class="ad-banner-image-wrap">
|
||||
<div class="ad-banner-image <%= image.expired? ? "grayscale" : "" %>" style="background: url('<%= image.file.thumb.url %>'); background-size: cover; background-position: center;">
|
||||
<% if image.expired? %>
|
||||
|
|
Loading…
Reference in New Issue