Sha256: 613825ad2c6844f73d3c6bd0939e15741be79efc62bdd75e982de7127e76e6d3

Contents?: true

Size: 1.02 KB

Versions: 102

Compression:

Stored size: 1.02 KB

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 pp_amount a
      "$ #{'%.2f' % 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

102 entries across 102 versions & 1 rubygems

Version Path
ish_manager-0.1.8.314 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.313 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.312 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.311 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.310 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.309 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.308 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.307 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.306 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.305 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.304 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.303 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.302 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.301 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.300 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.299 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.298 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.296 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.295 app/helpers/ish_manager/application_helper.rb
ish_manager-0.1.8.294 app/helpers/ish_manager/application_helper.rb