Module: Card::Set::All::Admin

Extended by:
Card::Set
Defined in:
platypus/tmp/set/gem-card/mod001-core/all/admin.rb

Overview

Set: All cards (Admin)

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 Card::Set::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 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/all/admin.rb', line 7

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

Instance Method Details

#all_admin_configs_grouped_by(property1, property2 = nil) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 52

def all_admin_configs_grouped_by property1, property2=nil
  return admin_config_group_by_properties property1, property2 if property2

  result = Hash.new { |hash, k| hash[k] = [] }
  all_configs.each_with_object(result) do |config, h|
    property_values = Array.wrap(config.send(property1))
    property_values.each do |value|
      h[value] << config
    end
  end
end

#all_admin_configs_of_category(category) ⇒ Object



64
65
66
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 64

def all_admin_configs_of_category category
  all_admin_configs_grouped_by(:category)[category]
end

#all_configsObject



48
49
50
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 48

def all_configs
  mod_cards_with_config.map(&:admin_config_objects).flatten
end

#config_codenames_grouped_by_title(configs) ⇒ Object



68
69
70
71
72
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 68

def config_codenames_grouped_by_title configs
  configs&.group_by { |c| c.title }&.map do |title, grouped_configs|
    [title, grouped_configs.map { |config| config.codename.to_sym }]
  end
end

#create_admin_items(mod, category, subcategory, values) ⇒ Object



31
32
33
34
35
36
37
38
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 31

def create_admin_items mod, category, subcategory, values
  Array.wrap(values).map do |value|
    ::AdminItem.new(mod, category, subcategory, value).tap do |config|
      codenamed = Card::Codename.exist? config.codename.to_sym
      config.roles = codenamed ? Card[config.codename.to_sym].responsible_role : []
    end
  end
end

#mod_cards_with_configObject

MOD_task_TASK_NAME_link_text: LINK_TEXT MOD_task_TASK_NAME_description: DESCRIPTION



27
28
29
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 27

def mod_cards_with_config
  Card.search(type: :mod).select { |mod| mod.admin_config.present? }
end

#responsible_roleObject



44
45
46
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 44

def responsible_role
  scoping_rule_card.find_existing_rule_card.item_cards.map(&:codename)
end

#scoping_rule_cardObject



40
41
42
# File 'platypus/tmp/set/gem-card/mod001-core/all/admin.rb', line 40

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