Sha256: 77132bbce69741fd898ea3bc8075982146429aee513700e7d13deff4dd06034c

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

module MnoEnterprise
  module ImageHelper
    
    IMAGES_LOCATION = "/app/assets/images/mno_enterprise/"
    
    # Helper method to easily access and select the images
    # If full_path is true returns filename appended to the path
    # If full_path is false returns filename
    # Return the main-logo-whitebg.png if exists, otherwise get main-logo.png
    def main_logo_white_bg_path(full_path=false)
      logo_path = app_image_path("main-logo-whitebg.png") || main_logo_path
      full_path ? logo_path : "mno_enterprise/#{File.basename(logo_path)}"
    end

    # Return the main-logo.png if exists otherwise get engine's logo
    def main_logo_path
      file_name = "main-logo.png"
      app_image_path(file_name) || engine_image_path(file_name)
    end

    # Build path and checks if the logo exists
    def app_image_path(file_name)
      app_path = "#{Rails.root}#{IMAGES_LOCATION}#{file_name}"
      app_path if File.exists?(app_path)
    end

    # Get engine's logo and return it
    def engine_image_path(file_name)
      "#{MnoEnterprise::Engine.root}#{IMAGES_LOCATION}#{file_name}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mno-enterprise-core-3.3.1 app/helpers/mno_enterprise/image_helper.rb
mno-enterprise-core-3.3.0 app/helpers/mno_enterprise/image_helper.rb