Module: Card::Set::Type::Cardtype

Extended by:
Card::Set
Defined in:
platypus/tmp/set/gem-card/mod001-core/type/cardtype.rb,
platypus/tmp/set/gem-defaults/mod010-rules/type/cardtype.rb,
platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb,
platypus/tmp/set/gem-defaults/mod009-search/type/cardtype.rb,
platypus/tmp/set/gem-defaults/mod028-follow/type/cardtype.rb

Overview

Set: All “Cardtype” cards

Defined Under Namespace

Modules: 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

Methods included from AdvancedApi

#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

Methods included from Inheritance

#include_set, #include_set_formats

Methods included from Card::Set::Trait

#card_accessor, #card_reader, #card_writer, #require_field

Methods included from Event::Api

#event

Class Method Details

.source_locationObject



7
# File 'platypus/tmp/set/gem-card/mod001-core/type/cardtype.rb', line 7

def self.source_location; "/Users/ethan/dev/decko/gem/card/mod/core/set/type/cardtype.rb"; end

Instance Method Details

#add_autocomplete_ok?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'platypus/tmp/set/gem-defaults/mod009-search/type/cardtype.rb', line 15

def add_autocomplete_ok?
  card.create_ok?
end

#cards_of_type_exist?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'platypus/tmp/set/gem-card/mod001-core/type/cardtype.rb', line 10

def cards_of_type_exist?
  !new_card? && Card.where(trash: false, type_id: id).exists?
end

#cql_contentObject

should name sorting be hard coded here??



11
12
13
# File 'platypus/tmp/set/gem-defaults/mod009-search/type/cardtype.rb', line 11

def cql_content
  { type_id: id, sort_by: :name }
end

#create_ok?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'platypus/tmp/set/gem-card/mod001-core/type/cardtype.rb', line 14

def create_ok?
  Card.new(type_id: id).ok? :create
end

#event: check_for_cards_of_typeObject



22
23
24
# File 'platypus/tmp/set/gem-card/mod001-core/type/cardtype.rb', line 22

event :check_for_cards_of_type, after: :validate_delete do
  errors.add :cardtype, t(:core_cards_exist, cardname: name) if cards_of_type_exist?
end

#event: check_for_cards_of_type_when_type_changedObject



26
27
28
29
30
31
# File 'platypus/tmp/set/gem-card/mod001-core/type/cardtype.rb', line 26

event :check_for_cards_of_type_when_type_changed,
      :validate, changing: :type, when: :was_cardtype? do
  if cards_of_type_exist?
    errors.add :cardtype, t(:core_error_cant_alter, name: name_before_act)
  end
end

#event: validate_cardtype_nameObject



33
34
35
36
37
# File 'platypus/tmp/set/gem-card/mod001-core/type/cardtype.rb', line 33

event :validate_cardtype_name, :validate, on: :save, changed: :name do
  if %r{[<>/]}.match?(name)
    errors.add :name, t(:core_error_invalid_character_in_cardtype, banned: "<, >, /")
  end
end

#follow_labelObject



8
9
10
# File 'platypus/tmp/set/gem-defaults/mod028-follow/type/cardtype.rb', line 8

def follow_label
  follow_set_card.follow_label
end

#follow_set_cardObject



16
17
18
# File 'platypus/tmp/set/gem-defaults/mod028-follow/type/cardtype.rb', line 16

def follow_set_card
  Card.fetch name, :type
end

#followed_by?(user_id = nil) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'platypus/tmp/set/gem-defaults/mod028-follow/type/cardtype.rb', line 12

def followed_by? user_id=nil
  follow_set_card.all_members_followed_by? user_id
end

#list_direct_followers?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'platypus/tmp/set/gem-defaults/mod028-follow/type/cardtype.rb', line 20

def list_direct_followers?
  true
end


8
9
10
11
12
# File 'platypus/tmp/set/gem-defaults/mod010-rules/type/cardtype.rb', line 8

def related_sets with_self=false
  sets = []
  sets << Card.fetch(name, :type) if known?
  sets + super
end

#scoping_rule_cardObject



96
97
98
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 96

def scoping_rule_card
  Card.fetch([self, :type, :update], new: {})
end

#was_cardtype?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'platypus/tmp/set/gem-card/mod001-core/type/cardtype.rb', line 18

def was_cardtype?
  type_id_before_act == Card::CardtypeID
end