Sha256: ac4f143cf918eb11bcc1a7f94649650d5b00d2dc00acb05e7902001f1f0508e8

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

module Familiarity
  module ApplicationHelper

    def familiaritySwitchBoard(options={})
      _options= {
          position: 'bottomLeft' # Options are, topLeft, topRight, bottomRight, bottomLeft
      }.merge(options)

      content_tag('script') do
        # raw "$(document).on(\"page:change\", function () {FamiliarityAdmin.familiaritySwitchBoard(#{_options.to_json});});"
        raw "FamiliarityAdmin.familiaritySwitchBoard(#{_options.to_json});"
      end
    end

    def familiarityView(options={})
      _options= {
          escape_to_exit: true,
          f1_to_start: true,
          show_tips_recursively: false,
          mandatory_all_tips: true,
          traverse_back: true,
          remember_duration: 30 #In Days
      }.merge(options)

      content_tag('script') do
        raw <<END_SCRIPT
        var cn = 'familiarity_' + '#{request.path}'.replace(/\\//g,'A');
        var familiarity = new Familiarity(#{_options.to_json});
        if (typeof $.cookie(cn) == "undefined")
          {
              familiarity.familiarityView(true);
              console.log($.cookie(cn, new Date(), { expires: #{_options[:remember_duration]} }));
          }
END_SCRIPT
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
familiarity-0.2.5 app/helpers/familiarity/application_helper.rb
familiarity-0.2.4 app/helpers/familiarity/application_helper.rb