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

Copy Markdown View Source

Ash calculation that exposes :tone (atom or nil) on a resource carrying an action name — the content-change colour the activity timeline tints a create/update/destroy row by, parallel to MishkaCmsCore.Activity.Calculations.Severity. Delegates to MishkaCmsCore.Activity.Helpers.tone_for/1, so a create reads :created, an update :updated, a destroy :destroyed, and anything else nil — a row the timeline then falls back to colouring by :severity.

Wire it beside the :severity calculation, :field naming the attribute holding the action:

calculate :tone, :atom,
          {MishkaCmsCore.Activity.Calculations.Tone, field: :action}

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.