Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Engel
committed
Nov 9, 2010
1 parent
3ef2158
commit 7c59cfe
Showing
10 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class CmsContent < ActiveRecord::Base | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Translation < ActiveRecord::Base | ||
|
||
def to_rich_cms_response(params) | ||
{:value => value, :translations => Hash[*params[:derivative_keys].split(";").uniq.collect{|x| [x, x.t({:as => params[:editable_input_type]})]}.flatten]} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class User < ActiveRecord::Base | ||
|
||
acts_as_authentic do |c| | ||
c.login_field = :email | ||
c.crypted_password_field = :crypted_password | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class UserSession < Authlogic::Session::Base | ||
|
||
authenticate_with User | ||
generalize_credentials_error_messages true | ||
params_key "user_credentials" | ||
|
||
def to_key | ||
new_record? ? nil : [self.send self.class.primary_key] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
Rich::Cms::Engine.authenticate(:authlogic, {:class_name => "User", :identifier => :email}) | ||
Rich::Cms::Engine.register(".cms_content", {:class_name => "CmsContent"}) | ||
Rich::I18n::Engine.enable_i18n_cms |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class CreateUsers < ActiveRecord::Migration | ||
def self.up | ||
create_table :users do |t| | ||
t.string :name | ||
t.string :email | ||
t.string :crypted_password | ||
t.string :password_salt | ||
t.datetime :created_at | ||
t.string :persistence_token , :default => "", :null => false | ||
t.string :single_access_token, :default => "", :null => false | ||
t.string :perishable_token , :default => "", :null => false | ||
t.integer :login_count | ||
t.datetime :last_request_at | ||
t.datetime :current_login_at | ||
t.datetime :last_login_at | ||
t.timestamps | ||
end | ||
|
||
add_index :users, :email | ||
end | ||
|
||
def self.down | ||
drop_table :users | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class CreateCmsContents < ActiveRecord::Migration | ||
def self.up | ||
create_table :cms_contents do |t| | ||
t.string :key | ||
t.text :value | ||
t.timestamps | ||
end | ||
|
||
add_index :cms_contents, :key | ||
end | ||
|
||
def self.down | ||
drop_table :cms_contents | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class CreateTranslations < ActiveRecord::Migration | ||
def self.up | ||
create_table :translations do |t| | ||
t.string :locale | ||
t.string :key | ||
t.text :value | ||
t.boolean :is_proc, :default => false | ||
t.timestamps | ||
end | ||
|
||
add_index :translations, :locale | ||
add_index :translations, :key | ||
end | ||
|
||
def self.down | ||
drop_table :translations | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | ||
|
||
# This model initially had no columns defined. If you add columns to the | ||
# model remove the '{}' from the fixture names and add the columns immediately | ||
# below each fixture, per the syntax in the comments below | ||
# | ||
one: {} | ||
# column: value | ||
# | ||
two: {} | ||
# column: value |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'test_helper' | ||
|
||
class CmsContentTest < ActiveSupport::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
end | ||
end |