Change date picker
This commit is contained in:
1 parent
5b13c53ed9
commit
fac4faad6c
12 files changed
+1534
-61
No files matched your search
@@ -1,13 +1,7 @@
|
||||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "lib/datepicker" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/datepicker" %>
|
||||
<%= javascript_include_tag "lib/date.format.js" %>
|
||||
<%= javascript_include_tag "inc/modal-preview" %>
|
||||
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
|
||||
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
|
||||
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -21,51 +15,8 @@
|
||||
</div>
|
||||
<h3 class="widget-title"><i class="icons-calendar"></i><%= t(:date_) %></h3>
|
||||
<div class="widget-content clear">
|
||||
<div id="calendarRange">
|
||||
<div class="input-append">
|
||||
<span class="showDate"></span><span class="add-on btn">▼</span>
|
||||
<%= 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')%>
|
||||
|
||||
</div>
|
||||
<div id="widgetCalendar">
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var today = new Date();
|
||||
today = today.format('isoDate');
|
||||
var state = false;
|
||||
var arr = state ? "▼" : "▲"
|
||||
var start_date = <%= (@ad_image.post_date.nil?? 'today' : "'#{@ad_image.post_date.strftime('%Y / %m / %d')}'").html_safe %>;
|
||||
var end_date = <%= (@ad_image.unpost_date.nil?? 'today' : "'#{@ad_image.unpost_date.strftime('%Y / %m / %d')}'").html_safe %>;
|
||||
//calendarRange
|
||||
$('#calendarRange .showDate').html(start_date+" - "+end_date);
|
||||
$('#calendarRange .calendarInput').val(start_date+" - "+end_date);
|
||||
$('#calendarRange #widgetCalendar').DatePicker({
|
||||
flat: true,
|
||||
format: 'Y / m / d',
|
||||
date: [start_date,end_date],
|
||||
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>
|
||||
<%= f.datetime_picker :post_date, :picker_type => 'date', :label => t(:start_date) %>
|
||||
<%= f.datetime_picker :unpost_date, :picker_type => 'date', :label => t(:end_date) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user