Module: Card::Set::Type::Role::HtmlFormat

Extended by:
AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod014-account/type/role.rb

Instance Method Summary collapse

Instance Method Details



41
42
43
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/role.rb', line 41

def related_by_content_items
  super.unshift ["members", :members]
end

#role_checkboxObject



33
34
35
36
37
38
39
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/role.rb', line 33

def role_checkbox
  name = card.disabled? ? "add_item" : "drop_item"
  subformat(Auth.current.field(:disabled_roles)).card_form :update do
    [check_box_tag(name, card.id, !card.disabled?, class: "_edit-item"),
     render_link]
  end
end

#view: configsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/role.rb', line 19

view :configs do
  configs_by_cat = card.all_admin_configs_grouped_by(:roles, :category)[card.codename]
  configs_by_cat.map do |(cat, configs)|
    if cat == "cardtypes"
      nested_list_section cat.capitalize,
                          card.config_codenames_grouped_by_title(configs)
    elsif cat == "views"
      next
    else
      list_section cat.capitalize, configs.map { |c| c.codename.to_sym }, :closed_bar
    end
  end
end


15
16
17
# File 'platypus/tmp/set/gem-defaults/mod014-account/type/role.rb', line 15

view :link_with_checkbox, cache: :never do
  role_checkbox
end