Module: LatoView::ApplicationHelper

Defined in:
app/helpers/lato_view/application_helper.rb

Overview

This module contain default lato_view application.

Instance Method Summary collapse

Instance Method Details

#put_svg(icon) ⇒ Object

This function render an icon set as params.



23
24
25
26
27
28
# File 'app/helpers/lato_view/application_helper.rb', line 23

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

#view(*names) ⇒ Object

This function render a cell set with params.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/lato_view/application_helper.rb', line 6

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