fixes announcements i18n

This commit is contained in:
Wen-Tien Chang 2009-07-06 16:36:41 +08:00
parent ff2dffaeb4
commit 691d514fa1
5 changed files with 52 additions and 20 deletions

View File

@ -0,0 +1,42 @@
<p id="title_zh_tw_block">
<%= f.label "title_zh_tw", "Title (zh_tw)" %>
<%= f.text_field "title_zh_tw" %>
</p>
<p><a href="#" id="toggle_title_en_block">Edit english</a></p>
<p id="title_en_block">
<%= f.label "title_en", "Title (en)" %>
<%= f.text_field "title_en" %>
</p>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$('#title_en_block').hide();
$('#toggle_title_en_block').click(function(){
$('#title_en_block').toggle();
});
</script>
<% end -%>
<p id="content_zh_tw_block">
<%= f.label "content_zh_tw", "Content (zh_tw)" %>
<%= f.text_area "content_zh_tw", :size => '100x30' %>
</p>
<p><a href="#" id="toggle_content_en_block">Edit english</a></p>
<p id="content_en_block">
<%= f.label "content_en", "Content (en)" %>
<%= f.text_area "content_en", :size => '100x30' %>
</p>
<% content_for :page_specific_javascript do %>
<script type="text/javascript" charset="utf-8">
$('#content_en_block').hide();
$('#toggle_content_en_block').click(function(){
$('#content_en_block').toggle();
});
</script>
<% end -%>

View File

@ -3,15 +3,7 @@
<% form_for @announcement, :url => admin_announcement_path(@announcement) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :title, "Title" %>
<%= f.text_field :title %>
</p>
<p>
<%= f.label :content, "Content" %>
<%= f.text_area :content %>
</p>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Update' %>

View File

@ -3,15 +3,7 @@
<% form_for @announcement, :url => admin_announcements_path do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :title, "Title" %>
<%= f.text_field :title %>
</p>
<p>
<%= f.label :content, "Content" %>
<%= f.text_area :content %>
</p>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit 'Create' %>

View File

@ -14,10 +14,12 @@
<% @pages.each do |page| %>
<tr>
<td><%= link_to page.name, admin_page_path(page) %></td>
<td><ul>
<td>
<ul>
<% page.children.each do |child| %>
<li><%= child.name %></li>
<% end -%>
</ul>
</td>
<td><%= page.layout_name %></th>
<td><%= page.parent_page_id %></td>

View File

@ -51,6 +51,10 @@ class CouchFoo::Base
VALID_LOCALES.each do |locale|
property "#{property_name.to_s}_#{locale}".to_sym, property_type
end
define_method( property_name ) do
self.read_attribute("#{property_name.to_s}_#{I18n.locale}")
end
end
end