Fix remove failure and add version param for CDN cache
This commit is contained in:
parent
098a779200
commit
deae4ba059
|
|
@ -21,7 +21,7 @@ class AdBannersController < ApplicationController
|
|||
images = []
|
||||
adbanner.ad_images.can_display.order_by(is_top: -1, sort_number: 1, created_at: 1).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
|
||||
image_link = (OrbitHelper.is_mobile_view ? b.file.mobile.url : b.file.url) + "?v=#{b.updated_at.to_i}"
|
||||
klass = i == 0 ? "active" : ""
|
||||
caption = i == 0 ? '<div class="cycle-overlay"></div><div class="cycle-pager"></div>' : ""
|
||||
banner_title = b.title.to_s
|
||||
|
|
|
|||
|
|
@ -55,13 +55,13 @@
|
|||
<span class="label label-warning"><%= t(:top) %></span>
|
||||
<% end %>
|
||||
<% if image.exchange_item == "1" %>
|
||||
<%= image_tag image.file.thumb, :class => "banner-image" %>
|
||||
<%= image_tag "#{image.file.thumb.url}?v=#{image.updated_at.to_i}", :class => "banner-image" %>
|
||||
<% elsif image.exchange_item == "2" %>
|
||||
<iframe height="140" src="<%= image.embed_url %>"></iframe>
|
||||
<% elsif image.exchange_item == "3" %>
|
||||
<%
|
||||
video_snapshot_url = ""
|
||||
video_snapshot_url = image.video_snapshot.url if image.video_snapshot.file %>
|
||||
video_snapshot_url = "#{image.video_snapshot.url}?v=#{image.updated_at.to_i}" if image.video_snapshot.file %>
|
||||
<video width="320" height="240" controls poster="<%=video_snapshot_url%>">
|
||||
<source src="<%= image.video_file.url %>" type="video/mp4">
|
||||
Your browser does not support the video tag.
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @ad_image.file.file %>" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @ad_image.file.file %>
|
||||
<%= image_tag @ad_image.file.url %>
|
||||
<%= image_tag "#{@ad_image.file.url}?v=#{@ad_image.updated_at.to_i}" %>
|
||||
<% else %>
|
||||
<img src="https://via.placeholder.com/200x80/EFEFEF/AAAAAA&text=<%= @ad_banner.width %>x<%= @ad_banner.height %>" />
|
||||
<% end %>
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||||
<%= f.check_box :remove_file %><%= t(:remove) %>
|
||||
<%= f.check_box :remove_video_file %><%= t(:remove) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @ad_image.video_snapshot.file %>" data-provides="fileupload">
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if @ad_image.video_snapshot.file %>
|
||||
<%= image_tag @ad_image.video_snapshot.url %>
|
||||
<%= image_tag "#{@ad_image.video_snapshot.url}?v=#{@ad_image.updated_at.to_i}" %>
|
||||
<% else %>
|
||||
<img src="https://via.placeholder.com/200x80/EFEFEF/AAAAAA&text=<%= @ad_banner.width %>x<%= @ad_banner.height %>" />
|
||||
<% end %>
|
||||
|
|
@ -137,7 +137,7 @@
|
|||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||
<div class="controls" data-toggle="buttons-checkbox">
|
||||
<label class="checkbox inline btn btn-danger fileupload-remove">
|
||||
<%= f.check_box :remove_file %><%= t(:remove) %>
|
||||
<%= f.check_box :remove_video_snapshot %><%= t(:remove) %>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue