Fix ad image date selector
This commit is contained in:
parent
c57ba305e9
commit
e7bb9ea86b
|
@ -19,6 +19,8 @@ class Admin::AdImagesController < ApplicationController
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@ad_image =AdImage.new
|
@ad_image =AdImage.new
|
||||||
|
@ad_image.post_date = Date.today
|
||||||
|
@ad_image.unpost_date = Date.today + 30
|
||||||
#render :action => 'new',:url=> {:ad_banner_id => params.has_key?(:ad_banner_id)? params[:ad_banner_id],nil}
|
#render :action => 'new',:url=> {:ad_banner_id => params.has_key?(:ad_banner_id)? params[:ad_banner_id],nil}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,12 @@ class AdImage
|
||||||
attr_reader :parse_post_date,:parse_unpost_date
|
attr_reader :parse_post_date,:parse_unpost_date
|
||||||
|
|
||||||
def parse_post_date=(att)
|
def parse_post_date=(att)
|
||||||
self.post_date = (Date.parse att rescue nil)
|
self.post_date = (Date.parse att.gsub(/\s+/, "") rescue nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def parse_unpost_date=(att)
|
def parse_unpost_date=(att)
|
||||||
self.unpost_date = (Date.parse att rescue nil)
|
self.unpost_date = (Date.parse att.gsub(/\s+/, "") rescue nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def display?
|
def display?
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
<div id="calendarRange">
|
<div id="calendarRange">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
<span class="showDate"></span><span class="add-on btn">▼</span>
|
<span class="showDate"></span><span class="add-on btn">▼</span>
|
||||||
<%= f.hidden_field :parse_post_date %>
|
<%= f.hidden_field :parse_post_date,:value => @ad_image.post_date.strftime('%Y / %m / %d') %>
|
||||||
<%= f.hidden_field :parse_unpost_date%>
|
<%= f.hidden_field :parse_unpost_date,:value => @ad_image.unpost_date.strftime('%Y / %m / %d')%>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="widgetCalendar">
|
<div id="widgetCalendar">
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<%= javascript_include_tag "bootstrap" %>
|
<%= javascript_include_tag "bootstrap" %>
|
||||||
<%= javascript_include_tag "inc/permission-checkbox" %>
|
<%#= javascript_include_tag "inc/permission-checkbox" %>
|
||||||
<%= javascript_include_tag "inc/search" %>
|
<%#= javascript_include_tag "inc/search" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
|
<%#= label_tag :fact_check_setting, t("announcement.bulletin.fact_check_setting") %>
|
||||||
<%= form_tag('', :remote => true) %>
|
<%= form_tag('', :remote => true) %>
|
||||||
|
|
Loading…
Reference in New Issue