Skip to content

Commit

Permalink
🐛 FIX: Refactor renderView() to view() for ColdBox 7+
Browse files Browse the repository at this point in the history
This should still work in ColdBox 6+, by the way.
  • Loading branch information
michaelborn committed Nov 17, 2022
1 parent 7cbefc5 commit 34b13c2
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions handlers/Export.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ component extends="BaseHandler"{
event.setHTTPHeader( name="content-disposition", value='attachment; filename="#prc.loadedAPIName#.json"')
.renderData( data=prc.dsl, type="json" );
} else {
event.renderData( data=renderView( view="export/api", module="relax" ) );
event.renderData( data=view( view="export/api", module="relax" ) );
}
}

Expand Down Expand Up @@ -82,7 +82,7 @@ component extends="BaseHandler"{
private function toWikiMarkup( event, rc, prc, type ){
html( event, rc, prc );
if( !structKeyExists( rc, "content" ) ){
rc.content = renderView( view="apidoc/cfTemplate/api-content", args={"api":prc.dsl}, module="relax" );
rc.content = view( view="apidoc/cfTemplate/api-content", args={"api":prc.dsl}, module="relax" );
}
var data = wikitext.toWiki( translator=arguments.type, html=rc.content );
event.setHTTPHeader( name="content-disposition", value='attachment; filename="#prc.loadedAPIName#.#lcase( arguments.type )#.txt"');
Expand Down
4 changes: 2 additions & 2 deletions handlers/Home.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ component extends="BaseHandler"{
* Home
*/
function relax( event, rc, prc ){
event.renderData( data=renderView( view="home/relax", module="relax" ) );
event.renderData( data=view( view="home/relax", module="relax" ) );
}

/**
Expand Down Expand Up @@ -67,7 +67,7 @@ component extends="BaseHandler"{

// set view for Rendering
if( arguments.widget ){
return renderView( view="home/docs/resourceDoc", module="relax" );
return view( view="home/docs/resourceDoc", module="relax" );
} else {
event.setView( view="home/docs/resourceDoc", layout="#rc.print#" );
}
Expand Down
2 changes: 1 addition & 1 deletion handlers/Relaxer.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ component extends="BaseHandler"{
*/
any function resourceDoc( event, rc, prc ){
prc.body = runEvent( event="relax:home.resourceDoc", eventArguments={ widget=true } );
event.renderData( data=renderView( view="relaxer/resourceDoc", module="relax" ) );
event.renderData( data=view( view="relaxer/resourceDoc", module="relax" ) );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion layouts/html.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<body class="export" style="background-color: white">
<div class="container">
<cfoutput>
#renderView()#
#view()#
</cfoutput>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion layouts/relax.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
</cfif>

<!--main content start-->
#renderView()#
#view()#
<!--main content end-->
</div>

Expand Down
2 changes: 1 addition & 1 deletion test-harness/layouts/Main.cfm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<cfoutput>
<h1>Module Tester</h1>
<div>
#renderView()#
#view()#
</div>
</cfoutput>
4 changes: 2 additions & 2 deletions views/apidoc/cfTemplate/api-content.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
#paramTemplate( { "entity":api } )#
</cfif>

#renderView(
#view(
view='apidoc/cfTemplate/x-attributes',
args={"entity":api}
)#
Expand All @@ -222,7 +222,7 @@
<cfloop array="#pathKeys#" index="pathKey">
<!--- ACF Compatibility Fix for a null pointer exception --->
<cfscript>
writeOutput( renderView(
writeOutput( view(
view = 'apidoc/cfTemplate/api-path',
args = {
"api" : api,
Expand Down
8 changes: 4 additions & 4 deletions views/apidoc/cfTemplate/api-method.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<h4 class="card-subtitle text-primary">Parameters:</h4>
</div>
<div class="card-body">
#renderView(
#view(
view = "apidoc/cfTemplate/parameters",
args = { "entity" : args.method }
)#
Expand All @@ -64,14 +64,14 @@

<cfparam name="args.method.requestBody.required" default="true"/>
<h5>Required: <pre>#(args.method.requestBody.required ? 'true' : 'false')#</pre></h5>
#renderView(
#view(
view = "apidoc/cfTemplate/request-body",
args = { "entity" : args.method }
)#
<hr>
</cfif>

#renderView( view='apidoc/cfTemplate/x-attributes', args={"entity":args.method,"headerNode":"h4"} )#
#view( view='apidoc/cfTemplate/x-attributes', args={"entity":args.method,"headerNode":"h4"} )#

<cfif
!structIsEmpty( args.method[ "responses" ] )
Expand All @@ -81,7 +81,7 @@
<h4 class="card-subtitle text-primary">Responses:</h4>
<cfloop array="#structKeyArray( args.method[ "responses" ] )#" index="responseKey">
<cfif isNumeric( responseKey ) or responseKey eq 'default'>
#renderView(
#view(
view="apidoc/cfTemplate/response",
args={
"resourceId": args.method["x-resourceId"],
Expand Down
4 changes: 2 additions & 2 deletions views/apidoc/cfTemplate/api-path.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!--- Div Content --->
<div class="card-body">

#renderView(
#view(
view = 'apidoc/cfTemplate/x-attributes',
args = { "entity" : args.path, "headerNode" : "h4" }
)#
Expand All @@ -24,7 +24,7 @@

<cfloop array="#HTTPMethodKeys#" index="httpMethod">
<cfif structKeyExists( args.path, httpMethod )>
#renderView(
#view(
view = 'apidoc/cfTemplate/api-method',
args = {
key : ucase( httpMethod ),
Expand Down
2 changes: 1 addition & 1 deletion views/apidoc/cfTemplate/parameters.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<cfif structKeyExists( param, "schema" )>
<td colspan="5" style="vertical-align:top;">
#renderView( view="apidoc/cfTemplate/schema", args={ "schema": param[ "schema" ] } )#
#view( view="apidoc/cfTemplate/schema", args={ "schema": param[ "schema" ] } )#
</td>
</cfif>

Expand Down
2 changes: 1 addition & 1 deletion views/apidoc/cfTemplate/request-body.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
<div id="card_#(args.entity["x-resourceId"] & '-requestBody-' & listLast( key, '/' ))#" class="card-body">
<cfif structKeyExists( requestBody.content[ key ], "schema" ) && structKeyExists( requestBody.content[ key ].schema, "properties" )>
#renderView( view="apidoc/cfTemplate/schema", args={ "schema": requestBody.content[ key ].schema } )#
#view( view="apidoc/cfTemplate/schema", args={ "schema": requestBody.content[ key ].schema } )#
</cfif>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions views/apidoc/cfTemplate/response.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</h3>
</div>

#renderView( view="apidoc/cfTemplate/schema", args={ "schema": args.response.schema } )#
#view( view="apidoc/cfTemplate/schema", args={ "schema": args.response.schema } )#

</cfif>

Expand All @@ -47,7 +47,7 @@
</div>
<div class="card-body">
<cfif structKeyExists( args.response.content[ mimetype ], "schema" ) && structKeyExists( args.response.content[ mimetype ].schema, "properties" )>
#renderView( view="apidoc/cfTemplate/schema", args={ "schema": args.response.content[ mimetype ].schema } )#
#view( view="apidoc/cfTemplate/schema", args={ "schema": args.response.content[ mimetype ].schema } )#
</cfif>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion views/apidoc/cfTemplate/schema.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>
</cfif>
<h4 class="card-subtitle text-secondary">Items:</h4>
#renderView( view="apidoc/cfTemplate/schema", args={ "schema": args.schema[ "items" ], "showExample" : !structKeyExists( args.schema, "example" ) } )#
#view( view="apidoc/cfTemplate/schema", args={ "schema": args.schema[ "items" ], "showExample" : !structKeyExists( args.schema, "example" ) } )#
</div>
<cfelseif structKeyExists( args.schema, "type" ) OR structKeyExists( args.schema, "properties")>

Expand Down
2 changes: 1 addition & 1 deletion views/home/docs/resourceDefinitions.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<h1>Resource Definitions</h1>
<p>The following are all the resources defined in the <code>#prc.dsl.info.title#</code> API</p>
<!--- Render Document Collection --->
#renderView( view="home/docs/resourcePath", collection=prc.dsl.paths, collectionAs="thisResource", module="relax" )#
#view( view="home/docs/resourcePath", collection=prc.dsl.paths, collectionAs="thisResource", module="relax" )#
</cfoutput>
2 changes: 1 addition & 1 deletion views/home/openAPIDocs.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="row">
<div class="col-md-12">
<div class="col-md-12">
#renderView( view="apidoc/swagger.v2", module="relax" )#
#view( view="apidoc/swagger.v2", module="relax" )#
</div>
</div>
</div>
Expand Down

0 comments on commit 34b13c2

Please sign in to comment.