Class: Card::Act::ActRenderer::BoardActRenderer

Inherits:
RelativeActRenderer show all
Defined in:
lib/card/act/act_renderer/board_act_renderer.rb

Overview

Used for the board

Instance Method Summary collapse

Methods inherited from RelativeActRenderer

#act_links, #actions, #current_act?, #relative_title, #revert_link, #rollback_link, #show_rollback_link?, #subtitle

Methods inherited from Card::Act::ActRenderer

#absolute_title, #accordion_item, #act_links, #act_type, #action_summary, #actor_and_ago, #approved_actions, #autosaved_draft_link, #count_types, #details, #edited_ago, #header, #initialize, #link_to_act_card, #link_to_history, #method_missing, #respond_to_missing?, #summary

Constructor Details

This class inherits a constructor from Card::Act::ActRenderer

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Card::Act::ActRenderer

Instance Method Details



25
26
27
28
29
30
31
32
33
# File 'lib/card/act/act_renderer/board_act_renderer.rb', line 25

def board_link
  opts = @format.board_link_opts(
    path: { act_id: @act.id, view: :board_act, act_seq: @args[:act_seq] },
    "data-bs-toggle": "pill"
  )
  add_class opts, "d-flex nav-link"
  opts[:path].delete :layout
  link_to_card @card, title, opts
end

#left_titleObject



11
12
13
# File 'lib/card/act/act_renderer/board_act_renderer.rb', line 11

def left_title
  ["##{@args[:act_seq]}", @act.actor.name, wrap_with(:small, edited_ago)].join " "
end

#overlay_titleObject



35
36
37
38
39
40
41
# File 'lib/card/act/act_renderer/board_act_renderer.rb', line 35

def overlay_title
  wrap_with :div do
    [left_title, summary,
     subtitle.present? ? subtitle : nil,
     rollback_or_edit_link].compact.join " | "
  end
end

#renderObject



19
20
21
22
23
# File 'lib/card/act/act_renderer/board_act_renderer.rb', line 19

def render
  return "" unless @act_card

  details
end

#right_titleObject



15
16
17
# File 'lib/card/act/act_renderer/board_act_renderer.rb', line 15

def right_title
  summary
end


43
44
45
46
47
48
49
# File 'lib/card/act/act_renderer/board_act_renderer.rb', line 43

def rollback_or_edit_link
  if @act.draft?
    autosaved_draft_link text: "continue editing"
  elsif show_rollback_link?
    revert_link
  end
end

#titleObject



6
7
8
9
# File 'lib/card/act/act_renderer/board_act_renderer.rb', line 6

def title
  wrap_with(:div, left_title, class: "me-2") +
    wrap_with(:div, right_title, class: "ms-auto act-summary")
end