fix languages for title

This commit is contained in:
nccu 2014-12-23 14:51:10 +08:00
parent 086437694b
commit 696046f792
2 changed files with 5 additions and 21 deletions

View File

@ -28,7 +28,7 @@ class Admin::AnnouncementsController < OrbitAdminController
sort = {:postdate=>"desc"} sort = {:postdate=>"desc"}
end end
@bulletins = Bulletin.where(:is_preview.in=>[false,nil]) @bulletins = Bulletin.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_bulletin(b)%>" target="_blank"><%= title %></a> <span class='label'><%= t(:pending) %></span> <a href="<%=page_for_bulletin(b)%>" target="_blank"><%= b.title %></a> <span class='label'><%= t(:pending) %></span>
<% else %> <% else %>
<a href="<%=page_for_bulletin(b)%>" target="_blank"><%= title %></a> <a href="<%=page_for_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">