From ee7a9d8b316bf80ad1eee4d8bb57b30347e687e9 Mon Sep 17 00:00:00 2001 From: nccu Date: Tue, 23 Dec 2014 14:14:57 +0800 Subject: [PATCH] fix languages for title --- app/views/admin/news/_index.html.erb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/app/views/admin/news/_index.html.erb b/app/views/admin/news/_index.html.erb index e2c39fb..d891079 100644 --- a/app/views/admin/news/_index.html.erb +++ b/app/views/admin/news/_index.html.erb @@ -18,14 +18,30 @@ <%= 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? %> - <%= b.title %> <%= t(:expired) %> + <%= title %> <%= t(:expired) %> <% elsif b.rejected %> - <%= b.title %> <%= t(:rejected) %> : <%= b.rejection_reason rescue "" %> + <%= title %> <%= t(:rejected) %> : <%= b.rejection_reason rescue "" %> <% elsif !b.approved? %> - <%= b.title %> <%= t(:pending) %> + <%= title %> <%= t(:pending) %> <% else %> - <%= b.title %> + <%= title %> <% end %>