-
Notifications
You must be signed in to change notification settings - Fork 1
Views
Views are comprised of components. A Component is comprised of an XML (almost html) template that resides on disk. Views can contain any number of components that are all assembled to create the view.
Views can contain JavaScript but only that which is necessary for display and validation. Views can contain CSS. Bootstrap4 is the primary CSS library used by xHV.
Views have no business logic and know nothing about how to respond to user events except that they know which method to call in the Controller to handle those events.
Views are not stand alone HTML documents as they, themselves are child nodes of a larger base document called the AppHost. As a result, it can be very tricky to troubleshoot a view that isn't rendering properly. The WB control does not allow for viewing the page source, for now. Plans are in the works to set a debug flag that will dump the entire DOM to disk during the Render phase.
Views have the following conventions:
- They reside in the app/views/{ViewName} directories
- They are titled {viewName}.view.html
- They can imbed or refer to JavaScript located in the same directory
- They can imbed or refer to custom CSS located in the same directory
- Views that can be reused elsewhere in the app are placed in the app/views/Shared/{ViewName} directory
Views require specific xHV tags that xHV can find during the Interpolation phase to mark locations where the Controller should insert CSS, JavaScript, event handlers, etc.