Module: Card::Set::All::History
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod002-history/all/history.rb
Constant Summary collapse
- ACTS_PER_PAGE =
~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/history/set/all/history.rb ~~
Card.config.acts_per_page
Instance Method Summary collapse
- #act_card? ⇒ Boolean
-
#actionable? ⇒ Boolean
must be called on all actions and before :set_name, :process_subcards and :validate_delete_children.
- #current_rev_nr ⇒ Object
- #descendant_card_ids(parent_ids = [id]) ⇒ Object
- #diff_args ⇒ Object
- #finalize_action? ⇒ Boolean
- #has_edits? ⇒ Boolean
- #history? ⇒ Boolean
- #included_card_ids ⇒ Object
- #included_descendant_card_ids ⇒ Object
-
#intrusive_acts(args = { with_drafts: true }) ⇒ Object
all acts with actions on self and on cards included in self.
-
#intrusive_family_acts(args = {}) ⇒ Object
all acts with actions on self and on cards that are descendants of self and included in self.
- #rollback_request? ⇒ Boolean
Methods included from I18nScope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #pattern_and_modules_from_path, #process_base_modules, #register_set, #tmp_file_template, #write_tmp_file
Methods included from Helpers
#abstract_set?, #all_set?, #shortname
Methods included from Card::Set::AdvancedApi
#attachment, #ensure_set, #stage_method
Methods included from Format
#all_set_format_mod!, #define_on_format, #format, #register_set_format, #view
Methods included from Inheritance
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer
Methods included from Event
Instance Method Details
#act_card? ⇒ Boolean
67 68 69 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 67 def act_card? self == DirectorRegister.act_card end |
#actionable? ⇒ Boolean
must be called on all actions and before :set_name, :process_subcards and :validate_delete_children
13 14 15 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 13 def actionable? history? || respond_to?(:attachment) end |
#current_rev_nr ⇒ Object
115 116 117 118 119 120 121 122 123 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 115 def current_rev_nr @current_rev_nr ||= begin if intrusive_acts.first.actions.last.draft @intrusive_acts.size - 1 else @intrusive_acts.size end end end |
#descendant_card_ids(parent_ids = [id]) ⇒ Object
132 133 134 135 136 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 132 def descendant_card_ids parent_ids=[id] more_ids = Card.where("left_id IN (?)", parent_ids).pluck("id") more_ids += descendant_card_ids more_ids unless more_ids.empty? more_ids end |
#diff_args ⇒ Object
398 399 400 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 398 def diff_args { format: :text } end |
#finalize_action? ⇒ Boolean
30 31 32 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 30 def finalize_action? actionable? && current_action end |
#has_edits? ⇒ Boolean
402 403 404 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 402 def has_edits? Card::Act.where(actor_id: id).where("card_id IS NOT NULL").present? end |
#history? ⇒ Boolean
6 7 8 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 6 def history? true end |
#included_card_ids ⇒ Object
125 126 127 128 129 130 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 125 def included_card_ids @included_card_ids ||= Card::Reference.select(:referee_id).where( ref_type: "I", referer_id: id ).pluck("referee_id").compact.uniq end |
#included_descendant_card_ids ⇒ Object
138 139 140 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 138 def included_descendant_card_ids included_card_ids & descendant_card_ids end |
#intrusive_acts(args = { with_drafts: true }) ⇒ Object
all acts with actions on self and on cards included in self
109 110 111 112 113 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 109 def intrusive_acts args={ with_drafts: true } @intrusive_acts ||= begin Act.find_all_with_actions_on((included_card_ids << id), args) end end |
#intrusive_family_acts(args = {}) ⇒ Object
all acts with actions on self and on cards that are descendants of self and included in self
102 103 104 105 106 |
# File 'tmpsets/set/mod002-history/all/history.rb', line 102 def intrusive_family_acts args={} @intrusive_family_acts ||= begin Act.find_all_with_actions_on((included_descendant_card_ids << id), args) end end |