From db571d2c6593aee832112b1728255967621d4413 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 25 Jun 2012 15:38:32 +0800 Subject: [PATCH] demo website widget --- app/views/layouts/_orbit_bar.html.erb | 4 +-- config/locales/en.yml | 2 +- config/locales/zh_tw.yml | 2 +- config/mongoid.yml | 3 +- .../widget/bulletins_controller.rb | 6 ++-- .../widget/bulletins/_index.html.erb | 28 ++++++++----------- 6 files changed, 20 insertions(+), 25 deletions(-) diff --git a/app/views/layouts/_orbit_bar.html.erb b/app/views/layouts/_orbit_bar.html.erb index 23085046..02184edd 100644 --- a/app/views/layouts/_orbit_bar.html.erb +++ b/app/views/layouts/_orbit_bar.html.erb @@ -28,10 +28,10 @@ - <% if user_signed_in? %> diff --git a/config/locales/en.yml b/config/locales/en.yml index cb638475..05ad2969 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -37,7 +37,7 @@ en: password: Password register: Register remember_me: Remember me - search_nccu: Search NCCU + search_google: Search Google show: Show submit: Submit sure?: Are you sure? diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index ea0264b7..0306e5c4 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -31,7 +31,7 @@ zh_tw: password: 密碼 register: 註冊 remember_me: 記住我 - search_nccu: 搜尋政大 + search_google: 搜尋Google show: 顯示 submit: 送出 sure?: 您肯定嗎? diff --git a/config/mongoid.yml b/config/mongoid.yml index f333e2e6..fb792d6b 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -8,7 +8,8 @@ defaults: &defaults development: <<: *defaults - database: prototype_r4_development + # database: prototype_r4_development + database: demo_site_development test: <<: *defaults diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index 316a715b..299dcec9 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -12,14 +12,14 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController @title = params[:part_title] date_now = Time.now 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 elsif !params[:tag_id].blank? @tag = AnnouncementTag.find(params[:tag_id]) rescue nil @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 - @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 get_categorys diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb index 450e7617..12eec699 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/widget/bulletins/_index.html.erb @@ -2,24 +2,18 @@

<%= @title %>

<% end %> +

News

- - - - - - + - - - - - -<% end %> + <% @bulletins.each do |post| %> -
<%= t('announcement.bulletin.category') %><%= t('announcement.bulletin.title') %><%= t('announcement.bulletin.postdate') %>
<%= post.bulletin_category.i18n_variable[I18n.locale] rescue nil %><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> - <%= display_date_time(post.postdate) %>
+
  • +
    <%= image_tag(post.image.url, :size => "120x90") if post.image.file %>
    + <%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post, :category_id => post.bulletin_category_id) %> + <%= display_date(post.postdate) %> +
  • -<%= paginate @bulletins, :params => {:inner => 'true'}, :remote => true %> \ No newline at end of file + <% end %> + + \ No newline at end of file