From a43fd9f17f83fb3c56cb4a20d377c4445d3da137 Mon Sep 17 00:00:00 2001 From: nccu Date: Tue, 23 Dec 2014 14:49:27 +0800 Subject: [PATCH] fix languages for title --- app/controllers/admin/news_controller.rb | 2 +- app/views/admin/news/_index.html.erb | 24 ++++-------------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/app/controllers/admin/news_controller.rb b/app/controllers/admin/news_controller.rb index 5d2361c..1d40bb2 100644 --- a/app/controllers/admin/news_controller.rb +++ b/app/controllers/admin/news_controller.rb @@ -16,7 +16,7 @@ class Admin::NewsController < OrbitAdminController @filter_fields = filter_fields(@categories, @tags) @table_fields = [:status, :category, :title, :start_date, :end_date, :image, "news.unit", :view_count] - @news_bulletin = NewsBulletin.where(:is_preview.in=>[false,nil]) + @news_bulletin = NewsBulletin.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/news/_index.html.erb b/app/views/admin/news/_index.html.erb index d891079..e2c39fb 100644 --- a/app/views/admin/news/_index.html.erb +++ b/app/views/admin/news/_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 %>