Created by: FooBarWidget
This pull request adds a resource
field to the Field class. This gives more flexibility to field views, allowing it to customize its display based on the original resource. For example, this will allow fields to display content based on two different columns.
My use case is as follows. My system has many Products. Each Product has a name
(which is an internal name) and an optional display_name
. I want to display the product name as follows:
product name here
(optional display name here) <--- this line is only shown if display_name is not nil
With this pull request, I'm able to write a view like this:
<%= field.resource.name %>
<% if field.resource.display_name %>
<br>
<small><%= field.resource.display_name %></small>
<% end %>