From 696046f792e2a0f302a345730bdacd9fd6094ba2 Mon Sep 17 00:00:00 2001 From: nccu Date: Tue, 23 Dec 2014 14:51:10 +0800 Subject: [PATCH] fix languages for title --- .../admin/announcements_controller.rb | 2 +- app/views/admin/announcements/_index.html.erb | 24 ++++--------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/app/controllers/admin/announcements_controller.rb b/app/controllers/admin/announcements_controller.rb index a28265f..14006c0 100644 --- a/app/controllers/admin/announcements_controller.rb +++ b/app/controllers/admin/announcements_controller.rb @@ -28,7 +28,7 @@ class Admin::AnnouncementsController < OrbitAdminController sort = {:postdate=>"desc"} end - @bulletins = Bulletin.where(:is_preview.in=>[false,nil]) + @bulletins = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]) .order_by(sort) .with_categories(filters("category")) .with_tags(filters("tag")) diff --git a/app/views/admin/announcements/_index.html.erb b/app/views/admin/announcements/_index.html.erb index 4386580..0eaca59 100644 --- a/app/views/admin/announcements/_index.html.erb +++ b/app/views/admin/announcements/_index.html.erb @@ -18,30 +18,14 @@ <%= b.category.title %> - <% - case I18n.locale - when :en - if b.title_translations[I18n.locale].blank? - title = b.title_translations["zh_tw"] - else - title = b.title_translations[I18n.locale] - end - when :zh_tw - if b.title_translations[I18n.locale].blank? - title = b.title_translations["en"] - else - title = b.title_translations[I18n.locale] - end - end - %> <% if b.expired? %> - <%= title %> <%= t(:expired) %> + <%= b.title %> <%= t(:expired) %> <% elsif b.rejected %> - <%= title %> <%= t(:rejected) %> : <%= b.rejection_reason rescue "" %> + <%= b.title %> <%= t(:rejected) %> : <%= b.rejection_reason rescue "" %> <% elsif !b.approved? %> - <%= title %> <%= t(:pending) %> + <%= b.title %> <%= t(:pending) %> <% else %> - <%= title %> + <%= b.title %> <% end %>