Ticket #532 (closed enhancement: fixed)

Opened 5 months ago

Last modified 2 months ago

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

Reported by: lmajano Assigned to: 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

08/21/08 04:33:03 changed 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.

08/28/08 23:25:09 changed 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>

08/28/08 23:26:04 changed by lmajano

  • type changed from defect to enhancement.

08/30/08 09:31:30 changed by sullah

  • status changed from closed to reopened.
  • resolution 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 ) 09/08/08 06:59:27 changed 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 ) 09/22/08 15:36:05 changed 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

09/22/08 17:09:47 changed 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.

11/05/08 00:21:54 changed by lmajano

  • status changed from reopened to closed.
  • component changed from Architecture to Plugin Renderer.
  • resolution set to fixed.
  • milestone changed from 2.7.0 to 2.6.2.

Copyright 2006 ColdBox Framework by Luis Majano