-
-
Notifications
You must be signed in to change notification settings - Fork 7
fix for two file wire from within a module #262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
b6da14c
bd8c8c6
4597238
0a018fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,7 +67,7 @@ component accessors="true" singleton { | |
|
|
||
| wire.set_renderedContent( local.viewContent ); | ||
| return local.viewContent; | ||
| } | ||
| } | ||
|
|
||
| return wire.get_renderedContent(); | ||
| } | ||
|
|
@@ -164,14 +164,15 @@ component accessors="true" singleton { | |
| } | ||
|
|
||
| /** | ||
| * Normalizes the view path for rendering. This means it will convert the dot notation path | ||
| * Normalizes the view path for rendering. This means it will convert the dot notation path | ||
| * to a slash notation path, check for the existence of .bxm or .cfm files, and ensure the path is correctly formatted. | ||
| * | ||
| * @viewPath string | The dot notation path to the view template to be rendered, without the .cfm extension. | ||
| * @componentPath string | The component path, used to determine if the normalized path should be prefixed with "wires/". | ||
| * | ||
| * @return string | ||
| */ | ||
| function normalizeViewPath( required viewPath ) { | ||
| function normalizeViewPath( required viewPath, required componentPath ) { | ||
| var paths = buildViewPaths( arguments.viewPath ); | ||
grantcopley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if ( paths.normalizedPath contains "cbwire/models/tmp/" ) { | ||
|
|
@@ -190,7 +191,7 @@ component accessors="true" singleton { | |
| throw( type="CBWIREException", message="A .bxm or .cfm template could not be found for '#arguments.viewPath#'." ); | ||
| } | ||
|
|
||
| if ( left( paths.normalizedPath, 6 ) != "wires/" ) { | ||
| if ( !isNull( arguments.componentPath ) && !find( "@", arguments.componentPath ) && left( paths.normalizedPath, 6 ) != "wires/" ) { | ||
| paths.normalizedPath = "wires/" & paths.normalizedPath; | ||
| } | ||
|
Comment on lines
175
to
196
|
||
| if ( left( paths.normalizedPath, 1 ) != "/" ) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| component extends="cbwire.models.Component" { | ||
|
|
||
|
|
||
| data = { | ||
| "myDataPropKey" : "My Data Prop Value" | ||
| }; | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <cfoutput> | ||
| <div> | ||
| <cfif datePart( "h", now() ) lt 12 > | ||
| <p>Good Morning and hello CBWire Developer from a two file wire in a module!</p> | ||
| <cfelse> | ||
| <p>Good Afternoon and hello CBWire Developer from a two file wire in a module!</p> | ||
| </cfif> | ||
| </div> | ||
| </cfoutput> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
template()now always passesvariables._pathintonormalizeViewPath(), but_pathis not initialized inonDIComplete()and can be null unless_withPath()has been called. If a component instance callstemplate()before_withPath(),normalizeViewPath()will receive null and can error when callingfind(). Consider defaulting to an empty string when_pathis null, or making the newcomponentPathargument optional/nullable-safe innormalizeViewPath().