Module: Card::Set::All::Content
- Extended by:
- Card::Set
- Defined in:
- tmpsets/set/mod002-core/all/content.rb
Constant Summary
Constants included
from Format
Format::TEMPLATE_DIR
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
#all_set_format_mod!, #before, #define_on_format, #format, layout_method_name, #register_set_format, #view, #view_for_override, view_method_name, wrapper_method_name
#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, #require_field
Methods included from Event::Api
#event
Instance Method Details
#clean_html? ⇒ Boolean
36
37
38
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 36
def clean_html?
true
end
|
#clear_drafts ⇒ Object
44
45
46
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 44
def clear_drafts
drafts.created_by(Card::Auth.current_id).each(&:delete)
end
|
#content ⇒ Object
6
7
8
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 6
def content
db_content || (new_card? && template.db_content)
end
|
#content=(value) ⇒ Object
10
11
12
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 10
def content= value
self.db_content = value
end
|
#creator ⇒ Object
28
29
30
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 28
def creator
Card[creator_id]
end
|
#label ⇒ Object
24
25
26
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 24
def label
name
end
|
#last_draft_content ⇒ Object
48
49
50
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 48
def last_draft_content
drafts.last.card_changes.last.value
end
|
#raw_content ⇒ Object
14
15
16
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 14
def raw_content
structure ? template.db_content : content
end
|
#save_content_draft(_content) ⇒ Object
40
41
42
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 40
def save_content_draft _content
clear_drafts
end
|
#updater ⇒ Object
32
33
34
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 32
def updater
Card[updater_id]
end
|
#use_default_content? ⇒ Boolean
63
64
65
|
# File 'tmpsets/set/mod002-core/all/content.rb', line 63
def use_default_content?
!db_content_changed? && template && template.db_content.present?
end
|