diff --git a/app/controllers/admin/snippets_controller.rb b/app/controllers/admin/snippets_controller.rb index 4e94206f..620bc59e 100644 --- a/app/controllers/admin/snippets_controller.rb +++ b/app/controllers/admin/snippets_controller.rb @@ -36,7 +36,10 @@ class Admin::SnippetsController < ApplicationController end end - @snippet.content = "
+<%= f.label :name, "Name" %> +<%= f.text_field :name, :class => 'text' %> +
+ ++<%= f.label "content_zh_tw", "Content (zh_tw)" %> +<%= f.text_area "content_zh_tw", :size => '100x30' %> +
+ + + ++<%= f.label "content_en", "Content (en)" %> +<%= f.text_area "content_en", :size => '100x30' %> +
+ +<% content_for :page_specific_javascript do %> + +<% end -%> \ No newline at end of file diff --git a/app/views/admin/layouts/edit.html.erb b/app/views/admin/layouts/edit.html.erb index fd432eb9..ce171a36 100644 --- a/app/views/admin/layouts/edit.html.erb +++ b/app/views/admin/layouts/edit.html.erb @@ -3,16 +3,7 @@ <% form_for @layout, :url => admin_layout_path(@layout) do |f| %> <%= f.error_messages %> -- <%= f.label :name, "Name" %> - <%= f.text_field :name, :class => 'text' %> -
- -- <%= f.label :content, "Content" %> - <%= f.text_area :content, :size => '100x30' %> -
- + <%= render :partial => "form", :locals => { :f => f } %><%= f.submit 'Update' %>
diff --git a/app/views/admin/layouts/new.html.erb b/app/views/admin/layouts/new.html.erb index 844fdc22..2c746210 100644 --- a/app/views/admin/layouts/new.html.erb +++ b/app/views/admin/layouts/new.html.erb @@ -3,15 +3,7 @@ <% form_for :layout, :url => admin_layouts_path do |f| %> <%= f.error_messages %> -- <%= f.label :name, "Name" %> - <%= f.text_field :name, :class => 'text' %> -
- -- <%= f.label :content, "Content" %> - <%= f.text_area :content, :size => '100x30' %> -
+ <%= render :partial => "form", :locals => { :f => f } %><%= f.submit 'Create' %> diff --git a/app/views/admin/snippets/_form.html.erb b/app/views/admin/snippets/_form.html.erb new file mode 100644 index 00000000..f5a2750e --- /dev/null +++ b/app/views/admin/snippets/_form.html.erb @@ -0,0 +1,25 @@ +
+<%= f.label :name, "Name" %> +<%= f.text_field :name, :class => 'text' %> +
+ ++<%= f.label "content_zh_tw", "Content (zh_tw)" %> +<%= f.text_area "content_zh_tw", :size => '100x30' %> +
+ + + ++<%= f.label "content_en", "Content (en)" %> +<%= f.text_area "content_en", :size => '100x30' %> +
+ +<% content_for :page_specific_javascript do %> + +<% end -%> \ No newline at end of file diff --git a/app/views/admin/snippets/edit.html.erb b/app/views/admin/snippets/edit.html.erb index c661e5bd..dfa6eb95 100644 --- a/app/views/admin/snippets/edit.html.erb +++ b/app/views/admin/snippets/edit.html.erb @@ -3,15 +3,7 @@ <% form_for @snippet, :url => admin_snippet_path(@snippet) do |f| %> <%= f.error_messages %> -- <%= f.label :name, "Name" %> - <%= f.text_field :name, :class => 'text' %> -
- -- <%= f.label :content, "Content" %> - <%= f.text_area :content, :size => '100x30' %> -
+ <%= render :partial => "form", :locals => { :f => f } %><%= f.submit 'Update' %> diff --git a/app/views/admin/snippets/new.html.erb b/app/views/admin/snippets/new.html.erb index fe1005c8..d6e845a2 100644 --- a/app/views/admin/snippets/new.html.erb +++ b/app/views/admin/snippets/new.html.erb @@ -3,15 +3,7 @@ <% form_for :snippet, :url => admin_snippets_path do |f| %> <%= f.error_messages %> -
- <%= f.label :name, "Name" %> - <%= f.text_field :name, :class => 'text' %> -
- -- <%= f.label :content, "Content" %> - <%= f.text_area :content, :size => '100x30' %> -
+ <%= render :partial => "form", :locals => { :f => f } %><%= f.submit 'Create' %> diff --git a/config/environment.rb b/config/environment.rb index c6fd1f9b..659f2775 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -49,7 +49,7 @@ class CouchFoo::Base def self.property_i18n(property_name, property_type) VALID_LOCALES.each do |locale| - property "#{property_name.to_s}_#{locale}", property_type + property "#{property_name.to_s}_#{locale}".to_sym, property_type end end