-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Internal omission/combination pieces not expanding fields (#116)
Previously, internal recurrence/omission/combination pieces were not expanding the fields contained within their models, in order to fix this, the internal piece view file has been changes to dynamically select the correct internal piece view file based on the class, additionally a class field has been added to allow for easier identification of the piece class on the front end
- Loading branch information
1 parent
f0e255c
commit 9f55c63
Showing
4 changed files
with
25 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
import groovy.transform.* | ||
import org.olf.internalPiece.InternalPiece | ||
import groovy.transform.Field | ||
import org.grails.orm.hibernate.cfg.GrailsHibernateUtil | ||
|
||
def should_expand = ['receivingPieces'] | ||
|
||
@Field InternalPiece internalPiece | ||
json g.render(internalPiece, [expand: should_expand]) | ||
internalPiece = GrailsHibernateUtil.unwrapIfProxy(internalPiece) as InternalPiece | ||
|
||
switch(internalPiece.class.name){ | ||
case 'org.olf.internalPiece.InternalOmissionPiece': | ||
json g.render (template: '/internalOmissionPiece/internalOmissionPiece', model: [internalOmissionPiece: binding.variables.internalPiece]) | ||
break; | ||
case 'org.olf.internalPiece.InternalRecurrencePiece': | ||
json g.render (template: '/internalRecurrencePiece/internalRecurrencePiece', model: [internalRecurrencePiece: binding.variables.internalPiece]) | ||
break; | ||
case 'org.olf.internalPiece.InternalCombinationPiece': | ||
json g.render (template: '/internalCombinationPiece/internalCombinationPiece', model: [internalCombinationPiece: binding.variables.internalPiece]) | ||
break; | ||
default: | ||
throw new RuntimeException("Unexpected internalPiece class ${internalPiece.class.name}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters