Ticket #532 (closed enhancement: fixed)

Opened 2 years ago

Last modified 22 months ago

Implicit Views when no view is set, reverts to the event

Reported by: lmajano Owned by: lmajano
Priority: normal Milestone: 2.6.2
Component: Plugin Renderer Version:
Severity: normal Keywords:
Cc:

Description

I have no clue how come I never did this feature. But anyways, if you call an event called users.list

The default implicit view to look for would be "views/users/list.cfm" if not set by the handler.

Change History

  Changed 2 years ago by sullah

Like the idea but my main concern is how much to add into core engine code-base.

We have to put a line between core engine code-base and additional feature code-base. As interceptors + Plugins are cool way to handle additional feature. So any new additional stuff will be additional millisecond execution cost.

  Changed 2 years ago by lmajano

  • status changed from new to closed
  • resolution set to fixed
  • summary changed from Implicit Views to Implicit Views when no view is set, reverts to the event

Sana, no worries there, here is the code for implicit views:

<!--- Implicit Views according to event --->
<cfset event.setView( replace(event.getCurrentEvent(),".","/","all") )>
<!--- Check if default view set, if yes, then set it. --->
<cfif event.getDefaultView() neq "">
	<!--- Set the Default View --->
	<cfset event.setView(event.getDefaultView())>
</cfif>

  Changed 2 years ago by lmajano

  • type changed from defect to enhancement

  Changed 2 years ago by sullah

  • status changed from closed to reopened
  • resolution fixed deleted

implicit view will only works if handler-name and method-name are correct case otherwise this will fail on linux.

It would be costly to cache entire views directory tree then compare with store info to find exact name of folder and .cfm file.

May we leave this for version 2.7

follow-up: ↓ 6   Changed 2 years ago by sullah

Luis

Please roll back this, its giving me headache, [Event.renderData()] always try to find default view.

Need to find another cool way for enhancement to achieve implicit views.

in reply to: ↑ 5   Changed 2 years ago by lmajano

Replying to sullah:

Luis Please roll back this, its giving me headache, [Event.renderData()] always try to find default view. Need to find another cool way for enhancement to achieve implicit views.

Sana, can you further explain what you are getting here? I am confused. Please post a way to recreate the error and what is occurring.

Luis

  Changed 2 years ago by sullah

I did some research on this, we can have a setting in coldbox.xml.cfm <Setting name="ImplicitView" value="true|false">

Linux system is more problematic because of case-sensitive. I never really have .cfm or .cfc name to lower case; examples dailyScheduleManager--> dailyschedulemanager. Its really hard to read and against best naming convention. So there are plenty of examples where camel case is known to be good practice.

implicit views actually convert everything to lower case and I don;t think this is a good implementation.

Secondly we could a implicit views service which will scan the whole directory structure and store the original name of directories/files in a scope.

I would suggest to leave this feature for v2.7, or even for 2.6.2 release this should be implemented according to whatever the exact directory/file-name without converting them into lower case.

  Changed 22 months ago by lmajano

  • status changed from reopened to closed
  • resolution set to fixed
  • component changed from Architecture to Plugin Renderer
  • milestone changed from 2.7.0 to 2.6.2
Note: See TracTickets for help on using tickets.