fix languages for title

This commit is contained in:
nccu 2014-12-23 14:49:27 +08:00
parent ee7a9d8b31
commit a43fd9f17f
2 changed files with 5 additions and 21 deletions

View File

@ -16,7 +16,7 @@ class Admin::NewsController < OrbitAdminController
@filter_fields = filter_fields(@categories, @tags) @filter_fields = filter_fields(@categories, @tags)
@table_fields = [:status, :category, :title, :start_date, :end_date, :image, "news.unit", :view_count] @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) .order_by(sort)
.with_categories(filters("category")) .with_categories(filters("category"))
.with_tags(filters("tag")) .with_tags(filters("tag"))

View File

@ -18,30 +18,14 @@
</td> </td>
<td><%= b.category.title %></td> <td><%= b.category.title %></td>
<td> <td>
<%
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? %> <% if b.expired? %>
<%= title %> <span class='label'><%= t(:expired) %></span> <%= b.title %> <span class='label'><%= t(:expired) %></span>
<% elsif b.rejected %> <% elsif b.rejected %>
<a href="<%=page_for_bulletin(b)%>" target="_blank"><%= title %></a> <span class='label'><%= t(:rejected) %> : <%= b.rejection_reason rescue "" %></span> <a href="<%=page_for_bulletin(b)%>" target="_blank"><%= b.title %></a> <span class='label'><%= t(:rejected) %> : <%= b.rejection_reason rescue "" %></span>
<% elsif !b.approved? %> <% elsif !b.approved? %>
<a href="<%=page_for_news_bulletin(b)%>" target="_blank"><%= title %></a> <span class='label'><%= t(:pending) %></span> <a href="<%=page_for_news_bulletin(b)%>" target="_blank"><%= b.title %></a> <span class='label'><%= t(:pending) %></span>
<% else %> <% else %>
<a href="<%=page_for_news_bulletin(b)%>" target="_blank"><%= title %></a> <a href="<%=page_for_news_bulletin(b)%>" target="_blank"><%= b.title %></a>
<% end %> <% end %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills"> <ul class="nav nav-pills">