Class: Card::Act::ActRenderer::RelativeActRenderer
- Inherits:
-
Card::Act::ActRenderer
- Object
- Card::Act::ActRenderer
- Card::Act::ActRenderer::RelativeActRenderer
- Defined in:
- lib/card/act/act_renderer/relative_act_renderer.rb
Overview
Use for the history for one specific card It shows only the actions of an act that are relevant for the card of the format that renders the act.
Direct Known Subclasses
Instance Method Summary collapse
- #act_links ⇒ Object
- #actions ⇒ Object
- #current_act? ⇒ Boolean
- #relative_title ⇒ Object
- #revert_link ⇒ Object
-
#rollback_link ⇒ Object
Revert: current update Restore: current deletion Revert and Restore: old deletions blank: current create save as current: not current, not deletion.
- #rollback_or_edit_link ⇒ Object
- #show_rollback_link? ⇒ Boolean
- #subtitle ⇒ Object
- #title ⇒ Object
Methods inherited from Card::Act::ActRenderer
#absolute_title, #accordion_item, #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, #render, #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
#act_links ⇒ Object
22 23 24 25 26 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 22 def act_links return unless (content = rollback_or_edit_link) wrap_with :small, content end |
#actions ⇒ Object
46 47 48 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 46 def actions @actions ||= @act.actions_affecting(@card) end |
#current_act? ⇒ Boolean
40 41 42 43 44 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 40 def current_act? return unless @format.card.last_act && @act @act.id == @format.card.last_act.id end |
#relative_title ⇒ Object
12 13 14 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 12 def relative_title @act_card.name.from @card.name end |
#revert_link ⇒ Object
50 51 52 53 54 55 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 50 def revert_link revert_actions_link "revert to this", { revert_actions: actions.map(&:id) }, { class: "_close-modal", "data-slotter-mode": "update-modal-origin" } end |
#rollback_link ⇒ Object
Revert:
current update
Restore:
current deletion
Revert and Restore:
old deletions
blank:
current create
save as current:
not current, not deletion
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 67 def rollback_link return unless @card.ok? :update wrap_with :div, class: "act-link float-end" do content_tag(:small, revert_link) # link_to "Save as current", # class: "slotter", remote: true, # method: :post, rel: "nofollow", # "data-slot-selector" => ".card-slot.history-view", # path: { action: :update, action_ids: prior, # view: :open, look_in_trash: true } end end |
#rollback_or_edit_link ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 28 def rollback_or_edit_link if @act.draft? autosaved_draft_link text: "continue editing" elsif show_rollback_link? rollback_link end end |
#show_rollback_link? ⇒ Boolean
36 37 38 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 36 def show_rollback_link? !current_act? end |
#subtitle ⇒ Object
16 17 18 19 20 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 16 def subtitle return "" unless @act.card_id != @format.card.id wrap_with :small, "act on #{relative_title}" end |
#title ⇒ Object
8 9 10 |
# File 'lib/card/act/act_renderer/relative_act_renderer.rb', line 8 def title %(<span class="nr">##{@args[:act_seq]}</span> #{actor_and_ago}) end |