Module: Card::Location
- Extended by:
- Location
- Included in:
- Format, Location, Success, FileUploader
- Defined in:
- lib/card/location.rb
Instance Method Summary collapse
Instance Method Details
#card_path(rel_path) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/card/location.rb', line 17 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 "#{Card.config.relative_url_root}/#{rel_path}" end end |
#card_url(rel) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/card/location.rb', line 26 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
9 10 11 12 13 14 15 |
# File 'lib/card/location.rb', line 9 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 |