demo website widget

This commit is contained in:
unknown 2012-06-25 15:38:32 +08:00 committed by Christophe Vilayphiou
parent b6266284b4
commit 1d8e386bde
6 changed files with 20 additions and 25 deletions

View File

@ -28,10 +28,10 @@
</ul> </ul>
</li> </li>
<li class="search clear" title="<%= t :search_nccu %>"> <li class="search clear" title="<%= t :search_google %>">
<a class="orbit-bar-search" href="#">search</a> <a class="orbit-bar-search" href="#">search</a>
<form class="navbar-search" action=""> <form class="navbar-search" action="">
<input class="search-query span3" type="text" placeholder="<%= t(:search_nccu) %>"> <input class="search-query span3" type="text" placeholder="<%= t(:search_google) %>">
</form> </form>
</li> </li>
<% if user_signed_in? %> <% if user_signed_in? %>

View File

@ -37,7 +37,7 @@ en:
password: Password password: Password
register: Register register: Register
remember_me: Remember me remember_me: Remember me
search_nccu: Search NCCU search_google: Search Google
show: Show show: Show
submit: Submit submit: Submit
sure?: Are you sure? sure?: Are you sure?

View File

@ -31,7 +31,7 @@ zh_tw:
password: 密碼 password: 密碼
register: 註冊 register: 註冊
remember_me: 記住我 remember_me: 記住我
search_nccu: 搜尋政大 search_google: 搜尋Google
show: 顯示 show: 顯示
submit: 送出 submit: 送出
sure?: 您肯定嗎? sure?: 您肯定嗎?

View File

@ -8,7 +8,8 @@ defaults: &defaults
development: development:
<<: *defaults <<: *defaults
database: prototype_r4_development # database: prototype_r4_development
database: demo_site_development
test: test:
<<: *defaults <<: *defaults

View File

@ -12,14 +12,14 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController
@title = params[:part_title] @title = params[:part_title]
date_now = Time.now date_now = Time.now
if !params[:category_id].blank? if !params[:category_id].blank?
@bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(4)
@current_category = BulletinCategory.from_id(params[:category_id]) rescue nil @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
elsif !params[:tag_id].blank? elsif !params[:tag_id].blank?
@tag = AnnouncementTag.find(params[:tag_id]) rescue nil @tag = AnnouncementTag.find(params[:tag_id]) rescue nil
@tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag
@bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(4)
else else
@bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(10) @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(4)
end end
get_categorys get_categorys

View File

@ -2,24 +2,18 @@
<h1 class="h1"><%= @title %></h1> <h1 class="h1"><%= @title %></h1>
<% end %> <% end %>
<h2>News</h2>
<table class="table table-bordered"> <ul>
<tr>
<th><%= t('announcement.bulletin.category') %></th>
<th><%= t('announcement.bulletin.title') %></th>
<th><%= t('announcement.bulletin.postdate') %></th>
</tr>
<% @bulletins.each do |post| %> <% @bulletins.each do |post| %>
<tr>
<td><%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %></td>
<td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
</td>
<td><%= display_date_time(post.postdate) %></td>
</tr>
<% end %> <li>
<div class="pic"><%= image_tag(post.image.url, :size => "120x90") if post.image.file %></div>
<%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %>
<span class="date"><%= display_date(post.postdate) %></span>
</li>
</table> <% end %>
<%= paginate @bulletins, :params => {:inner => 'true'}, :remote => true %> </ul>