Module: Card::Set::All::Content
- Extended by:
- Card::Set
- Defined in:
- platypus/tmp/set/gem-card/mod001-core/all/content.rb,
platypus/tmp/set/gem-defaults/mod004-format/all/content.rb
Overview
Defined Under Namespace
Modules: Format, HtmlFormat
Constant Summary
Constants included
from Helpers
Helpers::SET_PATTERN_TEST_REGEXP
Constants included
from Event::Api
Event::Api::OPTIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Card::Set
reset
Methods included from I18nScope
#mod_name, #scope
Methods included from Registrar
#extended, #finalize_load, #process_base_modules, #register_set
Methods included from Helpers
#format_module, #format_modules, #method_missing, #modules, #pattern_code, #respond_to_missing?, #set_name_parts, #shortname, #underscored_name
#assign_type, #attachment, #define_set_from_error, #ensure_set, #setting_opts, #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 Trait
#card_accessor, #card_reader, #card_writer, #require_field
Methods included from Event::Api
#event
Class Method Details
.source_location ⇒ Object
7
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 7
def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/all/content.rb"; end
|
Instance Method Details
45
46
47
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 45
def
.blank? || .strip.blank?
end
|
#clean_html? ⇒ Boolean
28
29
30
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 28
def clean_html?
true
end
|
72
73
74
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 72
def creator
Card[creator_id]
end
|
#default_content ⇒ Object
TODO: let default_content in card_accessor override template
33
34
35
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 33
def default_content
template&.db_content
end
|
#draft? ⇒ Boolean
24
25
26
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 24
def draft?
Env.params["draft"] == "true"
end
|
#event: save_draft ⇒ Object
14
15
16
17
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 14
event :save_draft, :store, on: :update, when: :draft? do
save_content_draft content
abort :success
end
|
#event: set_content ⇒ Object
8
9
10
11
12
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 8
event :set_content, :store, on: :save do
self.content = prepare_db_content
@selected_action_id = @selected_content = nil
clear_drafts
end
|
#event: set_default_content ⇒ Object
19
20
21
22
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 19
event :set_default_content, :prepare_to_validate,
on: :create, when: :use_default_content? do
self.db_content = default_content
end
|
seems like this should be moved to format so we can fall back on title
rather than name. (In fact, name, title, AND label is a bit much.
Trim to 2?)
68
69
70
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 68
def label
name
end
|
#prepare_db_content ⇒ Object
49
50
51
52
53
54
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 49
def prepare_db_content
cont = standard_db_content || ""
clean_html? ? Card::Content.clean!(cont) : cont
end
|
#standard_db_content ⇒ Object
56
57
58
59
60
61
62
63
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 56
def standard_db_content
if structure
db_content
else
standard_content
end
end
|
#unfilled? ⇒ Boolean
41
42
43
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 41
def unfilled?
blank_content? && && !subcards?
end
|
76
77
78
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 76
def updater
Card[updater_id]
end
|
#use_default_content? ⇒ Boolean
37
38
39
|
# File 'platypus/tmp/set/gem-card/mod001-core/all/content.rb', line 37
def use_default_content?
!db_content_changed? && default_content.present?
end
|