module Gallerist::Helpers

This code is free software; you can redistribute it and/or modify it under the terms of the new BSD License.

Copyright © 2015, Sebastian Staudt

Public Instance Methods

library() click to toggle source
# File lib/gallerist/helpers.rb, line 8
def library
  settings.library
end
navbar() click to toggle source
partial(partial, *options) click to toggle source
# File lib/gallerist/helpers.rb, line 47
def partial(partial, *options)
  erb :"partials/#{partial}", *options
end
route_exists(url) click to toggle source
# File lib/gallerist/helpers.rb, line 51
def route_exists(url)
  settings.routes['GET'].map(&:first).any? { |route| route =~ url }
end
title() click to toggle source
# File lib/gallerist/helpers.rb, line 55
def title
  '%s – Gallerist' % [ @title ]
end
url_for(obj) click to toggle source
# File lib/gallerist/helpers.rb, line 59
def url_for(obj)
  case obj
  when Gallerist::Album
    '/albums/%s' % [ obj.id ]
  when Gallerist::Person
    '/persons/%s' % [ obj.id ]
  when Gallerist::Photo
    '/photos/%s' % [ obj.id ]
  when Gallerist::Tag
    '/tags/%s' % [ URI.encode(obj.simple_name) ]
  end
end