From d646a9dff1802070ee04349d97b77b3ae672a06b Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Fri, 13 Apr 2012 15:24:59 +0800 Subject: [PATCH 1/2] fix new ad_image data selector bug --- app/views/admin/ad_images/_form.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index c04246a8..1089db3b 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -32,10 +32,10 @@ today = today.format('isoDate'); var state = false; var arr = state ? "▼" : "▲" - var start_date = <%= "'#{@ad_image.post_date.strftime('%Y / %m / %d')}'"%> || today - var end_date = <%= "'#{@ad_image.unpost_date.strftime('%Y / %m / %d')}'"%> || today + 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')}'" %>; //calendarRange - $('#calendarRange .showDate').html(start_date+" - "+end_date) + $('#calendarRange .showDate').html(start_date+" - "+end_date); $('#calendarRange .calendarInput').val(start_date+" - "+end_date); $('#calendarRange #widgetCalendar').DatePicker({ flat: true, From ca0fc4c767bce96d249cc1f96156512f419d85a2 Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Fri, 13 Apr 2012 15:53:25 +0800 Subject: [PATCH 2/2] Comment out code that bugged upload image in ad_banner --- app/assets/javascripts/side_bar_history.js | 42 +++++++++---------- .../ad_banners/_ad_image_update.html.erb | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/assets/javascripts/side_bar_history.js b/app/assets/javascripts/side_bar_history.js index e9505aa1..4b5da1d4 100644 --- a/app/assets/javascripts/side_bar_history.js +++ b/app/assets/javascripts/side_bar_history.js @@ -1,28 +1,28 @@ var history_edited = false; -$('#back_sidebar a, #back_main a.nav').live('click', - function () { - $.getScript(this.href); - history.pushState(null, document.title, this.href); - history_edited = true; - return false; - } -); +// $('#back_sidebar a, #back_main a.nav').live('click', +// function () { +// $.getScript(this.href); +// history.pushState(null, document.title, this.href); +// history_edited = true; +// return false; +// } +// ); -$('#back_main a.reload').live('click', - function () { - $.getScript(this.href); - history.replaceState(null, document.title, this.href); - history_edited = true; - return false; - } -); +// $('#back_main a.reload').live('click', +// function () { +// $.getScript(this.href); +// history.replaceState(null, document.title, this.href); +// history_edited = true; +// return false; +// } +// ); -$('.form').live('submit', function () { - $.post(this.action, $(this).serialize(), null, 'script'); - history_edited = true; - return false; -}); +// $('.form').live('submit', function () { +// $.post(this.action, $(this).serialize(), null, 'script'); +// history_edited = true; +// return false; +// }); $(document).on('click', '.js_history', function () { diff --git a/app/views/admin/ad_banners/_ad_image_update.html.erb b/app/views/admin/ad_banners/_ad_image_update.html.erb index 366d370d..b2dfdc73 100644 --- a/app/views/admin/ad_banners/_ad_image_update.html.erb +++ b/app/views/admin/ad_banners/_ad_image_update.html.erb @@ -1,5 +1,5 @@
  • - <%= image_tag ad_image.file %> + <%= image_tag ad_image.file rescue nil %>

    <%= ad_image.display? ? '[Showing]' : '[NotShawing]' %> <%= "#{ad_image.post_date ||'NeedReset' }~#{ad_image.unpost_date || 'NeedReset'}" %>