Module: Card::Set::All::Links::HtmlFormat
- Extended by:
- Card::Set::AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod004-format/all/links.rb
Instance Method Summary collapse
-
#link_to(text = nil, opts = {}) ⇒ Object
in HTML, #link_to renders an anchor tag it treats opts other than “path” as html opts for that tag, and it adds special handling of “remote” and “method” opts (changes them into data attributes).
-
#link_to_card(cardish, text = nil, opts = {}) ⇒ Object
in HTML, #link_to_card adds special css classes indicated whether a card is “known” (real or virtual) or “wanted” (unknown) TODO: upgrade from (known/wanted)-card to (real/virtual/unknown)-card.
-
#link_to_resource(resource, text = nil, opts = {}) ⇒ Object
in HTML, #link_to_resource automatically adds a target to external resources so they will open in another tab.
-
#link_to_view(view, text = nil, opts = {}) ⇒ Object
in HTML, #link_to_view defaults to a remote link with rel=”nofollow”.
Instance Method Details
#link_to(text = nil, opts = {}) ⇒ Object
in HTML, #link_to renders an anchor tag it treats opts other than “path” as html opts for that tag, and it adds special handling of “remote” and “method” opts (changes them into data attributes)
101 102 103 104 105 106 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/links.rb', line 101 def link_to text=nil, opts={} opts[:href] ||= path opts.delete(:path) text = raw(text || opts[:href]) interpret_data_opts_to_link_to opts content_tag :a, text, opts end |
#link_to_card(cardish, text = nil, opts = {}) ⇒ Object
in HTML, #link_to_card adds special css classes indicated whether a card is “known” (real or virtual) or “wanted” (unknown) TODO: upgrade from (known/wanted)-card to (real/virtual/unknown)-card
111 112 113 114 115 116 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/links.rb', line 111 def link_to_card cardish, text=nil, opts={} name = Card::Name[cardish] slotterify opts if opts[:slotter] add_known_or_wanted_class opts, name super name, (text || name), opts end |
#link_to_resource(resource, text = nil, opts = {}) ⇒ Object
in HTML, #link_to_resource automatically adds a target to external resources so they will open in another tab. It also adds css classes indicating whether the resource is internal or external
127 128 129 130 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/links.rb', line 127 def link_to_resource resource, text=nil, opts={} add_resource_opts opts, resource_type(resource) super end |
#link_to_view(view, text = nil, opts = {}) ⇒ Object
in HTML, #link_to_view defaults to a remote link with rel=”nofollow”.
119 120 121 122 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/links.rb', line 119 def link_to_view view, text=nil, opts={} slotterify opts super view, (text || view), opts end |