Sha256: b66726bd7bb4ecdfd4b38e8ba7ba42601e0e01cec0d8b69cc44b6ad79208f980

Contents?: true

Size: 762 Bytes

Versions: 1

Compression:

Stored size: 762 Bytes

Contents

require 'digest/md5'
module SwickyNotebooksHelper
  
  # Wraps the given element into an <div class=""
  def thctag(url, content_or_options_with_block=nil, options=nil, &block)
    if(block)
      content_tag(:div, thctag_options(url, content_or_options_with_block), nil, true, &block)
    else
      content_tag(:div, content_or_options_with_block, thctag_options(url, options))
    end
  end
  
  private
  
  # Updates the given options hash for the thctag
  def thctag_options(url, options)
    options ||= {}
    options.to_options!
    if(options[:class])
      options[:class] << " THCContent"
    else
      options[:class] = "THCContent"
    end
    options[:id] = ('h_' << Digest::MD5.hexdigest(url))
    options[:about] = url
    options
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
talia_core-0.7.0 generators/talia_swicky/templates/app/helpers/swicky_notebooks_helper.rb