Module: Card::Set::Type::Cardtype::HtmlFormat
- Extended by:
- AbstractFormat
- Defined in:
- 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
Instance Method Summary collapse
-
#add_autocomplete_item_path ⇒ Object
-
#add_link(opts = {}) ⇒ Object
-
#add_link_opts(opts) ⇒ Object
-
#add_path(view) ⇒ Object
-
#can_configure? ⇒ Boolean
-
#configure_link(css_class = nil) ⇒ Object
-
#related_by_type_items ⇒ Object
-
#type_formgroup(args = {}) ⇒ Object
-
#view: add_button ⇒ Object
-
#view: add_link ⇒ Object
-
#view: add_url ⇒ Object
-
#view: configure_button ⇒ Object
-
#view: configure_link ⇒ Object
don’t cache because it depends on update permission for another card.
-
#view: type ⇒ Object
Instance Method Details
#add_autocomplete_item_path ⇒ Object
20 21 22 |
# File 'platypus/tmp/set/gem-defaults/mod009-search/type/cardtype.rb', line 20 def add_autocomplete_item_path path action: :new end |
#add_link(opts = {}) ⇒ Object
29 30 31 32 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 29 def add_link opts={} voo.title ||= t(:format_add_card, cardname: safe_name) link_to render_title, add_link_opts(opts) end |
#add_link_opts(opts) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 34 def add_link_opts opts modal = opts.delete :modal if modal.nil? || modal modal_link_opts opts.merge(path: add_path(:new_in_modal)) else opts.merge path: add_path(:new) end end |
#add_path(view) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 47 def add_path view path_args = { mark: card.name } process_voo_params(path_args) if voo.params if view == :new path_args[:action] = :new else path_args[:action] = :type path_args[:view] = view end path path_args end |
#can_configure? ⇒ Boolean
64 65 66 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 64 def can_configure? Card.fetch(card, :type, :structure, new: {}).ok? :update end |
#configure_link(css_class = nil) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 72 def configure_link css_class=nil return "" unless Card.fetch(card, :type, :structure, new: {}).ok? :update voo.title ||= t(:format_configure_card, cardname: safe_name.pluralize) title = _render_title link_to_card card, title, path: { view: :board, board: { tab: :rules_tab }, set: Card::Name[safe_name, :type] }, class: css_classes("configure-type-link ms-3", css_class) end |
#related_by_type_items ⇒ Object
25 26 27 |
# File 'platypus/tmp/set/gem-defaults/mod028-follow/type/cardtype.rb', line 25 def super.unshift ["#{card.name} cards", [card, :type, :by_name], { mark: :absolute }] end |
#type_formgroup(args = {}) ⇒ Object
13 14 15 16 17 18 19 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 13 def type_formgroup args={} if card.cards_of_type_exist? wrap_with :div, t(:core_cards_exist, scope: "core", cardname: safe_name) else super end end |
#view: add_button ⇒ Object
25 26 27 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 25 view :add_button do add_link class: "btn btn-secondary" end |
#view: add_link ⇒ Object
21 22 23 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 21 view :add_link do add_link end |
#view: add_url ⇒ Object
43 44 45 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 43 view :add_url do card_url _render_add_path end |
#view: configure_button ⇒ Object
68 69 70 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 68 view :configure_button, cache: :never, denial: :blank, perms: :can_configure? do configure_link "btn btn-secondary" end |
#view: configure_link ⇒ Object
don’t cache because it depends on update permission for another card
60 61 62 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 60 view :configure_link, cache: :never, perms: :can_configure? do configure_link end |
#view: type ⇒ Object
9 10 11 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/type/cardtype.rb', line 9 view :type, unknown: true do link_to_card card.type_card, nil, class: "cardtype" end |