Rock 1.6.3 Documentation

Styled Attributes

We all have them. Those Campus Pastors. They are always pestering you about color matching everything to their campus color. Wouldn't you be a hero if you could make that Campus attribute on a Workflow show with a nice background color that matches their own color scheme?

Time to be a hero.

Attributes work great at letting you store and report on custom data. You have Person attribute, Group attribute, Group Member attributes. Even your Pages have attributes now! But when displaying those attributes, they are usually kind of... lacking. You added an Integer attribute to a workflow to ask people how many guests they would be bringing. And when it displays it's just black text. Now you can spiffy that up and add some spice to that number so it stands out more. For example, display it like a Bootstrap Badge with different colors depending on the value the user entered.

Attributes

There are a number of base attribute types supported. Each of these base types have a new field type prefixed with Styled to help you find the styled version of these attributes.

  • Boolean
  • Campus
  • Campuses
  • Email
  • File
  • Integer
  • Multi-Select
  • Single-Select
  • Text

Style Template

When you configure a Styled attribute, you get to use Lava to style it however you want. That means you get to use things like {% if %} to make logic decisions about how you want it displayed. Want a green red background if the the length of the text string is greater than 100 characters? Check the length and add the background color. Each attribute provides a number of variables to you.

  • RawValue is the raw value for the field, for example with a Styled Campus this would be a Guid value.
  • Value is the formatted value that would be returned by the unstyled field, for a Campus this would be the name of the Campus.
  • Entity is the database Entity object, if available. For example, with a Campus field this would be the Campus entity object.
  • Items is used with multiple item fields (Campuses, Multi-Select) and contains all selected items.
  • Condensed indicates if a condensed form should be rendered, such as for display in a Grid column.

Performance Concerns

We all worry about performance. We want our pages to be snappy. We have done some performance testing to see what kind of impact these styled attributes will have on your page load speed. Tests were conducted on a Report configured to show 1,000 groups. Groups have two attributes, normal Campus and Styled Campus.

  • Report showing normal Campus: 0.11s
  • Report showing Styled Campus: 2.15s

So there is a performance penalty to using styled attributes, but only when you are showing a huge list of them. These numbers equate to an overhead of 0.002 seconds per styled attribute on screen. This means 99.9% of the time you are not going to run into an issue. But if you have a Grid with 3 or 4 Styled Attributes per row and the user decides to click over to 1,000 page size, they are going to notice a significant delay.


Version History

Documentation
  • Initial Release