format do view :editor do |args| set_name = card.cardname.trunk_name set_card = Card.fetch(set_name) not_set = set_card && set_card.type_id != Card::SetID group_options = Account.as_bot { Card.search(:type=>Card::RoleID, :sort=>'name') } inheritable = not_set ? false : set_card.inheritable? inheriting = inheritable && card.content=='_left' item_names = inheriting ? [] : card.item_names %{ #{ form.hidden_field :content, :class=>'card-content' }
#{ if inheritable; %{
#{ check_box_tag 'inherit', 'inherit', inheriting }
} end }
Groups
#{ group_options.map do |option| checked = !!item_names.delete(option.name) %{
#{ check_box_tag( "#{option.key}-perm-checkbox", option.name, checked, :class=>'perm-checkbox-button' ) }
} end * "\n" }
Individuals
#{ _render_list :item_list=>item_names, :extra_css_class=>'perm-indiv-ul' }
} end view :core do |args| args[:item] ||= :link card.content=='_left' ? core_inherit_content(args) : _final_pointer_type_core(args) end view :closed_content do |args| card.content=='_left' ? core_inherit_content(args) : _final_pointer_type_closed_content(args) end private def core_inherit_content args={} sc = args[:set_context] text = if sc && sc.tag_name.key == Card[:self].key begin task = card.tag.codename ancestor = Card[sc.trunk_name.trunk_name] links = ancestor.who_can( task.to_sym ).map do |card_id| link_to_page Card[card_id].name, nil, :target=>args[:target] end*", " "Inherit ( #{links} )" rescue 'Inherit' end else 'Inherit from left card' end %{#{text}} end end