Skip to content

Card rules

Firstly, there are core BASE_CARD_RULES in frontend/pages/utils/constants.py which are set as default_card_rules on all cards by CardRulesMixin in tate/core/blocks/strips.py.

Next, the StripBlock model in tate/core/blocks/strips.py checks to see if default_card_rules is set on the page model of the page that contains the instance of StripBlock . It could be that the page model only sets one of the rules, like for example, the GalleryPage model in tate/galleries/models.py . StripBlock only updates the rules specifically set in default_card_rules on the page model. If the rest aren't specified, they stay as the default values, defined in BASE_CARD_RULES.

Then, there is a bit of extra rules processing in StripBlock in respect of the rules to do with the showing of card 'type labels'. The actual logic, more-or-less carried over from the legacy Django front-end, sits in the StripBlock.show_type_labels() method.

The basic gist of it is that, in most cases, if the cards are all of one type, it ensures the 'type labels' don't show, if they're a mixture of types, it ensures they do show. The original intention behind show_type_labels() is presumably that if the cards in a strip represent pages of the same page type, it's not necessary to show explicitly the page type.

Flexibility on card presentation is therefore provided by the use of default_card_rules on individual page models but beware the potential influence of StripBlock.show_type_labels()