dbinott
07/14/2022, 6:10 PMgarciadev
07/14/2022, 6:20 PMAdam Cameron
I have seen people abstract out doing that in the model and then returning the HTML to renderDid you kill those people?
garciadev
07/14/2022, 7:02 PMAdam Cameron
Adam Cameron
garciadev
07/14/2022, 7:03 PMAdam Cameron
Adam Cameron
Adam Cameron
dbinott
07/14/2022, 7:04 PMAdam Cameron
<!--- in the view --->
<!--- good --->
<cfloop query="stuff">
#someSimpleValue# #someDateValue.dateFormat("yyyy-mm-dd")#<br> <!--- that's just display logic. All good --->
</cfloop>
<!--- bad --->
<cfloop query="stuff">
#someOtherObject.doSomeMoreProcessing(someValue)#<br> <!--- that's business logic, so does not belong in a view --->
</cfloop>
dbinott
07/14/2022, 7:34 PMdbinott
07/14/2022, 7:35 PMsetRejectListBadgeColor(rcd.reason)
garciadev
07/14/2022, 7:36 PMdbinott
07/14/2022, 8:59 PMRobert Zehnder
07/14/2022, 9:09 PMservice = new <http://models.my|models.my>.awesome.Service();
Robert Zehnder
07/14/2022, 9:09 PMRobert Zehnder
07/14/2022, 9:10 PM#service.doSomething()#
on the pagegarciadev
07/14/2022, 9:52 PMAdam Cameron
how do you access a model function within a view?You don't (not a ColdBox answer; and MVC one). ApplicationHelper.cfm sounds like something CFWheels would implement / misuse to put uncategorised UDFs into a special magic global space that is inappropriate for almost all situations, and is jut bad app design. I could see how there might be some view helper libs that could be exposed to all views (eg: RomanNumeralHelper or something specifically view-ish), but that would make no sense being exposed everywhere. But I'll double-down on the notion that any functionality that does anything more than format a value for display should not be called from the view layer. And the formatting functionality should have no side effects.
dbinott
07/15/2022, 12:22 PMdbinott
07/15/2022, 12:34 PMgarciadev
07/15/2022, 12:47 PM