Sha256: a46d0aa9f3442061567ffb5b144803274b3d53d0499679bac106ad50c249c60e

Contents?: true

Size: 1.38 KB

Versions: 13

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true
module AsanaExceptionNotifier
  # helper methods that use Heredoc syntax
  module HeredocHelper
  module_function

    # 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
    # @param [String] link The link id of the fieldset that will be toggled when the resulting HTML link will be clicked
    #
    # @return [String] returns HTML link that will be used to toggle between fieldsets
    def link_helper(link)
      <<-HTML
      <a href="javascript:void(0)" onclick="AjaxExceptionNotifier.hideAllAndToggle('#{link.downcase}')">#{link.camelize}</a>
      HTML
    end

    # Gets a bidimensional array and create a table.
    # The first array is used as label.
    # @param [Array<Array<String>>] array The array of arrays of strings that will be used for constructing the HTML table
    # @param [Hash] options The options list that will be used to construct the HTML attributes on the HTML table
    #
    # @return [String] returns the HTML table that was generated from the received array
    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
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
asana_exception_notifier-2.2.0 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-2.1.0 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-2.0.2 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-2.0.1 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-2.0.0 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-1.1.0 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-1.0.2 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-1.0.1 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-1.0.0 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-0.8.0 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-0.7.0 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-0.6.0 lib/asana_exception_notifier/helpers/heredoc_helper.rb
asana_exception_notifier-0.5.0 lib/asana_exception_notifier/helpers/heredoc_helper.rb