From 7c44e94285928a0c4d5d7d77d696d12e3f73533d Mon Sep 17 00:00:00 2001 From: Christophe Vilayphiou Date: Wed, 23 May 2012 11:46:19 +0800 Subject: [PATCH 1/2] Order list by created_at desc Add best image size in news new --- app/controllers/orbit_backend_controller.rb | 2 +- config/locales/zh_tw.yml | 2 +- .../panel/announcement/back_end/bulletins_controller.rb | 2 ++ .../panel/announcement/back_end/bulletins/_form.html.erb | 2 +- .../panel/news/back_end/news_bulletins_controller.rb | 2 ++ .../views/panel/news/back_end/news_bulletins/_form.html.erb | 4 ++-- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index 339f7ede..28f99fa2 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -155,7 +155,7 @@ class OrbitBackendController< ApplicationController def get_viewable(object_class) - objects = get_objects(object_class) + objects = get_objects(object_class).order_by(:created_at, :desc) Kaminari.paginate_array(objects).page(params[:page]).per(10) end diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index e9de6f11..ea0264b7 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -36,7 +36,7 @@ zh_tw: submit: 送出 sure?: 您肯定嗎? update: 更新 - update: 更新失敗 + update_failed: 更新失敗 view: 檢視 view_count: 查看次數 yes_: "Yes" diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index b6566b7e..c7d46eb2 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -135,6 +135,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController else @bulletin = Bulletin.new(params[:bulletin]) + @bulletin.deadline = nil if @bulletin.deadline < @bulletin.postdate @bulletin.create_user_id = current_user.id @bulletin.update_user_id = current_user.id @@ -243,6 +244,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController else @bulletin = Bulletin.find(params[:id]) + @bulletin.deadline = nil if @bulletin.deadline < @bulletin.postdate @bulletin.update_user_id = current_user.id diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 05247251..c515dc65 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -15,7 +15,7 @@
<% if @bulletin.image %> - <%= image_tag @bulletin.image, :width=> "456", :height=>'700' rescue ''%> + <%= image_tag @bulletin.image rescue ''%> <% else %> <% end %> diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb index 46bd2f02..b725da6d 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb @@ -136,6 +136,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController else @news_bulletin = NewsBulletin.new(params[:news_bulletin]) + @news_bulletin.deadline = nil if @news_bulletin.deadline < @news_bulletin.postdate @news_bulletin.create_user_id = current_user.id @news_bulletin.update_user_id = current_user.id @@ -244,6 +245,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController else @news_bulletin = NewsBulletin.find(params[:id]) + @news_bulletin.deadline = nil if @news_bulletin.deadline < @news_bulletin.postdate @news_bulletin.update_user_id = current_user.id diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb index 38c2db31..eb2a2d95 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb @@ -15,11 +15,10 @@
<% if @news_bulletin.image %> - <%= image_tag @news_bulletin.image, :width=> "456", :height=>'700' rescue ''%> + <%= image_tag @news_bulletin.image rescue ''%> <% else %> <% end %> -