Skip to content

Commit

Permalink
Fixes GrailsView getG() override issue
Browse files Browse the repository at this point in the history
Closes gh-14
  • Loading branch information
rainboyan committed Oct 11, 2024
1 parent 6016b80 commit 410ccef
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package grails.plugin.component.view.api

import grails.views.api.GrailsView
import grails.views.api.GrailsViewHelper
import grails.views.api.internal.DefaultGrailsViewHelper

/**
* Extra methods added to markup views
*
Expand All @@ -9,4 +12,13 @@ import grails.views.api.GrailsView
*/
trait ComponentView extends GrailsView {

private GrailsViewHelper viewHelper = new DefaultGrailsViewHelper(this)

/**
* @return Obtain the view helper
*/
GrailsViewHelper getG() {
return this.viewHelper
}

}
10 changes: 0 additions & 10 deletions core/src/main/groovy/grails/views/api/GrailsView.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import grails.views.GrailsViewTemplate
import grails.views.ResolvableGroovyTemplateEngine
import grails.views.WritableScript
import grails.views.WriterProvider
import grails.views.api.internal.DefaultGrailsViewHelper
import grails.web.mapping.LinkGenerator
import grails.web.mime.MimeUtility
import groovy.transform.CompileStatic
Expand Down Expand Up @@ -92,15 +91,6 @@ trait GrailsView extends HttpView implements WriterProvider, WritableScript {
*/
Config config

private GrailsViewHelper viewHelper = new DefaultGrailsViewHelper(this)

/**
* @return Obtain the view helper
*/
GrailsViewHelper getG() {
return this.viewHelper
}

/**
* Defines the model
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ trait JsonView extends GrailsView {
/**
* @return The default view helper
*/
@Override
GrailsJsonViewHelper getG() {
return viewHelper
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package grails.plugin.markup.view.api

import grails.views.api.GrailsView
import grails.views.api.GrailsViewHelper
import grails.views.api.internal.DefaultGrailsViewHelper

/**
* Extra methods added to markup views
*
Expand All @@ -9,4 +12,13 @@ import grails.views.api.GrailsView
*/
trait MarkupView extends GrailsView {

private GrailsViewHelper viewHelper = new DefaultGrailsViewHelper(this)

/**
* @return Obtain the view helper
*/
GrailsViewHelper getG() {
return this.viewHelper
}

}

0 comments on commit 410ccef

Please sign in to comment.