Created
September 12, 2012 10:27
-
-
Save davidslvto/3705794 to your computer and use it in GitHub Desktop.
Spree::Pages - With Translations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You need to have the following gems: | |
- spree_multi_lingual | |
- spree_pages | |
( In my case I'm using these ones) | |
gem 'spree_multi_lingual' , :git => '[email protected]:davidslvto/spree_multi_lingual.git', :branch => 'new_features' | |
gem 'spree_pages' , :git => '[email protected]:davidslvto/spree_pages.git' | |
After that you probably are ready to translate some pages! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rails g migration add_translation_to_page | |
class AddTranslationToPage < ActiveRecord::Migration | |
def up | |
Spree::Page.create_translation_table!({:title => :string, :body => :text , :permalink => :string, :meta_keywords => :string, :meta_description => :string },{:migrate_data => true}) | |
end | |
def down | |
Spree::Page.drop_translation_table! | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deface::Override.new( | |
:virtual_path => "spree/admin/pages/new", | |
:insert_top => "[data-hook='admin_page_new_form_header']", | |
:text => '<%= render "spree/admin/shared/language_dropdown", :object => Spree::Page.new -%>', | |
:name => "page_add_language_dropdown" | |
) | |
Deface::Override.new( | |
:virtual_path => "spree/admin/pages/edit", | |
:insert_top => "[data-hook='admin_page_edit_form_header']", | |
:text => '<%= render "spree/admin/shared/language_dropdown", :object => @page -%>', | |
:name => "page_add_language_dropdown" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment