Skip to content

Commit 56cb0e6

Browse files
committed
corrected test, added constraint to preveent input the autotimestamps, regenerated views
1 parent 855b5ee commit 56cb0e6

File tree

12 files changed

+38
-107
lines changed

12 files changed

+38
-107
lines changed

grails-app/domain/com/synergyj/grain/domain/CourseContent.groovy

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ abstract class CourseContent {
2727
static constraints = {
2828
name blank:false,nullable:false,size:1..50
2929
description blank:false,nullable:false,size:1..10000
30+
31+
lastUpdated display:false
32+
dateCreated display:false
3033
}
3134

3235
static mapping = {

grails-app/domain/com/synergyj/grain/domain/CourseModule.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package com.synergyj.grain.domain
1717

1818
class CourseModule extends CourseContent implements Comparable<CourseModule> {
1919
Course course
20-
Integer order = 100
20+
Integer order
2121
SortedSet topics
2222

2323
static hasMany = [topics:ModuleTopic]

grails-app/domain/com/synergyj/grain/domain/ModuleTopic.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package com.synergyj.grain.domain
1818
class ModuleTopic extends CourseContent implements Comparable<ModuleTopic> {
1919
CourseModule module
2020
ModuleTopic parent
21-
Integer order = 100
21+
Integer order
2222
SortedSet topics
2323

2424
static hasMany = [topics:ModuleTopic]

grails-app/views/course/create.gsp

-18
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,6 @@
6262
</td>
6363
</tr>
6464

65-
<tr class="prop">
66-
<td valign="top" class="name">
67-
<label for="dateCreated">Date Created:</label>
68-
</td>
69-
<td valign="top" class="value ${hasErrors(bean:courseInstance,field:'dateCreated','errors')}">
70-
<g:datePicker name="dateCreated" value="${courseInstance?.dateCreated}" ></g:datePicker>
71-
</td>
72-
</tr>
73-
74-
<tr class="prop">
75-
<td valign="top" class="name">
76-
<label for="lastUpdated">Last Updated:</label>
77-
</td>
78-
<td valign="top" class="value ${hasErrors(bean:courseInstance,field:'lastUpdated','errors')}">
79-
<g:datePicker name="lastUpdated" value="${courseInstance?.lastUpdated}" ></g:datePicker>
80-
</td>
81-
</tr>
82-
8365
</tbody>
8466
</table>
8567
</div>

grails-app/views/course/edit.gsp

-18
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,6 @@
6565
</td>
6666
</tr>
6767

68-
<tr class="prop">
69-
<td valign="top" class="name">
70-
<label for="dateCreated">Date Created:</label>
71-
</td>
72-
<td valign="top" class="value ${hasErrors(bean:courseInstance,field:'dateCreated','errors')}">
73-
<g:datePicker name="dateCreated" value="${courseInstance?.dateCreated}" ></g:datePicker>
74-
</td>
75-
</tr>
76-
77-
<tr class="prop">
78-
<td valign="top" class="name">
79-
<label for="lastUpdated">Last Updated:</label>
80-
</td>
81-
<td valign="top" class="value ${hasErrors(bean:courseInstance,field:'lastUpdated','errors')}">
82-
<g:datePicker name="lastUpdated" value="${courseInstance?.lastUpdated}" ></g:datePicker>
83-
</td>
84-
</tr>
85-
8668
<tr class="prop">
8769
<td valign="top" class="name">
8870
<label for="modules">Modules:</label>

grails-app/views/course/list.gsp

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727

2828
<g:sortableColumn property="description" title="Description" />
2929

30-
<th>Type</th>
31-
32-
<th>Status</th>
33-
30+
<g:sortableColumn property="lastUpdated" title="Last Updated" />
31+
3432
<g:sortableColumn property="dateCreated" title="Date Created" />
3533

34+
<th>Type</th>
35+
3636
</tr>
3737
</thead>
3838
<tbody>
@@ -45,12 +45,12 @@
4545

4646
<td>${fieldValue(bean:courseInstance, field:'description')}</td>
4747

48-
<td>${fieldValue(bean:courseInstance, field:'type')}</td>
49-
50-
<td>${fieldValue(bean:courseInstance, field:'status')}</td>
48+
<td>${fieldValue(bean:courseInstance, field:'lastUpdated')}</td>
5149

5250
<td>${fieldValue(bean:courseInstance, field:'dateCreated')}</td>
5351

52+
<td>${fieldValue(bean:courseInstance, field:'type')}</td>
53+
5454
</tr>
5555
</g:each>
5656
</tbody>

grails-app/views/course/show.gsp

+8-8
Original file line numberDiff line numberDiff line change
@@ -44,30 +44,30 @@
4444
</tr>
4545

4646
<tr class="prop">
47-
<td valign="top" class="name">Type:</td>
47+
<td valign="top" class="name">Last Updated:</td>
4848

49-
<td valign="top" class="value">${courseInstance?.type?.encodeAsHTML()}</td>
49+
<td valign="top" class="value">${fieldValue(bean:courseInstance, field:'lastUpdated')}</td>
5050

5151
</tr>
5252

5353
<tr class="prop">
54-
<td valign="top" class="name">Status:</td>
54+
<td valign="top" class="name">Date Created:</td>
5555

56-
<td valign="top" class="value">${courseInstance?.status?.encodeAsHTML()}</td>
56+
<td valign="top" class="value">${fieldValue(bean:courseInstance, field:'dateCreated')}</td>
5757

5858
</tr>
5959

6060
<tr class="prop">
61-
<td valign="top" class="name">Date Created:</td>
61+
<td valign="top" class="name">Type:</td>
6262

63-
<td valign="top" class="value">${fieldValue(bean:courseInstance, field:'dateCreated')}</td>
63+
<td valign="top" class="value">${courseInstance?.type?.encodeAsHTML()}</td>
6464

6565
</tr>
6666

6767
<tr class="prop">
68-
<td valign="top" class="name">Last Updated:</td>
68+
<td valign="top" class="name">Status:</td>
6969

70-
<td valign="top" class="value">${fieldValue(bean:courseInstance, field:'lastUpdated')}</td>
70+
<td valign="top" class="value">${courseInstance?.status?.encodeAsHTML()}</td>
7171

7272
</tr>
7373

grails-app/views/moduleTopic/create.gsp

-18
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,6 @@
7171
</td>
7272
</tr>
7373

74-
<tr class="prop">
75-
<td valign="top" class="name">
76-
<label for="dateCreated">Date Created:</label>
77-
</td>
78-
<td valign="top" class="value ${hasErrors(bean:moduleTopicInstance,field:'dateCreated','errors')}">
79-
<g:datePicker name="dateCreated" value="${moduleTopicInstance?.dateCreated}" ></g:datePicker>
80-
</td>
81-
</tr>
82-
83-
<tr class="prop">
84-
<td valign="top" class="name">
85-
<label for="lastUpdated">Last Updated:</label>
86-
</td>
87-
<td valign="top" class="value ${hasErrors(bean:moduleTopicInstance,field:'lastUpdated','errors')}">
88-
<g:datePicker name="lastUpdated" value="${moduleTopicInstance?.lastUpdated}" ></g:datePicker>
89-
</td>
90-
</tr>
91-
9274
</tbody>
9375
</table>
9476
</div>

grails-app/views/moduleTopic/edit.gsp

-18
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,6 @@
7474
</td>
7575
</tr>
7676

77-
<tr class="prop">
78-
<td valign="top" class="name">
79-
<label for="dateCreated">Date Created:</label>
80-
</td>
81-
<td valign="top" class="value ${hasErrors(bean:moduleTopicInstance,field:'dateCreated','errors')}">
82-
<g:datePicker name="dateCreated" value="${moduleTopicInstance?.dateCreated}" ></g:datePicker>
83-
</td>
84-
</tr>
85-
86-
<tr class="prop">
87-
<td valign="top" class="name">
88-
<label for="lastUpdated">Last Updated:</label>
89-
</td>
90-
<td valign="top" class="value ${hasErrors(bean:moduleTopicInstance,field:'lastUpdated','errors')}">
91-
<g:datePicker name="lastUpdated" value="${moduleTopicInstance?.lastUpdated}" ></g:datePicker>
92-
</td>
93-
</tr>
94-
9577
<tr class="prop">
9678
<td valign="top" class="name">
9779
<label for="topics">Topics:</label>

grails-app/views/moduleTopic/list.gsp

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727

2828
<g:sortableColumn property="description" title="Description" />
2929

30+
<g:sortableColumn property="lastUpdated" title="Last Updated" />
31+
32+
<g:sortableColumn property="dateCreated" title="Date Created" />
33+
3034
<th>Module</th>
3135

32-
<th>Parent</th>
33-
34-
<g:sortableColumn property="order" title="Order" />
35-
3636
</tr>
3737
</thead>
3838
<tbody>
@@ -45,11 +45,11 @@
4545

4646
<td>${fieldValue(bean:moduleTopicInstance, field:'description')}</td>
4747

48-
<td>${fieldValue(bean:moduleTopicInstance, field:'module')}</td>
48+
<td>${fieldValue(bean:moduleTopicInstance, field:'lastUpdated')}</td>
4949

50-
<td>${fieldValue(bean:moduleTopicInstance, field:'parent')}</td>
50+
<td>${fieldValue(bean:moduleTopicInstance, field:'dateCreated')}</td>
5151

52-
<td>${fieldValue(bean:moduleTopicInstance, field:'order')}</td>
52+
<td>${fieldValue(bean:moduleTopicInstance, field:'module')}</td>
5353

5454
</tr>
5555
</g:each>

grails-app/views/moduleTopic/show.gsp

+10-10
Original file line numberDiff line numberDiff line change
@@ -44,37 +44,37 @@
4444
</tr>
4545

4646
<tr class="prop">
47-
<td valign="top" class="name">Module:</td>
47+
<td valign="top" class="name">Last Updated:</td>
4848

49-
<td valign="top" class="value"><g:link controller="courseModule" action="show" id="${moduleTopicInstance?.module?.id}">${moduleTopicInstance?.module?.encodeAsHTML()}</g:link></td>
49+
<td valign="top" class="value">${fieldValue(bean:moduleTopicInstance, field:'lastUpdated')}</td>
5050

5151
</tr>
5252

5353
<tr class="prop">
54-
<td valign="top" class="name">Parent:</td>
54+
<td valign="top" class="name">Date Created:</td>
5555

56-
<td valign="top" class="value"><g:link controller="moduleTopic" action="show" id="${moduleTopicInstance?.parent?.id}">${moduleTopicInstance?.parent?.encodeAsHTML()}</g:link></td>
56+
<td valign="top" class="value">${fieldValue(bean:moduleTopicInstance, field:'dateCreated')}</td>
5757

5858
</tr>
5959

6060
<tr class="prop">
61-
<td valign="top" class="name">Order:</td>
61+
<td valign="top" class="name">Module:</td>
6262

63-
<td valign="top" class="value">${fieldValue(bean:moduleTopicInstance, field:'order')}</td>
63+
<td valign="top" class="value"><g:link controller="courseModule" action="show" id="${moduleTopicInstance?.module?.id}">${moduleTopicInstance?.module?.encodeAsHTML()}</g:link></td>
6464

6565
</tr>
6666

6767
<tr class="prop">
68-
<td valign="top" class="name">Date Created:</td>
68+
<td valign="top" class="name">Parent:</td>
6969

70-
<td valign="top" class="value">${fieldValue(bean:moduleTopicInstance, field:'dateCreated')}</td>
70+
<td valign="top" class="value"><g:link controller="moduleTopic" action="show" id="${moduleTopicInstance?.parent?.id}">${moduleTopicInstance?.parent?.encodeAsHTML()}</g:link></td>
7171

7272
</tr>
7373

7474
<tr class="prop">
75-
<td valign="top" class="name">Last Updated:</td>
75+
<td valign="top" class="name">Order:</td>
7676

77-
<td valign="top" class="value">${fieldValue(bean:moduleTopicInstance, field:'lastUpdated')}</td>
77+
<td valign="top" class="value">${fieldValue(bean:moduleTopicInstance, field:'order')}</td>
7878

7979
</tr>
8080

test/unit/com/synergyj/grain/domain/ModuleTopicTests.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import grails.test.*
2020
class ModuleTopicTests extends GrailsUnitTestCase {
2121
def existingCourse = new Course(name:CourseTests.buildString(50), description:CourseTests.buildString(10000), type:CourseType.COURSE)
2222
def existingModule = new CourseModule(name:CourseTests.buildString(50), description:CourseTests.buildString(10000), course:existingCourse)
23-
def existingModuleTopic = new ModuleTopic(name:CourseTests.buildString(50), description:CourseTests.buildString(10000), module:existingModule)
23+
def existingModuleTopic = new ModuleTopic(name:CourseTests.buildString(50), description:CourseTests.buildString(10000), module:existingModule, order:1)
2424

2525
protected void setUp() {
2626
super.setUp()

0 commit comments

Comments
 (0)