merb-admin 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/LICENSE +20 -0
  2. data/README.markdown +58 -0
  3. data/Rakefile +64 -0
  4. data/app/controllers/application.rb +6 -0
  5. data/app/controllers/main.rb +145 -0
  6. data/app/helpers/application_helper.rb +64 -0
  7. data/app/helpers/main_helper.rb +122 -0
  8. data/app/views/layout/_message.html.erb +10 -0
  9. data/app/views/layout/dashboard.html.erb +34 -0
  10. data/app/views/layout/form.html.erb +48 -0
  11. data/app/views/layout/list.html.erb +42 -0
  12. data/app/views/main/_belongs_to.html.erb +29 -0
  13. data/app/views/main/_big_decimal.html.erb +12 -0
  14. data/app/views/main/_boolean.html.erb +7 -0
  15. data/app/views/main/_date.html.erb +12 -0
  16. data/app/views/main/_datetime.html.erb +12 -0
  17. data/app/views/main/_float.html.erb +12 -0
  18. data/app/views/main/_has_many.html.erb +16 -0
  19. data/app/views/main/_has_one.html.erb +30 -0
  20. data/app/views/main/_integer.html.erb +18 -0
  21. data/app/views/main/_properties.html.erb +18 -0
  22. data/app/views/main/_string.html.erb +12 -0
  23. data/app/views/main/_text.html.erb +11 -0
  24. data/app/views/main/_time.html.erb +12 -0
  25. data/app/views/main/_timestamp.html.erb +12 -0
  26. data/app/views/main/delete.html.erb +12 -0
  27. data/app/views/main/edit.html.erb +25 -0
  28. data/app/views/main/index.html.erb +22 -0
  29. data/app/views/main/list.html.erb +72 -0
  30. data/app/views/main/new.html.erb +22 -0
  31. data/lib/abstract_model.rb +67 -0
  32. data/lib/activerecord_support.rb +169 -0
  33. data/lib/datamapper_support.rb +157 -0
  34. data/lib/generic_support.rb +17 -0
  35. data/lib/merb-admin/merbtasks.rb +103 -0
  36. data/lib/merb-admin/slicetasks.rb +20 -0
  37. data/lib/merb-admin/spectasks.rb +53 -0
  38. data/lib/merb-admin.rb +99 -0
  39. data/public/images/arrow-down.gif +0 -0
  40. data/public/images/arrow-up.gif +0 -0
  41. data/public/images/changelist-bg.gif +0 -0
  42. data/public/images/changelist-bg_rtl.gif +0 -0
  43. data/public/images/chooser-bg.gif +0 -0
  44. data/public/images/chooser_stacked-bg.gif +0 -0
  45. data/public/images/default-bg-reverse.gif +0 -0
  46. data/public/images/default-bg.gif +0 -0
  47. data/public/images/deleted-overlay.gif +0 -0
  48. data/public/images/icon-no.gif +0 -0
  49. data/public/images/icon-unknown.gif +0 -0
  50. data/public/images/icon-yes.gif +0 -0
  51. data/public/images/icon_addlink.gif +0 -0
  52. data/public/images/icon_alert.gif +0 -0
  53. data/public/images/icon_calendar.gif +0 -0
  54. data/public/images/icon_changelink.gif +0 -0
  55. data/public/images/icon_clock.gif +0 -0
  56. data/public/images/icon_deletelink.gif +0 -0
  57. data/public/images/icon_error.gif +0 -0
  58. data/public/images/icon_searchbox.png +0 -0
  59. data/public/images/icon_success.gif +0 -0
  60. data/public/images/inline-delete-8bit.png +0 -0
  61. data/public/images/inline-delete.png +0 -0
  62. data/public/images/inline-restore-8bit.png +0 -0
  63. data/public/images/inline-restore.png +0 -0
  64. data/public/images/inline-splitter-bg.gif +0 -0
  65. data/public/images/nav-bg-grabber.gif +0 -0
  66. data/public/images/nav-bg-reverse.gif +0 -0
  67. data/public/images/nav-bg.gif +0 -0
  68. data/public/images/selector-add.gif +0 -0
  69. data/public/images/selector-addall.gif +0 -0
  70. data/public/images/selector-remove.gif +0 -0
  71. data/public/images/selector-removeall.gif +0 -0
  72. data/public/images/selector-search.gif +0 -0
  73. data/public/images/selector_stacked-add.gif +0 -0
  74. data/public/images/selector_stacked-remove.gif +0 -0
  75. data/public/images/tool-left.gif +0 -0
  76. data/public/images/tool-left_over.gif +0 -0
  77. data/public/images/tool-right.gif +0 -0
  78. data/public/images/tool-right_over.gif +0 -0
  79. data/public/images/tooltag-add.gif +0 -0
  80. data/public/images/tooltag-add_over.gif +0 -0
  81. data/public/images/tooltag-arrowright.gif +0 -0
  82. data/public/images/tooltag-arrowright_over.gif +0 -0
  83. data/public/javascripts/CollapsedFieldsets.js +85 -0
  84. data/public/javascripts/DateTimeShortcuts.js +255 -0
  85. data/public/javascripts/RelatedObjectLookups.js +96 -0
  86. data/public/javascripts/SelectBox.js +111 -0
  87. data/public/javascripts/SelectFilter2.js +113 -0
  88. data/public/javascripts/actions.js +39 -0
  89. data/public/javascripts/calendar.js +143 -0
  90. data/public/javascripts/core.js +176 -0
  91. data/public/javascripts/dateparse.js +233 -0
  92. data/public/javascripts/getElementsBySelector.js +167 -0
  93. data/public/javascripts/i18n.js +33 -0
  94. data/public/javascripts/master.js +0 -0
  95. data/public/javascripts/ordering.js +137 -0
  96. data/public/javascripts/timeparse.js +94 -0
  97. data/public/javascripts/urlify.js +140 -0
  98. data/public/stylesheets/base.css +746 -0
  99. data/public/stylesheets/changelists.css +269 -0
  100. data/public/stylesheets/dashboard.css +24 -0
  101. data/public/stylesheets/forms.css +327 -0
  102. data/public/stylesheets/global.css +142 -0
  103. data/public/stylesheets/ie.css +51 -0
  104. data/public/stylesheets/layout.css +29 -0
  105. data/public/stylesheets/login.css +54 -0
  106. data/public/stylesheets/master.css +2 -0
  107. data/public/stylesheets/null.css +1 -0
  108. data/public/stylesheets/patch-iewin.css +8 -0
  109. data/public/stylesheets/rtl.css +206 -0
  110. data/public/stylesheets/widgets.css +506 -0
  111. data/schema/migrations/001_create_divisions_migration.rb +15 -0
  112. data/schema/migrations/002_create_drafts_migration.rb +21 -0
  113. data/schema/migrations/003_create_leagues_migration.rb +13 -0
  114. data/schema/migrations/004_create_players_migration.rb +23 -0
  115. data/schema/migrations/005_create_teams_migration.rb +18 -0
  116. data/spec/controllers/main_spec.rb +25 -0
  117. data/spec/models/activerecord/division.rb +8 -0
  118. data/spec/models/activerecord/draft.rb +16 -0
  119. data/spec/models/activerecord/league.rb +6 -0
  120. data/spec/models/activerecord/player.rb +10 -0
  121. data/spec/models/activerecord/team.rb +11 -0
  122. data/spec/models/datamapper/division.rb +12 -0
  123. data/spec/models/datamapper/draft.rb +18 -0
  124. data/spec/models/datamapper/league.rb +11 -0
  125. data/spec/models/datamapper/player.rb +21 -0
  126. data/spec/models/datamapper/team.rb +15 -0
  127. data/spec/requests/main_spec.rb +475 -0
  128. data/spec/spec_helper.rb +112 -0
  129. metadata +209 -0
