module Ktistec::ViewHelper::ClassMethods

Defined in:

views/view_helper.cr

Constant Summary

ACTOR_COLOR_COUNT = 12
NUMBERS_TO_WORDS = {0 => "zero", 1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five", 6 => "six", 7 => "seven", 8 => "eight", 9 => "nine", 10 => "ten", 11 => "eleven", 12 => "twelve", 13 => "thirteen", 14 => "fourteen", 15 => "fifteen", 16 => "sixteen", 17 => "seventeen", 18 => "eighteen", 19 => "nineteen", 20 => "twenty"}
PUBLIC = "https://www.w3.org/ns/activitystreams#Public"

Instance Method Summary

Instance Method Detail

def activity_type_class(activity) #

[View source]
def actor_icon(actor, classes = nil) #

[View source]
def actor_states(object, author, actor, followed_actors) #

[View source]
def actor_type(actor) #

[View source]
def actor_type_class(actor) #

[View source]
def addressing(params, actor) #

Derives visibility and to/cc addressing from the "visibility" param.


[View source]
def depth(object) #

[View source]
def mention_page_mention_banner(env, mention, follow, count) #

[View source]
def mention_states(object, actor) #

[View source]
def normalize_params(params : URI::Params) : Hash(String, String | Array(String)) #

Normalizes params into a consistent hash format.


[View source]
def normalize_params(params : Hash(String, JSON::Any::Type)) : Hash(String, String | Array(String)) #

Normalizes params into a consistent hash format.


[View source]
def notification_count_and_color(actor, since : Time | Nil) #

Returns a tuple of {count, color, tooltip} for actor notifications.


[View source]
def number_to_word(n : Int) : String #

Converts an integer to its word representation.

Returns the word for numbers 0-20 and the number itself as a string for numbers outside that range.


[View source]
def object_data_attributes(object, author, actor, followed_hashtags, followed_mentions) #

[View source]
def object_partial(env, object, actor = object.attributed_to(include_deleted: true), author = actor, *, activity = nil, with_detail = false, as_context = false, show_quote = true, for_thread = nil, for_actor = nil, highlight = false) #

Renders an ActivityPub object.

Parameters:

  • env: HTTP request environment.
  • object: The ActivityPub object to render.
  • actor: The actor who performed the activity (defaults to object's attributed_to). May differ from author.
  • author: The original author of the object (defaults to actor).
  • activity: Optional activity containing this object (e.g., Like, Announce).
  • with_detail: Renders expanded view with additional metadata.
  • as_context: Indicates this object is being shown to provide context for (or is part of) the main content, not as the primary interactive element.
  • show_quote: Whether or not to render quoted content (defaults to true).
  • for_thread: Collection of objects in thread; enables thread view rendering.
  • for_actor: Actor for whom view is being rendered.
  • highlight: Whether or not to highlight this object in the feed.

[View source]
def object_states(object) #

[View source]
def object_type_class(object) #

[View source]
def paginate(env, collection) #

[View source]
def pagination_params(env) #

[View source]
def quote_states(object, actor) #

[View source]
def tag_page_tag_controls(env, hashtag, task, follow, count) #

[View source]
def thread_page_thread_controls(env, thread, task, follow) #

[View source]
def visibility(actor, object) #

Derives visibility from to/cc addressing.

If the object has explicit addressing, uses that. Otherwise, if the object is a reply, inherits from the parent: public posts are public, everything else is direct. Otherwise, defaults to public.


[View source]
def wrap_filter_term(str) #

[View source]