This is useful for people using screen readers, since the character used as a separator won't be read aloud. Since many screen readers also read content generated via CSS pseudoelements, we aren't using `content: "|";` or similar but using elements with a very small width instead.
23 lines
385 B
Ruby
23 lines
385 B
Ruby
class Shared::ModerationActionsComponent < ApplicationComponent
|
|
attr_reader :record
|
|
delegate :can?, to: :helpers
|
|
|
|
def initialize(record)
|
|
@record = record
|
|
end
|
|
|
|
def render?
|
|
can?(:hide, record) || can?(:hide, author)
|
|
end
|
|
|
|
private
|
|
|
|
def author
|
|
record.author
|
|
end
|
|
|
|
def hide_path
|
|
polymorphic_path([:moderation, record], action: :hide)
|
|
end
|
|
end
|