Module: Card::Format::Location
- Included in:
- Card::Format
- Defined in:
- lib/card/format.rb
Instance Method Summary collapse
Instance Method Details
#card_path(rel_path) ⇒ Object
522 523 524 525 526 527 528 529 |
# File 'lib/card/format.rb', line 522 def card_path rel_path Rails.logger.warn "Pass only strings to card_path: #{rel_path.class}, #{rel_path}" unless String===rel_path if rel_path =~ /^\// rel_path else "#{ Wagn.config.relative_url_root }/#{ rel_path }" end end |
#card_url(rel) ⇒ Object
531 532 533 534 535 536 537 |
# File 'lib/card/format.rb', line 531 def card_url rel if rel =~ /^https?\:/ rel else "#{ Card::Env[:protocol] }#{ Card::Env[:host] }#{ card_path rel }" end end |
#page_path(title, opts = {}) ⇒ Object
TESTME
514 515 516 517 518 519 520 |
# File 'lib/card/format.rb', line 514 def page_path title, opts={} Rails.logger.warn "Pass only Card::Name to page_path #{title.class}, #{title}" unless Card::Name===title format = opts[:format] ? ".#{opts.delete(:format)}" : '' action = opts[:action] ? "#{opts.delete(:action)}/" : '' query = opts.present? ? "?#{opts.to_param}" : '' card_path "#{action}#{title.to_name.url_key}#{format}#{query}" end |