fix json & postdate

This commit is contained in:
nccu 2015-03-09 11:11:24 +08:00
parent c6cce8eb3e
commit 4c07156162
2 changed files with 7 additions and 3 deletions

View File

@ -22,6 +22,7 @@ class Admin::NewsbulletinsController < ApplicationController
bulletins = bulletins.where(:category_id.in => params[:categories]) if !params[:categories].blank?
bulletins = bulletins.where(:tagged_ids.in => params[:tags]) if !params[:tags].blank?
bulletins = bulletins.where(:is_preview.in=>[false,nil])
bulletins = bulletins.where(:approved.ne => false , :rejected.ne => true)
bulletins = bulletins.desc( :is_top, :postdate).page(page_num).per(per_page)
@ -82,6 +83,7 @@ class Admin::NewsbulletinsController < ApplicationController
bulletin_count = NewsBulletin.all
end
bulletin_count = bulletin_count.where(:is_preview.in=>[false,nil])
bulletin_count = bulletin_count.where(:approved.ne => false , :rejected.ne => true)
total_pages = bulletin_count.count
# End

View File

@ -334,9 +334,11 @@
var fileupload_size_limit = fileupload_size_limit_mb*1000*1000; // 1MB
$(function() {
var getDate = new Date();
var toDay = getDate.getFullYear()+"/"+ (getDate.getMonth()+1)+"/"+getDate.getDate()+" "+getDate.getHours()+":"+getDate.getMinutes();
$('input[name="news_bulletin[postdate]"]').val(toDay);
if (location.pathname.substr(-3)=='new'){
var getDate = new Date();
var toDay = getDate.getFullYear()+"/"+ (getDate.getMonth()+1)+"/"+getDate.getDate()+" "+getDate.getHours()+":"+getDate.getMinutes();
$('input[name="news_bulletin[postdate]"]').val(toDay);
}
$("#main-wrap").after("");