Sha256: 78bac76c5912dd2fee4308ad1dcd930219cd5cbc93c7df013bab770e89dc5652

Contents?: true

Size: 989 Bytes

Versions: 9

Compression:

Stored size: 989 Bytes

Contents

module IshManager
  module ApplicationHelper

    def pretty_date input
      return input.strftime("%Y-%m-%d")
    end

    def pp_errors errors
      return errors
    end

    def user_path user
      if user.class == 'String'
        "/users/#{user}"
      elsif user.class == User
        "/users/#{user.id}"
      elsif user.class == NilClass
        "/users"
      end
    end

    def pretty_date date
      date.to_s[0, 10]
    end
    def pp_date a; pretty_date a; end

    def resource_path resource
      case resource.class.name
      when 'City'
        city_path( resource.id )
      when 'Event'
        event_path( resource.id )
      when 'Venue'
        venue_path( resource.id )
      end
    end

    #
    # api paths
    #
    def api_city_path city
      "/api/cities/view/#{city.cityname}.json"
    end

    def api_map_path map
      "/api/maps/view/#{map.slug}"
    end

    def api_marker_path marker
      "/api/markers/view/#{marker.slug}"
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ish_manager-0.1.8.201 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.200 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.199 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.198 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.197 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.196 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.195 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.194 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.193 app/helpers/ish_manager/application_helper.rb