added base image selection for the height
This commit is contained in:
parent
495e1c14db
commit
1cf8011ca3
|
@ -34,6 +34,7 @@ class AdBannersController < ApplicationController
|
|||
"title" => adbanner.title,
|
||||
"banner-height" => adbanner.height,
|
||||
"banner-width" => adbanner.width,
|
||||
"base_image" => (adbanner.base_image - 1),
|
||||
"timeout" => (adbanner.timeout * 1000),
|
||||
"more" => "More"
|
||||
},
|
||||
|
|
|
@ -10,6 +10,7 @@ class Banner
|
|||
field :title, type: String
|
||||
field :timeout, type: Integer, default: 5
|
||||
field :width, type: Integer
|
||||
field :base_image, type: Integer, default: 1
|
||||
|
||||
has_many :ad_images , dependent: :delete
|
||||
|
||||
|
@ -32,6 +33,6 @@ class Banner
|
|||
end
|
||||
|
||||
def data_attribute_hash
|
||||
{'width'=> self.width,'height'=> self.height,'ad_fx'=> self.ad_fx,'name'=>self.title,'timeout'=>self.timeout,'speed'=>self.speed}.to_json
|
||||
{'width'=> self.width,'height'=> self.height,'ad_fx'=> self.ad_fx,'name'=>self.title,'timeout'=>self.timeout,'speed'=>self.speed, 'base_image' => self.base_image}.to_json
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,10 +14,8 @@
|
|||
<span class="help-block"><%= t('ad_banner.number_milliseconds') %></span>
|
||||
|
||||
<%= f.label :size, t('ad_banner.size') %>
|
||||
<span class="banner_set">W:</span>
|
||||
<%= f.number_field :width, in: 10..3000, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;", id: 'width' %>
|
||||
<span class="banner_set">H:</span>
|
||||
<%= f.number_field :height, in: 10..3000, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;", id: 'height' %>
|
||||
<span class="banner_set">Base Image:</span>
|
||||
<%= f.number_field :base_image, in: 1..1, class: 'input-mini', onkeypress: "if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;", id: 'base_image' %>
|
||||
|
||||
<%= f.label :category_id, t('ad_banner.categories') %>
|
||||
<%= f.select :category_id, @categories, {} %>
|
||||
|
|
|
@ -237,7 +237,8 @@
|
|||
<a data-title="<%= t("ad_banner.setting") %>"
|
||||
data-id="<%= banner.id.to_s %>"
|
||||
data-fx="<%= banner.ad_fx %>"
|
||||
data-form="<%= banner.data_attribute_hash.to_s %>"
|
||||
data-form="<%= banner.data_attribute_hash.to_s %>"
|
||||
data-max="<%= (banner.ad_images.blank? ? "1" : banner.ad_images.count) %>"
|
||||
class="open-slide"
|
||||
href="#">
|
||||
<div class="ad-banner-edit-btn">
|
||||
|
|
|
@ -43,4 +43,12 @@
|
|||
</div>
|
||||
|
||||
<% end %>
|
||||
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
|
||||
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$.pageslide.openCallback(function(form,element){
|
||||
form.find("#base_image").attr("max",element.data("max"));
|
||||
})
|
||||
})
|
||||
</script>
|
Loading…
Reference in New Issue