267 lines
10 KiB
Plaintext
267 lines
10 KiB
Plaintext
<% content_for :page_specific_css do %>
|
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
|
<%= stylesheet_link_tag "lib/fileupload" %>
|
|
<%= stylesheet_link_tag "ad_banner/jplayer.blue.monday.min" %>
|
|
<% end %>
|
|
<% content_for :page_specific_javascript do %>
|
|
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
|
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
|
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
|
<%= javascript_include_tag "lib/module-area" %>
|
|
<%= javascript_include_tag "validator" %>
|
|
<%= javascript_include_tag "ad_banner/jquery.jplayer.min" %>
|
|
<% end %>
|
|
<style type="text/css">
|
|
.fileupload .video-thumbnail{
|
|
max-height: none;
|
|
display: inline-block;
|
|
width: 30em;
|
|
height: 20em;
|
|
}
|
|
</style>
|
|
<%#= f.error_messages %>
|
|
|
|
<!-- Input Area -->
|
|
<div class="input-area">
|
|
|
|
<!-- Module -->
|
|
<div class="tab-content">
|
|
|
|
<!-- Basic Module -->
|
|
<div class="tab-pane fade in active" id="basic">
|
|
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:type) %></label>
|
|
<div class="controls">
|
|
<div><%= t("choose_type") %></div>
|
|
<%=
|
|
select_tag "ad_image[exchange_item]", options_for_select(@item,@item_choose), prompt: t('select')
|
|
%>
|
|
</div>
|
|
</div>
|
|
|
|
<input type="hidden" name="ad_image[banner_id]" value="<%= @ad_banner.id.to_s %>">
|
|
|
|
<div id="exchange_item_1" style="display:none">
|
|
<!-- Images Upload -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:image) %></label>
|
|
<div class="controls">
|
|
<div><%= t("ad_banner.best_size") %>: <%= @ad_banner.width %>px X <%= @ad_banner.height %>px</div>
|
|
<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 %>
|
|
<% else %>
|
|
<img src="http://www.placehold.it/200x80/EFEFEF/AAAAAA&text=<%= @ad_banner.width %>x<%= @ad_banner.height %>" />
|
|
<% end %>
|
|
</div>
|
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
|
<span class="btn btn-file">
|
|
<span class="fileupload-new"><%= t(:select_image) %></span>
|
|
<span class="fileupload-exists"><%= t(:change) %></span>
|
|
<%= f.file_field :file, accept: "image/*" %>
|
|
</span>
|
|
<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) %>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="exchange_item_2" style="display:none">
|
|
<div class="control-group input-title">
|
|
<label class="control-label muted"><%= t(:youtube) %></label>
|
|
<div class="controls">
|
|
<div><%= 'ex. https://www.youtube.com/watch?v=UHF2e3lyPVU' %></div>
|
|
<%= f.text_field :youtube, placeholder: t(:youtube), class: 'input-block-level' %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="exchange_item_3" style="display:none">
|
|
<!-- Images Upload -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:video) %></label>
|
|
<div class="controls">
|
|
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @ad_image.file.file %>" data-provides="fileupload">
|
|
<div class="fileupload-new video-thumbnail thumbnail pull-left">
|
|
<%= render partial: "jplayer",locals:{i: 1,file_name: f.object["video_file"],file_url: f.object.video_file.url,not_ready: true } %>
|
|
</div>
|
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
|
<span class="btn btn-file">
|
|
<span class="fileupload-new"><%= t("ad_banner.select_video") %></span>
|
|
<span class="fileupload-exists"><%= t(:change) %></span>
|
|
<%= f.file_field :video_file, accept: "video/mp4,video/x-m4v,video/ogg,video/webm" %>
|
|
</span>
|
|
<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) %>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Title-->
|
|
<div class="control-group">
|
|
<label for="first_name" class="control-label muted" function="field_label"><%= t("title")%></label>
|
|
<div class="controls add-input">
|
|
<div class="input-append">
|
|
<div class="tab-content">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="title_<%= locale %>">
|
|
<%= f.fields_for :title_translations do |f| %>
|
|
<%= f.text_field locale, :value => (@ad_image.title_translations[locale] rescue nil), :placeholder=>"#{t(locale.to_s)+t("title")}" %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="btn-group" data-toggle="buttons-radio">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#title_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Date Time Picker -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:start_date) %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :postdate, :no_label => true, :new_record => @ad_image.new_record? %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Date Time Picker -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:end_date) %></label>
|
|
<div class="controls">
|
|
<%= f.datetime_picker :deadline, :no_label => true, :new_record => @ad_image.new_record? %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Link -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:link) %></label>
|
|
<div class="controls">
|
|
<%= f.text_field :out_link, placeholder: t('ad_banner.enter_url') %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t('ad_banner.type') %></label>
|
|
<div class="controls">
|
|
<%= f.select :link_open, AdImage::LINK_OPEN_TYPES.map{|a| [t("ad_banner.#{a}"), a]} %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- language-selection -->
|
|
<div class="control-group">
|
|
<label class="control-label muted"><%= t(:select_language) %></label>
|
|
<div class="controls">
|
|
<% @site_in_use_locales.each do |locale| %>
|
|
<label class="checkbox">
|
|
<%= check_box_tag "ad_image[language_enabled][]", locale, (@ad_image.language_enabled.include?(locale.to_s) rescue false) %>
|
|
<%= t(locale.to_s) %>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Language Tabs -->
|
|
<ul class="nav nav-pills language-nav">
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
<li class="<%= 'active' if i == 0 %>">
|
|
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale.to_s) %></a>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
<!-- Language -->
|
|
<div class="tab-content language-area">
|
|
|
|
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
|
|
|
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
|
|
|
<!-- Content -->
|
|
<div class="control-group input-content">
|
|
<label class="control-label muted"><%= t(:description) %> (<%= t(locale.to_s) %>)</label>
|
|
<div class="controls">
|
|
<div class="textarea">
|
|
<%= f.fields_for :context_translations do |f| %>
|
|
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@ad_image.context_translations[locale] rescue nil) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Form Actions -->
|
|
<div class="form-actions">
|
|
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var form = new FormValidator($("#new_ad_image"));
|
|
$("div#exchange_item_" + $("#ad_image_exchange_item").val()).show();
|
|
$("#ad_image_exchange_item").on("change",function(){
|
|
$("div[id*=exchange_item]").hide();
|
|
$("div#exchange_item_" + $(this).val()).show();
|
|
})
|
|
function checkSelect()
|
|
{
|
|
if(document.getElementById("ad_image_exchange_item").value == "")
|
|
{
|
|
alert("<%= t('ad_banner.please_choose_exchange_item') %>");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
$(document).ready(function(){
|
|
jplayer_ready_func();
|
|
$('#ad_image_video_file').change(function(){
|
|
var file = this.files ? this.files[0] : null;
|
|
var value = this.value;
|
|
if(file || value){
|
|
var file_name = file ? file.name : value.split(/[\/\\]/).last();
|
|
var type = get_video_type(file_name);
|
|
var file_url = window.URL ? window.URL.createObjectURL(file) : "file://"+ value;
|
|
$("#jquery_jplayer_1").parents('.fileupload-new').css('display','');
|
|
$("#jquery_jplayer_1").jPlayer('destroy');
|
|
jPlayer_1_data["title"] = file_name;
|
|
jPlayer_1_data[type] = file_url;
|
|
$("#jquery_jplayer_1").jPlayer(jPlayer_1);
|
|
}
|
|
})
|
|
$('#exchange_item_3 [data-dismiss="fileupload"]').on("click",function(){
|
|
$("#jquery_jplayer_1").parents('.fileupload-new').css('display','none');
|
|
})
|
|
})
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|