MishkaCmsCore.Activity.Calculations.ResourceLabel (Mishka CMS Core v0.0.1)

Copy Markdown View Source

Ash calculation that exposes :resource_label (string) on a paper-trail version resource. Each PaperTrail mixin passes a literal label so the same name appears in the activity feed and any other Ash consumer (API, GraphQL) without that consumer having to inspect the source module name.

Wire it from each PaperTrail mixin's calculations block, passing the label as an option:

calculate :resource_label,
          :string,
          {MishkaCmsCore.Activity.Calculations.ResourceLabel,
           label: "Page"}

Summary

Functions

describe(opts)

Callback implementation for Ash.Resource.Calculation.describe/1.

has_calculate?()

has_expression?()

Callback implementation for Ash.Resource.Calculation.has_expression?/0.

load(query, opts, context)

Callback implementation for Ash.Resource.Calculation.load/3.

strict_loads?()

Callback implementation for Ash.Resource.Calculation.strict_loads?/0.