@@ -0,0 +1,506 @@
1
+ /* SELECTOR (FILTER INTERFACE) */
2
+
3
+ .selector {
4
+ width: 580px;
5
+ float: left;
6
+ }
7
+
8
+ .selector select {
9
+ width: 270px;
10
+ height: 17.2em;
11
+ }
12
+
13
+ .selector-available, .selector-chosen {
14
+ float: left;
15
+ width: 270px;
16
+ text-align: center;
17
+ margin-bottom: 5px;
18
+ }
19
+
20
+ .selector-available h2, .selector-chosen h2 {
21
+ border: 1px solid #ccc;
22
+ }
23
+
24
+ .selector .selector-available h2 {
25
+ background: white url(../images/nav-bg.gif) bottom left repeat-x;
26
+ color: #666;
27
+ }
28
+
29
+ .selector .selector-filter {
30
+ background: white;
31
+ border: 1px solid #ccc;
32
+ border-width: 0 1px;
33
+ padding: 3px;
34
+ color: #999;
35
+ font-size: 10px;
36
+ margin: 0;
37
+ text-align: left;
38
+ }
39
+
40
+ .selector .selector-chosen .selector-filter {
41
+ padding: 4px 5px;
42
+ }
43
+
44
+ .selector .selector-available input {
45
+ width: 230px;
46
+ }
47
+
48
+ .selector ul.selector-chooser {
49
+ float: left;
50
+ width: 22px;
51
+ height: 50px;
52
+ background: url(../images/chooser-bg.gif) top center no-repeat;
53
+ margin: 8em 3px 0 3px;
54
+ padding: 0;
55
+ }
56
+
57
+ .selector-chooser li {
58
+ margin: 0;
59
+ padding: 3px;
60
+ list-style-type: none;
61
+ }
62
+
63
+ .selector select {
64
+ margin-bottom: 5px;
65
+ margin-top: 0;
66
+ }
67
+
68
+ .selector-add, .selector-remove {
69
+ width: 16px;
70
+ height: 16px;
71
+ display: block;
72
+ text-indent: -3000px;
73
+ }
74
+
75
+ .selector-add {
76
+ background: url(../images/selector-add.gif) top center no-repeat;
77
+ margin-bottom: 2px;
78
+ }
79
+
80
+ .selector-remove {
81
+ background: url(../images/selector-remove.gif) top center no-repeat;
82
+ }
83
+
84
+ a.selector-chooseall, a.selector-clearall {
85
+ display: block;
86
+ width: 6em;
87
+ text-align: left;
88
+ margin-left: auto;
89
+ margin-right: auto;
90
+ font-weight: bold;
91
+ color: #666;
92
+ padding: 3px 0 3px 18px;
93
+ }
94
+
95
+ a.selector-chooseall:hover, a.selector-clearall:hover {
96
+ color: #036;
97
+ }
98
+
99
+ a.selector-chooseall {
100
+ width: 7em;
101
+ background: url(../images/selector-addall.gif) left center no-repeat;
102
+ }
103
+
104
+ a.selector-clearall {
105
+ background: url(../images/selector-removeall.gif) left center no-repeat;
106
+ }
107
+
108
+
109
+ /* STACKED SELECTORS */
110
+
111
+ .stacked {
112
+ float: left;
113
+ width: 500px;
114
+ }
115
+
116
+ .stacked select {
117
+ width: 480px;
118
+ height: 10.1em;
119
+ }
120
+
121
+ .stacked .selector-available, .stacked .selector-chosen {
122
+ width: 480px;
123
+ }
124
+
125
+ .stacked .selector-available {
126
+ margin-bottom: 0;
127
+ }
128
+
129
+ .stacked .selector-available input {
130
+ width: 442px;
131
+ }
132
+
133
+ .stacked ul.selector-chooser {
134
+ height: 22px;
135
+ width: 50px;
136
+ margin: 0 0 3px 40%;
137
+ background: url(../images/chooser_stacked-bg.gif) top center no-repeat;
138
+ }
139
+
140
+ .stacked .selector-chooser li {
141
+ float: left;
142
+ padding: 3px 3px 3px 5px;
143
+ }
144
+
145
+ .stacked .selector-chooseall, .stacked .selector-clearall {
146
+ display: none;
147
+ }
148
+
149
+ .stacked .selector-add {
150
+ background-image: url(../images/selector_stacked-add.gif);
151
+ }
152
+
153
+ .stacked .selector-remove {
154
+ background-image: url(../images/selector_stacked-remove.gif);
155
+ }
156
+
157
+
158
+ /* DATE AND TIME */
159
+
160
+ p.datetime {
161
+ line-height: 20px;
162
+ margin: 0;
163
+ padding: 0;
164
+ color: #666;
165
+ font-size: 11px;
166
+ font-weight: bold;
167
+ }
168
+
169
+ .datetime span {
170
+ font-size: 11px;
171
+ color: #ccc;
172
+ font-weight: normal;
173
+ white-space: nowrap;
174
+ }
175
+
176
+ table p.datetime {
177
+ font-size: 10px;
178
+ margin-left: 0;
179
+ padding-left: 0;
180
+ }
181
+
182
+ /* FILE UPLOADS */
183
+
184
+ p.file-upload {
185
+ line-height: 20px;
186
+ margin: 0;
187
+ padding: 0;
188
+ color: #666;
189
+ font-size: 11px;
190
+ font-weight: bold;
191
+ }
192
+
193
+ .file-upload a {
194
+ font-weight: normal;
195
+ }
196
+
197
+ .file-upload .deletelink {
198
+ margin-left: 5px;
199
+ }
200
+
201
+ /* CALENDARS & CLOCKS */
202
+
203
+ .calendarbox, .clockbox {
204
+ margin: 5px auto;
205
+ font-size: 11px;
206
+ width: 16em;
207
+ text-align: center;
208
+ background: white;
209
+ position: relative;
210
+ }
211
+
212
+ .clockbox {
213
+ width: auto;
214
+ }
215
+
216
+ .calendar {
217
+ margin: 0;
218
+ padding: 0;
219
+ }
220
+
221
+ .calendar table {
222
+ margin: 0;
223
+ padding: 0;
224
+ border-collapse: collapse;
225
+ background: white;
226
+ width: 99%;
227
+ }
228
+
229
+ .calendar caption, .calendarbox h2 {
230
+ margin: 0;
231
+ font-size: 11px;
232
+ text-align: center;
233
+ border-top: none;
234
+ }
235
+
236
+ .calendar th {
237
+ font-size: 10px;
238
+ color: #666;
239
+ padding: 2px 3px;
240
+ text-align: center;
241
+ background: #e1e1e1 url(../images/nav-bg.gif) 0 50% repeat-x;
242
+ border-bottom: 1px solid #ddd;
243
+ }
244
+
245
+ .calendar td {
246
+ font-size: 11px;
247
+ text-align: center;
248
+ padding: 0;
249
+ border-top: 1px solid #eee;
250
+ border-bottom: none;
251
+ }
252
+
253
+ .calendar td.selected a {
254
+ background: #C9DBED;
255
+ }
256
+
257
+ .calendar td.nonday {
258
+ background: #efefef;
259
+ }
260
+
261
+ .calendar td.today a {
262
+ background: #ffc;
263
+ }
264
+
265
+ .calendar td a, .timelist a {
266
+ display: block;
267
+ font-weight: bold;
268
+ padding: 4px;
269
+ text-decoration: none;
270
+ color: #444;
271
+ }
272
+
273
+ .calendar td a:hover, .timelist a:hover {
274
+ background: #5b80b2;
275
+ color: white;
276
+ }
277
+
278
+ .calendar td a:active, .timelist a:active {
279
+ background: #036;
280
+ color: white;
281
+ }
282
+
283
+ .calendarnav {
284
+ font-size: 10px;
285
+ text-align: center;
286
+ color: #ccc;
287
+ margin: 0;
288
+ padding: 1px 3px;
289
+ }
290
+
291
+ .calendarnav a:link, #calendarnav a:visited, #calendarnav a:hover {
292
+ color: #999;
293
+ }
294
+
295
+ .calendar-shortcuts {
296
+ background: white;
297
+ font-size: 10px;
298
+ line-height: 11px;
299
+ border-top: 1px solid #eee;
300
+ padding: 3px 0 4px;
301
+ color: #ccc;
302
+ }
303
+
304
+ .calendarbox .calendarnav-previous, .calendarbox .calendarnav-next {
305
+ display: block;
306
+ position: absolute;
307
+ font-weight: bold;
308
+ font-size: 12px;
309
+ background: #C9DBED url(../images/default-bg.gif) bottom left repeat-x;
310
+ padding: 1px 4px 2px 4px;
311
+ color: white;
312
+ }
313
+
314
+ .calendarnav-previous:hover, .calendarnav-next:hover {
315
+ background: #036;
316
+ }
317
+
318
+ .calendarnav-previous {
319
+ top: 0;
320
+ left: 0;
321
+ }
322
+
323
+ .calendarnav-next {
324
+ top: 0;
325
+ right: 0;
326
+ }
327
+
328
+ .calendar-cancel {
329
+ margin: 0 !important;
330
+ padding: 0;
331
+ font-size: 10px;
332
+ background: #e1e1e1 url(../images/nav-bg.gif) 0 50% repeat-x;
333
+ border-top: 1px solid #ddd;
334
+ }
335
+
336
+ .calendar-cancel a {
337
+ padding: 2px;
338
+ color: #999;
339
+ }
340
+
341
+ ul.timelist, .timelist li {
342
+ list-style-type: none;
343
+ margin: 0;
344
+ padding: 0;
345
+ }
346
+
347
+ .timelist a {
348
+ padding: 2px;
349
+ }
350
+
351
+ /* INLINE ORDERER */
352
+
353
+ ul.orderer {
354
+ position: relative;
355
+ padding: 0 !important;
356
+ margin: 0 !important;
357
+ list-style-type: none;
358
+ }
359
+
360
+ ul.orderer li {
361
+ list-style-type: none;
362
+ display: block;
363
+ padding: 0;
364
+ margin: 0;
365
+ border: 1px solid #bbb;
366
+ border-width: 0 1px 1px 0;
367
+ white-space: nowrap;
368
+ overflow: hidden;
369
+ background: #e2e2e2 url(../images/nav-bg-grabber.gif) repeat-y;
370
+ }
371
+
372
+ ul.orderer li:hover {
373
+ cursor: move;
374
+ background-color: #ddd;
375
+ }
376
+
377
+ ul.orderer li a.selector {
378
+ margin-left: 12px;
379
+ overflow: hidden;
380
+ width: 83%;
381
+ font-size: 10px !important;
382
+ padding: 0.6em 0;
383
+ }
384
+
385
+ ul.orderer li a:link, ul.orderer li a:visited {
386
+ color: #333;
387
+ }
388
+
389
+ ul.orderer li .inline-deletelink {
390
+ position: absolute;
391
+ right: 4px;
392
+ margin-top: 0.6em;
393
+ }
394
+
395
+ ul.orderer li.selected {
396
+ background-color: #f8f8f8;
397
+ border-right-color: #f8f8f8;
398
+ }
399
+
400
+ ul.orderer li.deleted {
401
+ background: #bbb url(../images/deleted-overlay.gif);
402
+ }
403
+
404
+ ul.orderer li.deleted a:link, ul.orderer li.deleted a:visited {
405
+ color: #888;
406
+ }
407
+
408
+ ul.orderer li.deleted .inline-deletelink {
409
+ background-image: url(../images/inline-restore.png);
410
+ }
411
+
412
+ ul.orderer li.deleted:hover, ul.orderer li.deleted a.selector:hover {
413
+ cursor: default;
414
+ }
415
+
416
+ /* EDIT INLINE */
417
+
418
+ .inline-deletelink {
419
+ display: block;
420
+ text-indent: -9999px;
421
+ background: transparent url(../images/inline-delete.png) no-repeat;
422
+ width: 15px;
423
+ height: 15px;
424
+ margin: 0.4em 0;
425
+ border: 0px none;
426
+ }
427
+
428
+ .inline-deletelink:hover {
429
+ background-position: -15px 0;
430
+ cursor: pointer;
431
+ }
432
+
433
+ .editinline button.addlink {
434
+ border: 0px none;
435
+ color: #5b80b2;
436
+ font-size: 100%;
437
+ cursor: pointer;
438
+ }
439
+
440
+ .editinline button.addlink:hover {
441
+ color: #036;
442
+ cursor: pointer;
443
+ }
444
+
445
+ .editinline table .help {
446
+ text-align: right;
447
+ float: right;
448
+ padding-left: 2em;
449
+ }
450
+
451
+ .editinline tfoot .addlink {
452
+ white-space: nowrap;
453
+ }
454
+
455
+ .editinline table thead th:last-child {
456
+ border-left: none;
457
+ }
458
+
459
+ .editinline tr.deleted {
460
+ background: #ddd url(../images/deleted-overlay.gif);
461
+ }
462
+
463
+ .editinline tr.deleted .inline-deletelink {
464
+ background-image: url(../images/inline-restore.png);
465
+ }
466
+
467
+ .editinline tr.deleted td:hover {
468
+ cursor: default;
469
+ }
470
+
471
+ .editinline tr.deleted td:first-child {
472
+ background-image: none !important;
473
+ }
474
+
475
+ /* EDIT INLINE - STACKED */
476
+
477
+ .editinline-stacked {
478
+ min-width: 758px;
479
+ }
480
+
481
+ .editinline-stacked .inline-object {
482
+ margin-left: 210px;
483
+ background: white;
484
+ }
485
+
486
+ .editinline-stacked .inline-source {
487
+ float: left;
488
+ width: 200px;
489
+ background: #f8f8f8;
490
+ }
491
+
492
+ .editinline-stacked .inline-splitter {
493
+ float: left;
494
+ width: 9px;
495
+ background: #f8f8f8 url(../images/inline-splitter-bg.gif) 50% 50% no-repeat;
496
+ border-right: 1px solid #ccc;
497
+ }
498
+
499
+ .editinline-stacked .controls {
500
+ clear: both;
501
+ background: #e1e1e1 url(../images/nav-bg.gif) top left repeat-x;
502
+ padding: 3px 4px;
503
+ font-size: 11px;
504
+ border-top: 1px solid #ddd;
505
+ }
506
+
@@ -0,0 +1,15 @@
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
+ add_index :divisions, :league_id
9
+ add_index :divisions, :name
10
+ end
11
+
12
+ def self.down
13
+ drop_table :divisions
14
+ end
15
+ end
@@ -0,0 +1,21 @@
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
+ add_index :drafts, :player_id
15
+ add_index :drafts, :team_id
16
+ end
17
+
18
+ def self.down
19
+ drop_table :drafts
20
+ end
21
+ end
@@ -0,0 +1,13 @@
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
+ add_index :leagues, :name
8
+ end
9
+
10
+ def self.down
11
+ drop_table :leagues
12
+ end
13
+ end
@@ -0,0 +1,23 @@
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 => 50, :null => false
8
+ t.integer :number
9
+ t.integer :position
10
+ t.integer :sex
11
+ t.float :batting_average, :default => 0.0
12
+ t.boolean :injured, :default => false
13
+ t.date :born_on
14
+ t.timestamp :wake_at
15
+ t.text :notes
16
+ end
17
+ add_index :players, :team_id
18
+ end
19
+
20
+ def self.down
21
+ drop_table :players
22
+ end
23
+ end
@@ -0,0 +1,18 @@
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, :null => false
8
+ t.integer :colors
9
+ end
10
+ add_index :teams, :division_id
11
+ add_index :teams, :league_id
12
+ add_index :teams, :name
13
+ end
14
+
15
+ def self.down
16
+ drop_table :teams
17
+ end
18
+ end
@@ -0,0 +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
@@ -0,0 +1,8 @@
1
+ class Division < ActiveRecord::Base
2
+ validates_presence_of :league_id
3
+ validates_numericality_of :league_id
4
+ validates_presence_of :name
5
+
6
+ belongs_to :league
7
+ has_many :teams
8
+ end
@@ -0,0 +1,16 @@
1
+ class Draft < ActiveRecord::Base
2
+ validates_presence_of :player_id
3
+ validates_numericality_of :player_id
4
+ validates_presence_of :team_id
5
+ validates_numericality_of :team_id
6
+ validates_presence_of :date
7
+ validates_presence_of :round
8
+ validates_numericality_of :round
9
+ validates_presence_of :pick
10
+ validates_numericality_of :pick
11
+ validates_presence_of :overall
12
+ validates_numericality_of :overall
13
+
14
+ belongs_to :team
15
+ belongs_to :player
16
+ end
@@ -0,0 +1,6 @@
1
+ class League < ActiveRecord::Base
2
+ validates_presence_of :name
3
+
4
+ has_many :divisions
5
+ has_many :teams
6
+ end
@@ -0,0 +1,10 @@
1
+ class Player < ActiveRecord::Base
2
+ validates_presence_of :team_id
3
+ validates_numericality_of :team_id
4
+ validates_presence_of :name
5
+ validates_presence_of :number
6
+ validates_numericality_of :number
7
+
8
+ belongs_to :team
9
+ has_one :draft
10
+ end
@@ -0,0 +1,11 @@
1
+ class Team < ActiveRecord::Base
2
+ validates_presence_of :league_id
3
+ validates_numericality_of :league_id
4
+ validates_presence_of :division_id
5
+ validates_numericality_of :division_id
6
+ validates_presence_of :name
7
+
8
+ belongs_to :league
9
+ belongs_to :division
10
+ has_many :players
11
+ end
@@ -0,0 +1,12 @@
1
+ class Division
2
+ include DataMapper::Resource
3
+
4
+ property :id, Serial
5
+ property :created_at, DateTime
6
+ property :updated_at, DateTime
7
+ property :league_id, Integer, :nullable => false, :index => true
8
+ property :name, String, :nullable => false, :index => true
9
+
10
+ belongs_to :league
11
+ has n, :teams
12
+ end
@@ -0,0 +1,18 @@
1
+ class Draft
2
+ include DataMapper::Resource
3
+
4
+ property :id, Serial
5
+ property :created_at, DateTime
6
+ property :updated_at, DateTime
7
+ property :player_id, Integer, :nullable => false, :index => true
8
+ property :team_id, Integer, :nullable => false, :index => true
9
+ property :date, Date, :nullable => false
10
+ property :round, Integer, :nullable => false
11
+ property :pick, Integer, :nullable => false
12
+ property :overall, Integer, :nullable => false
13
+ property :college, String, :length => 100
14
+ property :notes, Text
15
+
16
+ belongs_to :team
17
+ belongs_to :player
18
+ end