Module: AsanaExceptionNotifier::HeredocHelper

Included in:
ApplicationHelper
Defined in:
lib/asana_exception_notifier/helpers/heredoc_helper.rb

Overview

helper methods that use Heredoc syntax

Class Method Summary collapse

Class Method Details

This method creates a HTML link , that when will be clicked will trigger the toggle of a fieldset, by either making it hidden or visible

Parameters:

  • link (String)

    The link id of the fieldset that will be toggled when the resulting HTML link will be clicked

Returns:

  • (String)

    returns HTML link that will be used to toggle between fieldsets



11
12
13
14
15
# File 'lib/asana_exception_notifier/helpers/heredoc_helper.rb', line 11

def link_helper(link)
  <<-HTML
  <a href="javascript:void(0)" onclick="AjaxExceptionNotifier.hideAllAndToggle('#{link.downcase}')">#{link.camelize}</a>
  HTML
end

.mount_table(array, options = {}) ⇒ String

Gets a bidimensional array and create a table. The first array is used as label.

Parameters:

  • array (Array<Array<String>>)

    The array of arrays of strings that will be used for constructing the HTML table

  • options (Hash) (defaults to: {})

    The options list that will be used to construct the HTML attributes on the HTML table

Returns:

  • (String)

    returns the HTML table that was generated from the received array



23
24
25
26
27
28
29
30
31
# File 'lib/asana_exception_notifier/helpers/heredoc_helper.rb', line 23

def mount_table(array, options = {})
  header = array.extract_options!
  <<-HTML
  <table #{hash_to_html_attributes(options)}>
    <thead><tr><th>#{get_table_headers(header)}</th></tr></thead>
    <tbody>#{get_table_rows(array)}</tbody>
  </table>
  HTML
end