fix json & postdate

This commit is contained in:
nccu 2015-03-09 11:10:23 +08:00
parent 15d1d867bf
commit aeb3fb3fdb
2 changed files with 8 additions and 3 deletions

View File

@ -22,6 +22,7 @@ class Admin::BulletinsController < 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::BulletinsController < ApplicationController
bulletin_count = Bulletin.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

@ -226,10 +226,13 @@
<% content_for :page_specific_javascript do %>
<script>
$(function() {
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="bulletin[postdate]"]').val(toDay);
}
$("#main-wrap").after("");