merb-admin 0.8.1 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +29 -27
- data/Gemfile +24 -22
- data/Gemfile.lock +86 -0
- data/LICENSE +20 -20
- data/README.rdoc +54 -58
- data/Rakefile +11 -44
- data/app/controllers/application.rb +6 -6
- data/app/controllers/main.rb +191 -191
- data/app/helpers/application_helper.rb +64 -64
- data/app/helpers/main_helper.rb +167 -167
- data/app/models/.gitkeep +0 -0
- data/app/views/layout/_message.html.erb +10 -10
- data/app/views/layout/dashboard.html.erb +34 -34
- data/app/views/layout/form.html.erb +48 -48
- data/app/views/layout/list.html.erb +42 -42
- data/app/views/main/_belongs_to.html.erb +29 -29
- data/app/views/main/_big_decimal.html.erb +12 -12
- data/app/views/main/_boolean.html.erb +7 -7
- data/app/views/main/_date.html.erb +12 -12
- data/app/views/main/_datetime.html.erb +12 -12
- data/app/views/main/_float.html.erb +12 -12
- data/app/views/main/_has_many.html.erb +16 -16
- data/app/views/main/_has_one.html.erb +30 -30
- data/app/views/main/_integer.html.erb +12 -12
- data/app/views/main/_properties.html.erb +18 -18
- data/app/views/main/_string.html.erb +15 -15
- data/app/views/main/_text.html.erb +11 -11
- data/app/views/main/_time.html.erb +12 -12
- data/app/views/main/_timestamp.html.erb +12 -12
- data/app/views/main/delete.html.erb +28 -28
- data/app/views/main/edit.html.erb +19 -19
- data/app/views/main/index.html.erb +22 -22
- data/app/views/main/list.html.erb +93 -93
- data/app/views/main/new.html.erb +16 -16
- data/config/init.rb +30 -0
- data/config/router.rb +4 -0
- data/lib/abstract_model.rb +84 -86
- data/lib/active_record_support.rb +147 -147
- data/lib/datamapper_support.rb +139 -140
- data/lib/generic_support.rb +13 -13
- data/lib/merb-admin.rb +99 -99
- data/lib/merb-admin/merbtasks.rb +103 -103
- data/lib/merb-admin/slicetasks.rb +174 -174
- data/lib/merb-admin/spectasks.rb +55 -55
- data/lib/merb-admin/version.rb +3 -0
- data/lib/sequel_support.rb +275 -275
- data/merb-admin.gemspec +42 -232
- data/public/javascripts/CollapsedFieldsets.js +85 -85
- data/public/javascripts/DateTimeShortcuts.js +255 -255
- data/public/javascripts/RelatedObjectLookups.js +96 -96
- data/public/javascripts/SelectBox.js +111 -111
- data/public/javascripts/SelectFilter2.js +113 -113
- data/public/javascripts/actions.js +39 -39
- data/public/javascripts/calendar.js +143 -143
- data/public/javascripts/core.js +176 -176
- data/public/javascripts/dateparse.js +233 -233
- data/public/javascripts/getElementsBySelector.js +167 -167
- data/public/javascripts/i18n.js +33 -33
- data/public/javascripts/ordering.js +137 -137
- data/public/javascripts/timeparse.js +94 -94
- data/public/javascripts/urlify.js +140 -140
- data/public/stylesheets/base.css +746 -746
- data/public/stylesheets/changelists.css +269 -269
- data/public/stylesheets/dashboard.css +24 -24
- data/public/stylesheets/forms.css +327 -327
- data/public/stylesheets/global.css +142 -142
- data/public/stylesheets/ie.css +50 -50
- data/public/stylesheets/layout.css +29 -29
- data/public/stylesheets/login.css +54 -54
- data/public/stylesheets/master.css +1 -1
- data/public/stylesheets/patch-iewin.css +7 -7
- data/public/stylesheets/rtl.css +206 -206
- data/public/stylesheets/widgets.css +506 -506
- data/screenshots/create.png +0 -0
- data/screenshots/delete.png +0 -0
- data/screenshots/edit.png +0 -0
- data/screenshots/index.png +0 -0
- data/screenshots/list.png +0 -0
- data/screenshots/new.png +0 -0
- data/spec/controllers/main_spec.rb +25 -25
- data/spec/migrations/activerecord/001_create_divisions_migration.rb +13 -13
- data/spec/migrations/activerecord/002_create_drafts_migration.rb +19 -19
- data/spec/migrations/activerecord/003_create_leagues_migration.rb +12 -12
- data/spec/migrations/activerecord/004_create_players_migration.rb +19 -20
- data/spec/migrations/activerecord/005_create_teams_migration.rb +22 -22
- data/spec/migrations/sequel/001_create_divisions_migration.rb +15 -15
- data/spec/migrations/sequel/002_create_drafts_migration.rb +21 -21
- data/spec/migrations/sequel/003_create_leagues_migration.rb +14 -14
- data/spec/migrations/sequel/004_create_players_migration.rb +21 -22
- data/spec/migrations/sequel/005_create_teams_migration.rb +24 -24
- data/spec/models/activerecord/division.rb +7 -7
- data/spec/models/activerecord/draft.rb +11 -11
- data/spec/models/activerecord/league.rb +6 -6
- data/spec/models/activerecord/player.rb +8 -8
- data/spec/models/activerecord/team.rb +13 -13
- data/spec/models/datamapper/division.rb +12 -12
- data/spec/models/datamapper/draft.rb +18 -18
- data/spec/models/datamapper/league.rb +11 -11
- data/spec/models/datamapper/player.rb +20 -21
- data/spec/models/datamapper/team.rb +22 -22
- data/spec/models/sequel/division.rb +15 -15
- data/spec/models/sequel/draft.rb +19 -19
- data/spec/models/sequel/league.rb +14 -14
- data/spec/models/sequel/player.rb +18 -18
- data/spec/models/sequel/team.rb +21 -21
- data/spec/requests/main_spec.rb +763 -763
- data/spec/spec_helper.rb +113 -112
- metadata +247 -41
- data/VERSION +0 -1
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/screenshots/new.png
ADDED
Binary file
|
@@ -1,25 +1,25 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
|
3
|
-
describe MerbAdmin::Main do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
mount_slice
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should have helper methods for dealing with public paths" do
|
10
|
-
@controller = dispatch_to(MerbAdmin::Main, :index)
|
11
|
-
|
12
|
-
@controller.public_path_for(:image).should == "/slices/merb-admin/images"
|
13
|
-
@controller.public_path_for(:javascript).should == "/slices/merb-admin/javascripts"
|
14
|
-
@controller.public_path_for(:stylesheet).should == "/slices/merb-admin/stylesheets"
|
15
|
-
|
16
|
-
@controller.image_path.should == "/slices/merb-admin/images"
|
17
|
-
@controller.javascript_path.should == "/slices/merb-admin/javascripts"
|
18
|
-
@controller.stylesheet_path.should == "/slices/merb-admin/stylesheets"
|
19
|
-
|
20
|
-
@controller.app_path_for(:image).should == "#{Merb.root}/public/slices/merb-admin/images"
|
21
|
-
@controller.app_path_for(:javascript).should == "#{Merb.root}/public/slices/merb-admin/javascripts"
|
22
|
-
@controller.app_path_for(:stylesheet).should == "#{Merb.root}/public/slices/merb-admin/stylesheets"
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe MerbAdmin::Main do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
mount_slice
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should have helper methods for dealing with public paths" do
|
10
|
+
@controller = dispatch_to(MerbAdmin::Main, :index)
|
11
|
+
|
12
|
+
@controller.public_path_for(:image).should == "/slices/merb-admin/images"
|
13
|
+
@controller.public_path_for(:javascript).should == "/slices/merb-admin/javascripts"
|
14
|
+
@controller.public_path_for(:stylesheet).should == "/slices/merb-admin/stylesheets"
|
15
|
+
|
16
|
+
@controller.image_path.should == "/slices/merb-admin/images"
|
17
|
+
@controller.javascript_path.should == "/slices/merb-admin/javascripts"
|
18
|
+
@controller.stylesheet_path.should == "/slices/merb-admin/stylesheets"
|
19
|
+
|
20
|
+
@controller.app_path_for(:image).should == "#{Merb.root}/public/slices/merb-admin/images"
|
21
|
+
@controller.app_path_for(:javascript).should == "#{Merb.root}/public/slices/merb-admin/javascripts"
|
22
|
+
@controller.app_path_for(:stylesheet).should == "#{Merb.root}/public/slices/merb-admin/stylesheets"
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
class CreateDivisionsMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table(:divisions) do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.integer(:league_id)
|
6
|
-
t.string(:name, :limit => 50, :null => false)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.down
|
11
|
-
drop_table(:divisions)
|
12
|
-
end
|
13
|
-
end
|
1
|
+
class CreateDivisionsMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:divisions) do |t|
|
4
|
+
t.timestamps
|
5
|
+
t.integer(:league_id)
|
6
|
+
t.string(:name, :limit => 50, :null => false)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
drop_table(:divisions)
|
12
|
+
end
|
13
|
+
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
class CreateDraftsMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table(:drafts) do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.integer(:player_id)
|
6
|
-
t.integer(:team_id)
|
7
|
-
t.date(:date)
|
8
|
-
t.integer(:round)
|
9
|
-
t.integer(:pick)
|
10
|
-
t.integer(:overall)
|
11
|
-
t.string(:college, :limit => 100)
|
12
|
-
t.text(:notes)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.down
|
17
|
-
drop_table(:drafts)
|
18
|
-
end
|
19
|
-
end
|
1
|
+
class CreateDraftsMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:drafts) do |t|
|
4
|
+
t.timestamps
|
5
|
+
t.integer(:player_id)
|
6
|
+
t.integer(:team_id)
|
7
|
+
t.date(:date)
|
8
|
+
t.integer(:round)
|
9
|
+
t.integer(:pick)
|
10
|
+
t.integer(:overall)
|
11
|
+
t.string(:college, :limit => 100)
|
12
|
+
t.text(:notes)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table(:drafts)
|
18
|
+
end
|
19
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
class CreateLeaguesMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table(:leagues) do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.string(:name, :limit => 50, :null => false)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.down
|
10
|
-
drop_table(:leagues)
|
11
|
-
end
|
12
|
-
end
|
1
|
+
class CreateLeaguesMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:leagues) do |t|
|
4
|
+
t.timestamps
|
5
|
+
t.string(:name, :limit => 50, :null => false)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.down
|
10
|
+
drop_table(:leagues)
|
11
|
+
end
|
12
|
+
end
|
@@ -1,20 +1,19 @@
|
|
1
|
-
class CreatePlayersMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table(:players) do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.
|
6
|
-
t.
|
7
|
-
t.string(:
|
8
|
-
t.
|
9
|
-
t.
|
10
|
-
t.boolean(:
|
11
|
-
t.
|
12
|
-
t.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
1
|
+
class CreatePlayersMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:players) do |t|
|
4
|
+
t.timestamps
|
5
|
+
t.integer(:team_id)
|
6
|
+
t.string(:name, :limit => 100, :null => false)
|
7
|
+
t.string(:position, :limit => 50)
|
8
|
+
t.integer(:number, :null => false)
|
9
|
+
t.boolean(:retired, :default => false)
|
10
|
+
t.boolean(:injured, :default => false)
|
11
|
+
t.date(:born_on)
|
12
|
+
t.text(:notes)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table(:players)
|
18
|
+
end
|
19
|
+
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
class CreateTeamsMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table(:teams) do |t|
|
4
|
-
t.timestamps
|
5
|
-
t.integer(:league_id)
|
6
|
-
t.integer(:division_id)
|
7
|
-
t.string(:name, :limit => 50)
|
8
|
-
t.string(:logo_url, :limit => 255)
|
9
|
-
t.string(:manager, :limit => 100, :null => false)
|
10
|
-
t.string(:ballpark, :limit => 100)
|
11
|
-
t.string(:mascot, :limit => 100)
|
12
|
-
t.integer(:founded)
|
13
|
-
t.integer(:wins)
|
14
|
-
t.integer(:losses)
|
15
|
-
t.float(:win_percentage)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.down
|
20
|
-
drop_table(:teams)
|
21
|
-
end
|
22
|
-
end
|
1
|
+
class CreateTeamsMigration < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:teams) do |t|
|
4
|
+
t.timestamps
|
5
|
+
t.integer(:league_id)
|
6
|
+
t.integer(:division_id)
|
7
|
+
t.string(:name, :limit => 50)
|
8
|
+
t.string(:logo_url, :limit => 255)
|
9
|
+
t.string(:manager, :limit => 100, :null => false)
|
10
|
+
t.string(:ballpark, :limit => 100)
|
11
|
+
t.string(:mascot, :limit => 100)
|
12
|
+
t.integer(:founded)
|
13
|
+
t.integer(:wins)
|
14
|
+
t.integer(:losses)
|
15
|
+
t.float(:win_percentage)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.down
|
20
|
+
drop_table(:teams)
|
21
|
+
end
|
22
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
class CreateDivisions < Sequel::Migration
|
2
|
-
def up
|
3
|
-
create_table(:divisions) do
|
4
|
-
primary_key(:id)
|
5
|
-
DateTime(:created_at)
|
6
|
-
DateTime(:updated_at)
|
7
|
-
foreign_key(:league_id, :table => :leagues)
|
8
|
-
String(:name, :limit => 50, :null => false)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def down
|
13
|
-
drop_table(:divisions)
|
14
|
-
end
|
15
|
-
end
|
1
|
+
class CreateDivisions < Sequel::Migration
|
2
|
+
def up
|
3
|
+
create_table(:divisions) do
|
4
|
+
primary_key(:id)
|
5
|
+
DateTime(:created_at)
|
6
|
+
DateTime(:updated_at)
|
7
|
+
foreign_key(:league_id, :table => :leagues)
|
8
|
+
String(:name, :limit => 50, :null => false)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
drop_table(:divisions)
|
14
|
+
end
|
15
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
class CreateDrafts < Sequel::Migration
|
2
|
-
def up
|
3
|
-
create_table(:drafts) do
|
4
|
-
primary_key(:id)
|
5
|
-
DateTime(:created_at)
|
6
|
-
DateTime(:updated_at)
|
7
|
-
foreign_key(:player_id, :table => :players)
|
8
|
-
foreign_key(:team_id, :table => :teams)
|
9
|
-
Date(:date)
|
10
|
-
Integer(:round)
|
11
|
-
Integer(:pick)
|
12
|
-
Integer(:overall)
|
13
|
-
String(:college, :limit => 100)
|
14
|
-
String(:notes, :text=>true)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def down
|
19
|
-
drop_table(:drafts)
|
20
|
-
end
|
21
|
-
end
|
1
|
+
class CreateDrafts < Sequel::Migration
|
2
|
+
def up
|
3
|
+
create_table(:drafts) do
|
4
|
+
primary_key(:id)
|
5
|
+
DateTime(:created_at)
|
6
|
+
DateTime(:updated_at)
|
7
|
+
foreign_key(:player_id, :table => :players)
|
8
|
+
foreign_key(:team_id, :table => :teams)
|
9
|
+
Date(:date)
|
10
|
+
Integer(:round)
|
11
|
+
Integer(:pick)
|
12
|
+
Integer(:overall)
|
13
|
+
String(:college, :limit => 100)
|
14
|
+
String(:notes, :text => true)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def down
|
19
|
+
drop_table(:drafts)
|
20
|
+
end
|
21
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
class CreateLeagues < Sequel::Migration
|
2
|
-
def up
|
3
|
-
create_table(:leagues) do
|
4
|
-
primary_key(:id)
|
5
|
-
DateTime(:created_at)
|
6
|
-
DateTime(:updated_at)
|
7
|
-
String(:name, :limit => 50, :null => false)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def down
|
12
|
-
drop_table(:leagues)
|
13
|
-
end
|
14
|
-
end
|
1
|
+
class CreateLeagues < Sequel::Migration
|
2
|
+
def up
|
3
|
+
create_table(:leagues) do
|
4
|
+
primary_key(:id)
|
5
|
+
DateTime(:created_at)
|
6
|
+
DateTime(:updated_at)
|
7
|
+
String(:name, :limit => 50, :null => false)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def down
|
12
|
+
drop_table(:leagues)
|
13
|
+
end
|
14
|
+
end
|
@@ -1,22 +1,21 @@
|
|
1
|
-
class CreatePlayers < Sequel::Migration
|
2
|
-
def up
|
3
|
-
create_table(:players) do
|
4
|
-
primary_key(:id)
|
5
|
-
DateTime(:created_at)
|
6
|
-
DateTime(:updated_at)
|
7
|
-
|
8
|
-
|
9
|
-
String(:
|
10
|
-
|
11
|
-
|
12
|
-
TrueClass(:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
1
|
+
class CreatePlayers < Sequel::Migration
|
2
|
+
def up
|
3
|
+
create_table(:players) do
|
4
|
+
primary_key(:id)
|
5
|
+
DateTime(:created_at)
|
6
|
+
DateTime(:updated_at)
|
7
|
+
foreign_key(:team_id, :table => :teams)
|
8
|
+
String(:name, :limit => 100, :null => false)
|
9
|
+
String(:position, :limit => 50)
|
10
|
+
Integer(:number, :null => false)
|
11
|
+
TrueClass(:retired, :default => false)
|
12
|
+
TrueClass(:injured, :default => false)
|
13
|
+
Date(:born_on)
|
14
|
+
String(:notes, :text => true)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def down
|
19
|
+
drop_table(:players)
|
20
|
+
end
|
21
|
+
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
class CreateTeams < Sequel::Migration
|
2
|
-
def up
|
3
|
-
create_table(:teams) do
|
4
|
-
primary_key(:id)
|
5
|
-
DateTime(:created_at)
|
6
|
-
DateTime(:updated_at)
|
7
|
-
foreign_key(:league_id, :table => :leagues)
|
8
|
-
foreign_key(:division_id, :table => :divisions)
|
9
|
-
String(:name, :limit => 50)
|
10
|
-
String(:logo_url, :limit => 255)
|
11
|
-
String(:manager, :limit => 100, :null => false)
|
12
|
-
String(:ballpark, :limit => 100)
|
13
|
-
String(:mascot, :limit => 100)
|
14
|
-
Integer(:founded)
|
15
|
-
Integer(:wins)
|
16
|
-
Integer(:losses)
|
17
|
-
Float(:win_percentage)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def down
|
22
|
-
drop_table(:teams)
|
23
|
-
end
|
24
|
-
end
|
1
|
+
class CreateTeams < Sequel::Migration
|
2
|
+
def up
|
3
|
+
create_table(:teams) do
|
4
|
+
primary_key(:id)
|
5
|
+
DateTime(:created_at)
|
6
|
+
DateTime(:updated_at)
|
7
|
+
foreign_key(:league_id, :table => :leagues)
|
8
|
+
foreign_key(:division_id, :table => :divisions)
|
9
|
+
String(:name, :limit => 50)
|
10
|
+
String(:logo_url, :limit => 255)
|
11
|
+
String(:manager, :limit => 100, :null => false)
|
12
|
+
String(:ballpark, :limit => 100)
|
13
|
+
String(:mascot, :limit => 100)
|
14
|
+
Integer(:founded)
|
15
|
+
Integer(:wins)
|
16
|
+
Integer(:losses)
|
17
|
+
Float(:win_percentage)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def down
|
22
|
+
drop_table(:teams)
|
23
|
+
end
|
24
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
class Division < ActiveRecord::Base
|
2
|
-
validates_numericality_of(:league_id, :only_integer => true)
|
3
|
-
validates_presence_of(:name)
|
4
|
-
|
5
|
-
belongs_to(:league)
|
6
|
-
has_many(:teams)
|
7
|
-
end
|
1
|
+
class Division < ActiveRecord::Base
|
2
|
+
validates_numericality_of(:league_id, :only_integer => true)
|
3
|
+
validates_presence_of(:name)
|
4
|
+
|
5
|
+
belongs_to(:league)
|
6
|
+
has_many(:teams)
|
7
|
+
end
|