merb-admin 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. data/.gitignore +29 -27
  2. data/Gemfile +24 -22
  3. data/Gemfile.lock +86 -0
  4. data/LICENSE +20 -20
  5. data/README.rdoc +54 -58
  6. data/Rakefile +11 -44
  7. data/app/controllers/application.rb +6 -6
  8. data/app/controllers/main.rb +191 -191
  9. data/app/helpers/application_helper.rb +64 -64
  10. data/app/helpers/main_helper.rb +167 -167
  11. data/app/models/.gitkeep +0 -0
  12. data/app/views/layout/_message.html.erb +10 -10
  13. data/app/views/layout/dashboard.html.erb +34 -34
  14. data/app/views/layout/form.html.erb +48 -48
  15. data/app/views/layout/list.html.erb +42 -42
  16. data/app/views/main/_belongs_to.html.erb +29 -29
  17. data/app/views/main/_big_decimal.html.erb +12 -12
  18. data/app/views/main/_boolean.html.erb +7 -7
  19. data/app/views/main/_date.html.erb +12 -12
  20. data/app/views/main/_datetime.html.erb +12 -12
  21. data/app/views/main/_float.html.erb +12 -12
  22. data/app/views/main/_has_many.html.erb +16 -16
  23. data/app/views/main/_has_one.html.erb +30 -30
  24. data/app/views/main/_integer.html.erb +12 -12
  25. data/app/views/main/_properties.html.erb +18 -18
  26. data/app/views/main/_string.html.erb +15 -15
  27. data/app/views/main/_text.html.erb +11 -11
  28. data/app/views/main/_time.html.erb +12 -12
  29. data/app/views/main/_timestamp.html.erb +12 -12
  30. data/app/views/main/delete.html.erb +28 -28
  31. data/app/views/main/edit.html.erb +19 -19
  32. data/app/views/main/index.html.erb +22 -22
  33. data/app/views/main/list.html.erb +93 -93
  34. data/app/views/main/new.html.erb +16 -16
  35. data/config/init.rb +30 -0
  36. data/config/router.rb +4 -0
  37. data/lib/abstract_model.rb +84 -86
  38. data/lib/active_record_support.rb +147 -147
  39. data/lib/datamapper_support.rb +139 -140
  40. data/lib/generic_support.rb +13 -13
  41. data/lib/merb-admin.rb +99 -99
  42. data/lib/merb-admin/merbtasks.rb +103 -103
  43. data/lib/merb-admin/slicetasks.rb +174 -174
  44. data/lib/merb-admin/spectasks.rb +55 -55
  45. data/lib/merb-admin/version.rb +3 -0
  46. data/lib/sequel_support.rb +275 -275
  47. data/merb-admin.gemspec +42 -232
  48. data/public/javascripts/CollapsedFieldsets.js +85 -85
  49. data/public/javascripts/DateTimeShortcuts.js +255 -255
  50. data/public/javascripts/RelatedObjectLookups.js +96 -96
  51. data/public/javascripts/SelectBox.js +111 -111
  52. data/public/javascripts/SelectFilter2.js +113 -113
  53. data/public/javascripts/actions.js +39 -39
  54. data/public/javascripts/calendar.js +143 -143
  55. data/public/javascripts/core.js +176 -176
  56. data/public/javascripts/dateparse.js +233 -233
  57. data/public/javascripts/getElementsBySelector.js +167 -167
  58. data/public/javascripts/i18n.js +33 -33
  59. data/public/javascripts/ordering.js +137 -137
  60. data/public/javascripts/timeparse.js +94 -94
  61. data/public/javascripts/urlify.js +140 -140
  62. data/public/stylesheets/base.css +746 -746
  63. data/public/stylesheets/changelists.css +269 -269
  64. data/public/stylesheets/dashboard.css +24 -24
  65. data/public/stylesheets/forms.css +327 -327
  66. data/public/stylesheets/global.css +142 -142
  67. data/public/stylesheets/ie.css +50 -50
  68. data/public/stylesheets/layout.css +29 -29
  69. data/public/stylesheets/login.css +54 -54
  70. data/public/stylesheets/master.css +1 -1
  71. data/public/stylesheets/patch-iewin.css +7 -7
  72. data/public/stylesheets/rtl.css +206 -206
  73. data/public/stylesheets/widgets.css +506 -506
  74. data/screenshots/create.png +0 -0
  75. data/screenshots/delete.png +0 -0
  76. data/screenshots/edit.png +0 -0
  77. data/screenshots/index.png +0 -0
  78. data/screenshots/list.png +0 -0
  79. data/screenshots/new.png +0 -0
  80. data/spec/controllers/main_spec.rb +25 -25
  81. data/spec/migrations/activerecord/001_create_divisions_migration.rb +13 -13
  82. data/spec/migrations/activerecord/002_create_drafts_migration.rb +19 -19
  83. data/spec/migrations/activerecord/003_create_leagues_migration.rb +12 -12
  84. data/spec/migrations/activerecord/004_create_players_migration.rb +19 -20
  85. data/spec/migrations/activerecord/005_create_teams_migration.rb +22 -22
  86. data/spec/migrations/sequel/001_create_divisions_migration.rb +15 -15
  87. data/spec/migrations/sequel/002_create_drafts_migration.rb +21 -21
  88. data/spec/migrations/sequel/003_create_leagues_migration.rb +14 -14
  89. data/spec/migrations/sequel/004_create_players_migration.rb +21 -22
  90. data/spec/migrations/sequel/005_create_teams_migration.rb +24 -24
  91. data/spec/models/activerecord/division.rb +7 -7
  92. data/spec/models/activerecord/draft.rb +11 -11
  93. data/spec/models/activerecord/league.rb +6 -6
  94. data/spec/models/activerecord/player.rb +8 -8
  95. data/spec/models/activerecord/team.rb +13 -13
  96. data/spec/models/datamapper/division.rb +12 -12
  97. data/spec/models/datamapper/draft.rb +18 -18
  98. data/spec/models/datamapper/league.rb +11 -11
  99. data/spec/models/datamapper/player.rb +20 -21
  100. data/spec/models/datamapper/team.rb +22 -22
  101. data/spec/models/sequel/division.rb +15 -15
  102. data/spec/models/sequel/draft.rb +19 -19
  103. data/spec/models/sequel/league.rb +14 -14
  104. data/spec/models/sequel/player.rb +18 -18
  105. data/spec/models/sequel/team.rb +21 -21
  106. data/spec/requests/main_spec.rb +763 -763
  107. data/spec/spec_helper.rb +113 -112
  108. metadata +247 -41
  109. data/VERSION +0 -1
Binary file
Binary file
Binary file
Binary file
Binary file
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.datetime(:deleted_at)
6
- t.integer(:team_id)
7
- t.string(:name, :limit => 100, :null => false)
8
- t.string(:position, :limit => 50)
9
- t.integer(:number, :null => false)
10
- t.boolean(:retired, :default => false)
11
- t.boolean(:injured, :default => false)
12
- t.date(:born_on)
13
- t.text(:notes)
14
- end
15
- end
16
-
17
- def self.down
18
- drop_table(:players)
19
- end
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
- DateTime(:deleted_at)
8
- foreign_key(:team_id, :table => :teams)
9
- String(:name, :limit => 100, :null => false)
10
- String(:position, :limit => 50)
11
- Integer(:number, :null => false)
12
- TrueClass(:retired, :default => false)
13
- TrueClass(:injured, :default => false)
14
- Date(:born_on)
15
- String(:notes, :text=>true)
16
- end
17
- end
18
-
19
- def down
20
- drop_table(:players)
21
- end
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