fixes announcements i18n
This commit is contained in:
parent
ff2dffaeb4
commit
691d514fa1
|
@ -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 -%>
|
|
@ -3,15 +3,7 @@
|
||||||
<% form_for @announcement, :url => admin_announcement_path(@announcement) do |f| %>
|
<% form_for @announcement, :url => admin_announcement_path(@announcement) do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
|
|
||||||
<p>
|
<%= render :partial => "form", :locals => { :f => f } %>
|
||||||
<%= f.label :title, "Title" %>
|
|
||||||
<%= f.text_field :title %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :content, "Content" %>
|
|
||||||
<%= f.text_area :content %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= f.submit 'Update' %>
|
<%= f.submit 'Update' %>
|
||||||
|
|
|
@ -3,15 +3,7 @@
|
||||||
<% form_for @announcement, :url => admin_announcements_path do |f| %>
|
<% form_for @announcement, :url => admin_announcements_path do |f| %>
|
||||||
<%= f.error_messages %>
|
<%= f.error_messages %>
|
||||||
|
|
||||||
<p>
|
<%= render :partial => "form", :locals => { :f => f } %>
|
||||||
<%= f.label :title, "Title" %>
|
|
||||||
<%= f.text_field :title %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= f.label :content, "Content" %>
|
|
||||||
<%= f.text_area :content %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= f.submit 'Create' %>
|
<%= f.submit 'Create' %>
|
||||||
|
|
|
@ -14,10 +14,12 @@
|
||||||
<% @pages.each do |page| %>
|
<% @pages.each do |page| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= link_to page.name, admin_page_path(page) %></td>
|
<td><%= link_to page.name, admin_page_path(page) %></td>
|
||||||
<td><ul>
|
<td>
|
||||||
|
<ul>
|
||||||
<% page.children.each do |child| %>
|
<% page.children.each do |child| %>
|
||||||
<li><%= child.name %></li>
|
<li><%= child.name %></li>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td><%= page.layout_name %></th>
|
<td><%= page.layout_name %></th>
|
||||||
<td><%= page.parent_page_id %></td>
|
<td><%= page.parent_page_id %></td>
|
||||||
|
|
|
@ -51,6 +51,10 @@ class CouchFoo::Base
|
||||||
VALID_LOCALES.each do |locale|
|
VALID_LOCALES.each do |locale|
|
||||||
property "#{property_name.to_s}_#{locale}".to_sym, property_type
|
property "#{property_name.to_s}_#{locale}".to_sym, property_type
|
||||||
end
|
end
|
||||||
|
|
||||||
|
define_method( property_name ) do
|
||||||
|
self.read_attribute("#{property_name.to_s}_#{I18n.locale}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue