Ruby On Rails integration / Templates

When you want to use templates for your components (templates in Webface's terminology, see the relevant section of this reference), you can just reuse your regular component views from app/views/webface_components, but call them not with #component helper, but with #component_template helper. Here we're using our standard component view for some of the Webface's standard components, including SimpleNotificationComponent:

.componentTemplates
  = component_template :button
  = component_template :dialog_window
  = component_template :simple_notification
  = component_template :modal_window


When generating html, webface_rails replaces data-component-class attribute in the component view with data-component-template assigning it the same value.

All of the usual options can be passed to the #component_template helper. One thing you might want to do is to hide the .componentTemplate tag, so those templates are not actually visible until they're instantiated as components. So consider adding this to your stylesheets:

.componentTemplates { display: none; }

There isn't much else to be said about templates, they're pretty straightforward.