From 086437694b43c08db5065b2f4fa982b32fdb55b5 Mon Sep 17 00:00:00 2001 From: nccu Date: Tue, 23 Dec 2014 14:12:53 +0800 Subject: [PATCH] fix languages for title --- app/views/admin/announcements/_index.html.erb | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/app/views/admin/announcements/_index.html.erb b/app/views/admin/announcements/_index.html.erb index 0eaca59..4386580 100644 --- a/app/views/admin/announcements/_index.html.erb +++ b/app/views/admin/announcements/_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 %>