Module: Card::Set::All::History
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod002-01_history/all/history.rb
Constant Summary
collapse
- REVISIONS_PER_PAGE =
Card.config.revisions_per_page
Instance Method Summary
collapse
Methods included from Card::Set
abstract_set?, all_set?, card_accessor, card_reader, card_writer, clean_empty_module_from_hash, clean_empty_modules, define_active_job, define_event_method, define_event_perform_later_method, define_on_format, ensure_set, event, extended, format, process_base_module_list, process_base_modules, register_set, register_set_format, shortname, view, write_tmp_file
Instance Method Details
#current_rev_nr ⇒ Object
99
100
101
102
103
|
# File 'tmpsets/set/mod002-01_history/all/history.rb', line 99
def current_rev_nr
@current_rev_nr ||= begin
intrusive_acts.first.actions.last.draft ? @intrusive_acts.size - 1 : @intrusive_acts.size
end
end
|
#descendant_card_ids(parent_ids = [id]) ⇒ Object
109
110
111
112
113
114
115
116
|
# File 'tmpsets/set/mod002-01_history/all/history.rb', line 109
def descendant_card_ids parent_ids=[id]
more_ids = Card.where('left_id IN (?)', parent_ids).pluck('id')
if !more_ids.empty?
more_ids += descendant_card_ids more_ids
end
more_ids
end
|
#diff_args ⇒ Object
333
334
335
|
# File 'tmpsets/set/mod002-01_history/all/history.rb', line 333
def diff_args
{:format=>:text}
end
|
#history? ⇒ Boolean
5
6
7
|
# File 'tmpsets/set/mod002-01_history/all/history.rb', line 5
def history?
true
end
|
#included_card_ids ⇒ Object
105
106
107
|
# File 'tmpsets/set/mod002-01_history/all/history.rb', line 105
def 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
118
119
120
|
# File 'tmpsets/set/mod002-01_history/all/history.rb', line 118
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
93
94
95
96
97
|
# File 'tmpsets/set/mod002-01_history/all/history.rb', line 93
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
87
88
89
90
91
|
# File 'tmpsets/set/mod002-01_history/all/history.rb', line 87
def intrusive_family_acts args={} @intrusive_family_acts ||= begin
Act.find_all_with_actions_on( (included_descendant_card_ids << id), args)
end
end
|
#rollback_request? ⇒ Boolean
66
67
68
|
# File 'tmpsets/set/mod002-01_history/all/history.rb', line 66
def rollback_request?
history? && Env && Env.params['action_ids'] && Env.params['action_ids'].class == Array
end
|