Sha256: 72fb498ec2a2d1894c72cb0bfe79b1db17c35570d88a8b11dcf2723b818533f7

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class All
# Set: All cards (Content)
#
module Content;
extend Card::Set
def self.source_location; "/Users/ezl5238/dev/decko/gem/card/mod/core/set/all/content.rb"; end
event :set_content, :store, on: :save do
  self.db_content = prepare_db_content
  @selected_action_id = @selected_content = nil
  clear_drafts
end

event :save_draft, :store, on: :update, when: :draft? do
  save_content_draft content
  abort :success
end

event :set_default_content,
      :prepare_to_validate,
      on: :create, when: :use_default_content? do
  self.db_content = template.db_content
end

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

def clean_html?
  true
end

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

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

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

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

def standard_db_content
  if structure
    # do not override db_content with content from structure
    db_content
  else
    standard_content
  end
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?)
def label
  name
end

def creator
  Card[creator_id]
end

def updater
  Card[updater_id]
end
end;end;end;end;
# ~~ generated from /Users/ezl5238/dev/decko/gem/card/mod/core/set/all/content.rb ~~

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
card-1.102.0 tmpsets/set/mod002-core/all/content.rb