This commit is contained in:
unknown 2012-02-15 10:37:07 +08:00
parent 6b551defce
commit 778a85ca2b
7 changed files with 38 additions and 52 deletions

View File

@ -21,4 +21,8 @@ class I18nVariable
I18nVariable.first(:conditions => {:key => locale})[I18n.locale] I18nVariable.first(:conditions => {:key => locale})[I18n.locale]
end end
def self.from_locale(locale)
I18nVariable.first(:conditions => {:key => locale})[I18n.locale]
end
end end

View File

@ -1,18 +0,0 @@
# encoding: utf-8
class Announcement
include Mongoid::Document
include Mongoid::Timestamps
field :category, :type => String
field :title, :type => String
field :subtitle, :type => String
field :text, :type => String
field :postdate , :type => Date
field :deadline , :type => Date
# embeds_many :comments
validates_presence_of :category, :title, :subtitle, :text
end

View File

@ -18,7 +18,7 @@
<tr> <tr>
<td><%= post.postdate %></td> <td><%= post.postdate %></td>
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td> <td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td>
<td><%= link_to post.title, panel_announcement_front_end_bulletin_path(post) %> <td><%= link_to post.title[I18n.locale], panel_announcement_front_end_bulletin_path(post) %>
<%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %> <%#= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
</td> </td>
</tr> </tr>

View File

@ -17,19 +17,19 @@
</li> </li>
<li> <li>
<b><%= t('announcement.title') %></b> <b><%= t('announcement.title') %></b>
<%= @bulletin.title %> <%= @bulletin.title[I18n.locale] %>
</li> </li>
<li> <li>
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %> <%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
<%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_filename} if @bulletin.image.file %> <%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %>
</li> </li>
<li> <li>
<b><%= t('announcement.subtitle') %></b> <b><%= t('announcement.subtitle') %></b>
<%= @bulletin.subtitle %> <%= @bulletin.subtitle[I18n.locale] %>
</li> </li>
<li> <li>
<b><%= t('announcement.text') %></b> <b><%= t('announcement.text') %></b>
<%= @bulletin.text %> <%= @bulletin.text[I18n.locale] %>
</li> </li>
<li> <li>
<li> <li>
@ -54,4 +54,4 @@
</li> </li>
<%= link_back %> <%#= link_back %>

View File

@ -10,8 +10,8 @@
<% @bulletins.each do |post| %> <% @bulletins.each do |post| %>
<li> <li>
<div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div> <div class="news_img"><%= image_tag(post.image.url, :size => "290x130") if post.image.file %></div>
<h3 class="h3 news_title"><%= post.title %></h3> <h3 class="h3 news_title"><%= post.title[I18n.locale] %></h3>
<p class="news_wrap"><%= post.subtitle %></p> <p class="news_wrap"><%= post.subtitle[I18n.locale] %></p>
</li> </li>
<% end %> <% end %>
</ul> </ul>