Module: Card::Set::All::Content

Extended by:
Card::Set
Defined in:
tmpsets/set/mod003-core/all/content.rb

Overview

Set: All cards (Content)

Defined Under Namespace

Modules: Format, HtmlFormat

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

Methods included from Card::Set::AdvancedApi

#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

Methods included from Inheritance

#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_locationObject



7
# File 'tmpsets/set/mod003-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

#blank_comment?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'tmpsets/set/mod003-core/all/content.rb', line 117

def blank_comment?
  comment.blank? || comment.strip.blank?
end

#blank_content?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'tmpsets/set/mod003-core/all/content.rb', line 113

def blank_content?
  content.blank? || content.strip.blank?
end

#clean_html?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'tmpsets/set/mod003-core/all/content.rb', line 101

def clean_html?
  true
end

#clear_draftsObject



57
58
59
# File 'tmpsets/set/mod003-core/all/content.rb', line 57

def clear_drafts
  drafts.created_by(Card::Auth.current_id).each(&:delete)
end

#contentObject Also known as: raw_content



12
13
14
# File 'tmpsets/set/mod003-core/all/content.rb', line 12

def content
  structured_content || standard_content
end

#content=(value) ⇒ Object



8
9
10
# File 'tmpsets/set/mod003-core/all/content.rb', line 8

def content= value
  self.db_content = value
end

#content?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'tmpsets/set/mod003-core/all/content.rb', line 17

def content?
  content.present?
end

#creatorObject



45
46
47
# File 'tmpsets/set/mod003-core/all/content.rb', line 45

def creator
  Card[creator_id]
end

#draft?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'tmpsets/set/mod003-core/all/content.rb', line 83

def draft?
  Env.params["draft"] == "true"
end

#labelObject



41
42
43
# File 'tmpsets/set/mod003-core/all/content.rb', line 41

def label
  name
end

#last_draft_contentObject



61
62
63
# File 'tmpsets/set/mod003-core/all/content.rb', line 61

def last_draft_content
  drafts.last.card_changes.last.value
end

#prepare_db_contentObject



87
88
89
90
# File 'tmpsets/set/mod003-core/all/content.rb', line 87

def prepare_db_content
  cont = standard_db_content || "" # necessary?
  clean_html? ? Card::Content.clean!(cont) : cont
end

#save_content_draft(_content) ⇒ Object



53
54
55
# File 'tmpsets/set/mod003-core/all/content.rb', line 53

def save_content_draft _content
  clear_drafts
end

#standard_contentObject



21
22
23
# File 'tmpsets/set/mod003-core/all/content.rb', line 21

def standard_content
  db_content || (new_card? && template.db_content)
end

#standard_db_contentObject



92
93
94
95
96
97
98
99
# File 'tmpsets/set/mod003-core/all/content.rb', line 92

def standard_db_content
  if structure
    # do not override db_content with content from structure
    db_content
  else
    standard_content
  end
end

#structured_contentObject



25
26
27
# File 'tmpsets/set/mod003-core/all/content.rb', line 25

def structured_content
  structure && template.db_content
end

#unfilled?Boolean

Returns:

  • (Boolean)


109
110
111
# File 'tmpsets/set/mod003-core/all/content.rb', line 109

def unfilled?
  blank_content? && blank_comment? && !subcards?
end

#updaterObject



49
50
51
# File 'tmpsets/set/mod003-core/all/content.rb', line 49

def updater
  Card[updater_id]
end

#use_default_content?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'tmpsets/set/mod003-core/all/content.rb', line 105

def use_default_content?
  !db_content_changed? && template && template.db_content.present?
end