The Percolate campaign calendar allows for grouping campaigns based on custom and hard coded fields. In order to achieve this functionality on the client side the following steps are used:
1. Load meta data schemas
You are looking for:
resource_types
- campaign
type
- metadata
Schema
2. Filter out correct schema fields
You want schema fields that match any of the following types: term
, select
, and multi-select
.
3. Display these fields as options to group by
The fields that made it through step 2's filter should be shown as options to group by.
4. Display filtering ability when group by is chosen
When a group by option is selected the associated custom field will be shown below as a field to filter by. (This field will open the same way as it would as a filter option listed below. ex: Taxonomy will open a taxonomy picker).
5. Disable the duplicate field listed as a filter below
When grouping by a custom field the related field that was originally shown in the metadata filters should now be disabled.
6. Adjust display based on chosen filters
The group by filters behavior is slightly different than the behavior of the custom field filter behavior. When selecting a group by filter the following is true:
- If no filters are selected then display all groups that contain at least one campaign (if campaigns exist that do not belong to any group they will fall into a group titled "No name of group by option"
- A campaign can appear in multiple groups
- If one or more filters are selected then display the selected filter groups and any campaigns that belong to them
7. Hard coded group by options
Some group by options are not related to custom fields. Instead they are hard coded into the application. They are:
- No selection - This provides the client a way to deselect their group by option. This reverts back to the original display (no grouping)
- Campaign platform - List all platforms that are available based on v5/preference with
names
=platforms
,with_scope_ids
= for selected scope IDs (comma seperated). - Approval status - Multi select with options (No workflow, In review, Approved). The same rules for grouping listed above in step 6 apply to these options.
- License - List all licenses where the user has a role with the read capability of the object type in question
- Post platform - List all platforms that a post can be created on (intersection of
v5/platform/
withv5/channel/?capabilities=posting
) - Post channel - List all channels with
capabilities=posting