Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated Readme, detailed install instructions. #72

Merged
merged 6 commits into from
Oct 17, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
.yardoc
.DS_Store
.svn
Expand Down
82 changes: 82 additions & 0 deletions .idea/alchemy_cms.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Installation

Use the installer (recommended):

gem install alchemy_cms --pre
alchemy new my_magicpage

Start the local server:
Expand All @@ -76,6 +77,17 @@ Start the local server:

Then just switch to your browser and open `http://localhost:3000`.

Add to existing Rails project:

add gem 'alchemy_cms' to Gemfile

bundle install
rake alchemy:prepare
rake alchemy:standard_set:install (optional)
rake db:migrate
rake db:seed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add rake db:seed


Tipps
-----

Expand Down
18 changes: 7 additions & 11 deletions app/helpers/pages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def language_switches(options={})
}
options = default_options.merge(options)
if multi_language?
languages = []
language_links = []
pages = (options[:link_to_public_child] == true) ? Page.language_roots : Page.public_language_roots
pages.each_with_index do |page, i|
if(options[:link_to_page_with_layout] != nil)
Expand All @@ -97,33 +97,29 @@ def language_switches(options={})
active = session[:language_id] == page.language.id
linkname = page.language.label(options[:linkname])
if options[:as_select_box]
languages << [linkname, show_page_url(:urlname => page.urlname, :lang => page.language.code)]
language_links << [linkname, show_page_url(:urlname => page.urlname, :lang => page.language.code)]
else
languages << link_to(
language_links << link_to(
"#{content_tag(:span, '', :class => "flag")}#{ content_tag(:span, linkname)}".html_safe,
show_page_path(:urlname => page.urlname, :lang => page.language.code),
:class => "#{(active ? 'active ' : nil)}#{page.language.code} #{(i == 0) ? 'first' : (i==pages.length-1) ? 'last' : nil}",
:title => options[:show_title] ? I18n.t("alchemy.languages.#{page.language.code}.title", :default => page.language.name) : nil
:title => options[:show_title] ? I18n.t("alchemy.language_links.#{page.language.code}.title", :default => page.language.name) : nil
)
end
end
end
languages.reverse! if options[:reverse]
language_links.reverse! if options[:reverse]
if options[:as_select_box]
return select_tag(
'language',
options_for_select(
languages,
language_links,
show_page_url(:urlname => @page.urlname, :lang => @page.language.code)
),
:onchange => "window.location=this.value"
)
else
if options[:spacer].blank?
return languages.html_safe
else
return languages.join(options[:spacer]).html_safe
end
raw(language_links.join(options[:spacer]))
end
end
end
Expand Down
23 changes: 23 additions & 0 deletions spec/helpers/pages_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'spec_helper'

describe PagesHelper do

describe "language_switches" do
before :each do
helper.stub(:configuration)
end

it "should return links to all other languages" do
helper.stub(:multi_language?).and_return(true)
Page.create(:language_code => "en", :public => true)
Page.create(:language_code => "de")
ss
helper.language_switches.should == ""
end

it "should return nil if there is only one language" do
helper.stub(:multi_language?).and_return(nil)
helper.language_switches.should be nil
end
end
end