2012-04-01 15:39:49 +00:00
|
|
|
<% content_for :page_specific_css do %>
|
|
|
|
<%= stylesheet_link_tag "lib/datepicker" %>
|
|
|
|
<% end %>
|
|
|
|
<% content_for :page_specific_javascript do %>
|
|
|
|
<%= javascript_include_tag "lib/datepicker" %>
|
2012-04-25 07:10:28 +00:00
|
|
|
<%= javascript_include_tag "lib/date.format.js" %>
|
2012-04-17 07:21:43 +00:00
|
|
|
<%= javascript_include_tag "inc/modal-preview" %>
|
2012-04-17 08:03:48 +00:00
|
|
|
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
2012-04-25 07:10:28 +00:00
|
|
|
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
2012-04-17 07:21:43 +00:00
|
|
|
|
2012-04-01 15:39:49 +00:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
|
|
<div id="poststuff">
|
|
|
|
<form class="clear">
|
|
|
|
<!--Widget start-->
|
|
|
|
<div id="sub-wiget">
|
|
|
|
<div id="widget-date" class="widget-box">
|
|
|
|
<div class="widget-action clear">
|
|
|
|
<a href="#" class="action"><i title="Set the announcement to start and end dates" class="icon-exclamation-sign icon-white tip"></i></a>
|
|
|
|
</div>
|
|
|
|
<h3 class="widget-title"><i class="icons-calendar icons-white"></i> Date</h3>
|
|
|
|
<div class="widget-content clear">
|
|
|
|
<div id="calendarRange">
|
|
|
|
<div class="input-append">
|
|
|
|
<span class="showDate"></span><span class="add-on btn">▼</span>
|
2012-04-23 10:20:12 +00:00
|
|
|
<%= f.hidden_field :parse_post_date,:value => @ad_image.post_date.strftime('%Y / %m / %d') %>
|
|
|
|
<%= f.hidden_field :parse_unpost_date,:value => @ad_image.unpost_date.strftime('%Y / %m / %d')%>
|
2012-04-01 15:39:49 +00:00
|
|
|
|
|
|
|
</div>
|
|
|
|
<div id="widgetCalendar">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var today = new Date();
|
|
|
|
today = today.format('isoDate');
|
|
|
|
var state = false;
|
|
|
|
var arr = state ? "▼" : "▲"
|
2012-04-13 07:24:59 +00:00
|
|
|
var start_date = <%= @ad_image.post_date.nil?? 'today' : "'#{@ad_image.post_date.strftime('%Y / %m / %d')}'" %>;
|
|
|
|
var end_date = <%= @ad_image.unpost_date.nil?? 'today' : "'#{@ad_image.unpost_date.strftime('%Y / %m / %d')}'" %>;
|
2012-04-01 15:39:49 +00:00
|
|
|
//calendarRange
|
2012-04-13 07:24:59 +00:00
|
|
|
$('#calendarRange .showDate').html(start_date+" - "+end_date);
|
2012-04-13 04:47:57 +00:00
|
|
|
$('#calendarRange .calendarInput').val(start_date+" - "+end_date);
|
2012-04-01 15:39:49 +00:00
|
|
|
$('#calendarRange #widgetCalendar').DatePicker({
|
|
|
|
flat: true,
|
|
|
|
format: 'Y / m / d',
|
2012-04-13 04:47:57 +00:00
|
|
|
date: [start_date,end_date],
|
2012-04-01 15:39:49 +00:00
|
|
|
calendars: 1,
|
|
|
|
mode: 'range',
|
|
|
|
starts: 1,
|
|
|
|
onChange: function(formated) {
|
|
|
|
$('#calendarRange .showDate').get(0).innerHTML = formated.join(' - ');
|
|
|
|
$('#calendarRange .calendarInput').val(formated.join(' - '));
|
|
|
|
start_date = formated[0].replace(/\s/g, "");
|
|
|
|
end_date = formated[1].replace(/\s/g, "");
|
|
|
|
$('#ad_image_parse_post_date').val(start_date);
|
|
|
|
$('#ad_image_parse_unpost_date').val(end_date);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$('#calendarRange .input-append').bind('click', function(){
|
|
|
|
var arr = state ? "▼" : "▲"
|
|
|
|
$('#calendarRange .add-on').html(arr);
|
|
|
|
$('#calendarRange #widgetCalendar').stop().animate({height: state ? 0 : $('#calendarRange #widgetCalendar div.datepicker').get(0).offsetHeight}, 500);
|
|
|
|
state = !state;
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
$('#calendarRange #widgetCalendar div.datepicker').css('position', 'absolute');
|
|
|
|
</script>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="widget-picture" class="widget-box">
|
|
|
|
<div class="widget-action clear">
|
|
|
|
<a class="action"><i title="Upload pictures" class="icon-exclamation-sign icon-white tip"></i></a>
|
|
|
|
</div>
|
|
|
|
<h3 class="widget-title"><i class="icons-picture icons-white"></i>Picture</h3>
|
|
|
|
<div class="widget-content clear">
|
2012-04-24 04:41:28 +00:00
|
|
|
<div class="control-group">
|
|
|
|
<div class="upload-picture">
|
|
|
|
<!--請程式務必將圖片尺寸加入到行內裡-->
|
|
|
|
<%= image_tag @ad_image.file rescue ''%>
|
|
|
|
</div>
|
2012-05-18 02:50:53 +00:00
|
|
|
<% if !@ad_image.ad_banner.best_size.empty?%>
|
2012-09-12 11:12:50 +00:00
|
|
|
<span class="alert widgetInfo"><%= t("ad.widget_info_for_ad_image_size",:best_size=> @ad_image.ad_banner.best_size) %>
|
2012-05-18 02:50:53 +00:00
|
|
|
</span>
|
|
|
|
<% end -%>
|
2012-04-24 04:41:28 +00:00
|
|
|
<div class="controls file-upload input-prepend">
|
|
|
|
<label class="control-label add-on btn" for="input-upload">
|
2012-04-25 08:26:27 +00:00
|
|
|
<%= t(:browse) %>
|
2012-04-24 04:41:28 +00:00
|
|
|
<%= f.file_field :file,:id=>"input-upload",:class => "upload", :onchange=> "document.getElementById('fu1').innerHTML = this.form.fu1.value = this.value;" %>
|
|
|
|
</label>
|
|
|
|
<span id="fu1" class="file-name"></span>
|
|
|
|
<br>
|
|
|
|
<input name="fu1" class="input-medium" type="text">
|
2012-04-01 15:39:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2012-04-24 04:41:28 +00:00
|
|
|
</div>
|
2012-04-01 15:39:49 +00:00
|
|
|
|
|
|
|
<div id="widget-type" class="widget-box">
|
|
|
|
<div class="widget-action clear">
|
|
|
|
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Upload pictures"></i></a>
|
|
|
|
</div>
|
|
|
|
<h3 class="widget-title"><i class="icons-star-thin icons-white"></i>Type</h3>
|
|
|
|
<div class="widget-content clear">
|
|
|
|
<%= f.select :link_open ,AdImage::LINK_OPEN_TYPES%>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="widget-time" class="widget-box widget-size-300">
|
|
|
|
<div class="widget-action clear">
|
|
|
|
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Set the range time"></i></a>
|
|
|
|
</div>
|
|
|
|
<h3 class="widget-title"><i class="icons-time icons-white"></i>FEQ</h3>
|
|
|
|
<div class="widget-content clear">
|
|
|
|
<%= f.text_field :weight ,:class=> 'span3',:placeholder=>"在套圖中出現次數 1次請輸入1" %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="widget-link" class="widget-box widget-size-300">
|
|
|
|
<div class="widget-action clear">
|
|
|
|
<a class="action"><i class="icon-exclamation-sign icon-white tip" data-original-title="Add a reference link"></i></a>
|
|
|
|
</div>
|
|
|
|
<h3 class="widget-title"><i class="icons-link icons-white"></i>Link</h3>
|
|
|
|
<div class="widget-content clear">
|
|
|
|
<%= f.text_field :out_link ,:class=> 'span3',:placeholder => "輸入連結"%>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!--Wiget End-->
|
|
|
|
<!--Post Start-->
|
|
|
|
<div id="post-body">
|
|
|
|
<div id="post-body-content" class="clear">
|
|
|
|
<ul class="nav nav-tabs">
|
2012-05-06 16:53:52 +00:00
|
|
|
<% @site_valid_locales.each do |locale|%>
|
|
|
|
<%= content_tag :li,link_to(I18nVariable.from_locale(locale),"##{locale}",:data=>{:toggle => "tab"}),:class=> (active_when_current_locale_eq locale) %>
|
2012-04-01 15:39:49 +00:00
|
|
|
<% end %>
|
|
|
|
</ul>
|
|
|
|
<div class="tab-content">
|
|
|
|
<%= select_tag 'ad_banner[id]',options_from_collection_for_select(AdBanner.all, "id", "title",params[:ad_banner_id]) , :class=>"input-medium", %>
|
2012-05-06 16:53:52 +00:00
|
|
|
<% @site_valid_locales.each do |locale|%>
|
|
|
|
<%= content_tag :div,:class => "tab-pane #{active_when_current_locale_eq locale}",:id=>"#{locale}" do%>
|
2012-04-01 15:39:49 +00:00
|
|
|
<div class="title">
|
2012-07-25 21:58:09 +00:00
|
|
|
<%= f.fields_for :title_translations do |f| %>
|
|
|
|
<%= f.text_field locale, :class=>"ad_image-title post-title", :placeholder => "輸入標題", :value => (@ad_image.title_translations[locale] rescue nil) %>
|
2012-04-01 15:39:49 +00:00
|
|
|
<% end %>
|
|
|
|
</div>
|
2012-04-19 03:50:54 +00:00
|
|
|
<br/>
|
2012-04-01 15:39:49 +00:00
|
|
|
<div class="context editor">
|
2012-07-25 21:58:09 +00:00
|
|
|
<%= f.fields_for :context_translations, @ad_image.context do |f| %>
|
|
|
|
<%= f.text_area locale, :style => "width:100%", :class => "tinymce_textarea post-title", :value => (@ad_image.context_translations[locale] rescue nil) %>
|
2012-04-01 15:39:49 +00:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
2012-04-19 03:50:54 +00:00
|
|
|
<div class="form-actions">
|
2012-04-25 10:03:30 +00:00
|
|
|
<%#= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(@ad_image.ad_banner.title) ,:class=>"preview_trigger btn btn-success" rescue nil%>
|
2012-04-24 03:35:50 +00:00
|
|
|
<%= f.submit t("submit"),:class=>"btn btn-primary" %>
|
|
|
|
<%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %>
|
2012-04-19 03:50:54 +00:00
|
|
|
</div>
|
2012-04-01 15:39:49 +00:00
|
|
|
</div>
|
|
|
|
<!--Post End-->
|
|
|
|
</form>
|
|
|
|
</div>
|