Backporting the change that I made to the api06 branch to bring the classic_pagination into our svn. This will make it easier for people to setup a rails version of the server.
This commit is contained in:
parent
0b8449d2c9
commit
a8b5e2b87d
22 changed files with 1267 additions and 0 deletions
24
vendor/plugins/classic_pagination/test/fixtures/companies.yml
vendored
Normal file
24
vendor/plugins/classic_pagination/test/fixtures/companies.yml
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
thirty_seven_signals:
|
||||
id: 1
|
||||
name: 37Signals
|
||||
rating: 4
|
||||
|
||||
TextDrive:
|
||||
id: 2
|
||||
name: TextDrive
|
||||
rating: 4
|
||||
|
||||
PlanetArgon:
|
||||
id: 3
|
||||
name: Planet Argon
|
||||
rating: 4
|
||||
|
||||
Google:
|
||||
id: 4
|
||||
name: Google
|
||||
rating: 4
|
||||
|
||||
Ionist:
|
||||
id: 5
|
||||
name: Ioni.st
|
||||
rating: 4
|
9
vendor/plugins/classic_pagination/test/fixtures/company.rb
vendored
Normal file
9
vendor/plugins/classic_pagination/test/fixtures/company.rb
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
class Company < ActiveRecord::Base
|
||||
attr_protected :rating
|
||||
set_sequence_name :companies_nonstd_seq
|
||||
|
||||
validates_presence_of :name
|
||||
def validate
|
||||
errors.add('rating', 'rating should not be 2') if rating == 2
|
||||
end
|
||||
end
|
7
vendor/plugins/classic_pagination/test/fixtures/developer.rb
vendored
Normal file
7
vendor/plugins/classic_pagination/test/fixtures/developer.rb
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Developer < ActiveRecord::Base
|
||||
has_and_belongs_to_many :projects
|
||||
end
|
||||
|
||||
class DeVeLoPeR < ActiveRecord::Base
|
||||
set_table_name "developers"
|
||||
end
|
21
vendor/plugins/classic_pagination/test/fixtures/developers.yml
vendored
Normal file
21
vendor/plugins/classic_pagination/test/fixtures/developers.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
david:
|
||||
id: 1
|
||||
name: David
|
||||
salary: 80000
|
||||
|
||||
jamis:
|
||||
id: 2
|
||||
name: Jamis
|
||||
salary: 150000
|
||||
|
||||
<% for digit in 3..10 %>
|
||||
dev_<%= digit %>:
|
||||
id: <%= digit %>
|
||||
name: fixture_<%= digit %>
|
||||
salary: 100000
|
||||
<% end %>
|
||||
|
||||
poor_jamis:
|
||||
id: 11
|
||||
name: Jamis
|
||||
salary: 9000
|
13
vendor/plugins/classic_pagination/test/fixtures/developers_projects.yml
vendored
Normal file
13
vendor/plugins/classic_pagination/test/fixtures/developers_projects.yml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
david_action_controller:
|
||||
developer_id: 1
|
||||
project_id: 2
|
||||
joined_on: 2004-10-10
|
||||
|
||||
david_active_record:
|
||||
developer_id: 1
|
||||
project_id: 1
|
||||
joined_on: 2004-10-10
|
||||
|
||||
jamis_active_record:
|
||||
developer_id: 2
|
||||
project_id: 1
|
3
vendor/plugins/classic_pagination/test/fixtures/project.rb
vendored
Normal file
3
vendor/plugins/classic_pagination/test/fixtures/project.rb
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
class Project < ActiveRecord::Base
|
||||
has_and_belongs_to_many :developers, :uniq => true
|
||||
end
|
7
vendor/plugins/classic_pagination/test/fixtures/projects.yml
vendored
Normal file
7
vendor/plugins/classic_pagination/test/fixtures/projects.yml
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
action_controller:
|
||||
id: 2
|
||||
name: Active Controller
|
||||
|
||||
active_record:
|
||||
id: 1
|
||||
name: Active Record
|
13
vendor/plugins/classic_pagination/test/fixtures/replies.yml
vendored
Normal file
13
vendor/plugins/classic_pagination/test/fixtures/replies.yml
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
witty_retort:
|
||||
id: 1
|
||||
topic_id: 1
|
||||
content: Birdman is better!
|
||||
created_at: <%= 6.hours.ago.to_s(:db) %>
|
||||
updated_at: nil
|
||||
|
||||
another:
|
||||
id: 2
|
||||
topic_id: 2
|
||||
content: Nuh uh!
|
||||
created_at: <%= 1.hour.ago.to_s(:db) %>
|
||||
updated_at: nil
|
5
vendor/plugins/classic_pagination/test/fixtures/reply.rb
vendored
Normal file
5
vendor/plugins/classic_pagination/test/fixtures/reply.rb
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
class Reply < ActiveRecord::Base
|
||||
belongs_to :topic, :include => [:replies]
|
||||
|
||||
validates_presence_of :content
|
||||
end
|
42
vendor/plugins/classic_pagination/test/fixtures/schema.sql
vendored
Normal file
42
vendor/plugins/classic_pagination/test/fixtures/schema.sql
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
CREATE TABLE 'companies' (
|
||||
'id' INTEGER PRIMARY KEY NOT NULL,
|
||||
'name' TEXT DEFAULT NULL,
|
||||
'rating' INTEGER DEFAULT 1
|
||||
);
|
||||
|
||||
CREATE TABLE 'replies' (
|
||||
'id' INTEGER PRIMARY KEY NOT NULL,
|
||||
'content' text,
|
||||
'created_at' datetime,
|
||||
'updated_at' datetime,
|
||||
'topic_id' integer
|
||||
);
|
||||
|
||||
CREATE TABLE 'topics' (
|
||||
'id' INTEGER PRIMARY KEY NOT NULL,
|
||||
'title' varchar(255),
|
||||
'subtitle' varchar(255),
|
||||
'content' text,
|
||||
'created_at' datetime,
|
||||
'updated_at' datetime
|
||||
);
|
||||
|
||||
CREATE TABLE 'developers' (
|
||||
'id' INTEGER PRIMARY KEY NOT NULL,
|
||||
'name' TEXT DEFAULT NULL,
|
||||
'salary' INTEGER DEFAULT 70000,
|
||||
'created_at' DATETIME DEFAULT NULL,
|
||||
'updated_at' DATETIME DEFAULT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE 'projects' (
|
||||
'id' INTEGER PRIMARY KEY NOT NULL,
|
||||
'name' TEXT DEFAULT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE 'developers_projects' (
|
||||
'developer_id' INTEGER NOT NULL,
|
||||
'project_id' INTEGER NOT NULL,
|
||||
'joined_on' DATE DEFAULT NULL,
|
||||
'access_level' INTEGER DEFAULT 1
|
||||
);
|
3
vendor/plugins/classic_pagination/test/fixtures/topic.rb
vendored
Normal file
3
vendor/plugins/classic_pagination/test/fixtures/topic.rb
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
class Topic < ActiveRecord::Base
|
||||
has_many :replies, :include => [:user], :dependent => :destroy
|
||||
end
|
22
vendor/plugins/classic_pagination/test/fixtures/topics.yml
vendored
Normal file
22
vendor/plugins/classic_pagination/test/fixtures/topics.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
futurama:
|
||||
id: 1
|
||||
title: Isnt futurama awesome?
|
||||
subtitle: It really is, isnt it.
|
||||
content: I like futurama
|
||||
created_at: <%= 1.day.ago.to_s(:db) %>
|
||||
updated_at:
|
||||
|
||||
harvey_birdman:
|
||||
id: 2
|
||||
title: Harvey Birdman is the king of all men
|
||||
subtitle: yup
|
||||
content: It really is
|
||||
created_at: <%= 2.hours.ago.to_s(:db) %>
|
||||
updated_at:
|
||||
|
||||
rails:
|
||||
id: 3
|
||||
title: Rails is nice
|
||||
subtitle: It makes me happy
|
||||
content: except when I have to hack internals to fix pagination. even then really.
|
||||
created_at: <%= 20.minutes.ago.to_s(:db) %>
|
Loading…
Add table
Add a link
Reference in a new issue