Sha256: dfc73b51be50333705ae7f257d4fb3a8fe6e781961bda61d52d21c3acd8546fb

Contents?: true

Size: 974 Bytes

Versions: 3

Compression:

Stored size: 974 Bytes

Contents

module LatoView
  # This module contain default lato_view application.
  module ApplicationHelper

    # This function render a cell set with params.
    def view(*names)
      # mantain compatibility with old cells (lato_view 1.0)
      if names.length === 1
        puts "YOU ARE USING AND OLD VERSION OF CELLS. PLEASE CONSIDER TO UPDATE YOUR CODE"
        old_cell = "LatoView::CellsV1::#{names.first.capitalize}::Cell".constantize
        return old_cell
      end
      # return correct cell
      cell_class = "LatoView::"
      names.each do |name|
        cell_class = "#{cell_class}#{name.capitalize}::"
      end
      cell_class = "#{cell_class}Cell".constantize
      return cell_class
    end

    # This function render an icon set as params.
    def put_svg(icon)
      # check params
      raise 'You must send an icon value as parameter' if !icon || icon.nil? || icon.blank?
      # render icon
      render "lato_view/icons/#{icon}.svg"
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lato_view-1.1.5 app/helpers/lato_view/application_helper.rb
lato_view-1.1.4 app/helpers/lato_view/application_helper.rb
lato_view-1.1.3 app/helpers/lato_view/application_helper.rb