Module: Card::Set::All::History::Selected
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod005-history/all/history/selected.rb
Overview
Set: All cards (History, Selected)
if these aren't in a nested module, the methods just overwrite the base
methods, but we need a distinct module so that super will be able to refer to
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from I18nScope
#mod_name, #scope
Methods included from Loader
#clean_empty_module_from_hash, #clean_empty_modules, #extended, #process_base_modules, #register_set
Methods included from Helpers
#abstract_set?, #all_set?, #num_set_parts, #shortname, #underscore
#attachment, #ensure_set, #stage_method
Methods included from Format
#before, #format, layout_method_name, #view, view_method_name, view_setting_method_name, wrapper_method_name
#include_set, #include_set_formats
Methods included from Basket
#abstract_basket, #add_to_basket, #basket, #unshift_basket
Methods included from Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
#event
Class Method Details
.source_location ⇒ Object
9
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 9
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/history/set/all/history/selected.rb"; end
|
Instance Method Details
#content ⇒ Object
11
12
13
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 11
def content
@selected_action_id ? selected_content : super
end
|
#content=(value) ⇒ Object
15
16
17
18
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 15
def content= value
@selected_content = nil
super
end
|
#content_at_time_of_selected_action ⇒ Object
50
51
52
53
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 50
def content_at_time_of_selected_action
lc = last_change_on(:db_content, not_after: @selected_action_id, including_drafts: true)
lc&.value
end
|
#select_action(action_id) ⇒ Object
27
28
29
30
31
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 27
def select_action action_id
run_callbacks :select_action do
self.selected_action_id = action_id
end
end
|
#select_action_by_params(params) ⇒ Object
20
21
22
23
24
25
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 20
def select_action_by_params params
action = nth_action(params[:rev]) || action_from_id(params[:rev_id])
return unless action
select_action action.id
end
|
#select_action_id(action_id) ⇒ Object
63
64
65
66
67
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 63
def select_action_id action_id
run_callbacks :select_action do
self.selected_action_id = action_id
end
end
|
#selected_action ⇒ Object
42
43
44
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 42
def selected_action
selected_action_id && Action.fetch(selected_action_id)
end
|
#selected_action_id ⇒ Object
33
34
35
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 33
def selected_action_id
@selected_action_id || (@current_action&.id) || last_action_id
end
|
#selected_action_id=(action_id) ⇒ Object
37
38
39
40
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 37
def selected_action_id= action_id
@selected_content = nil
@selected_action_id = action_id
end
|
#selected_content ⇒ Object
46
47
48
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 46
def selected_content
@selected_content ||= content_at_time_of_selected_action || db_content
end
|
#selected_content_action_id ⇒ Object
69
70
71
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 69
def selected_content_action_id
@selected_action_id || new_content_action_id || last_content_action_id
end
|
#with_selected_action_id(action_id) ⇒ Object
55
56
57
58
59
60
61
|
# File 'tmpsets/set/mod005-history/all/history/selected.rb', line 55
def with_selected_action_id action_id
current_action_id = @selected_action_id
select_action_id action_id
result = yield
select_action_id current_action_id
result
end
|