Sha256: 47592e6d789a89bc785052c71e8d391cc3617cd816174a9935d88e7308697467

Contents?: true

Size: 737 Bytes

Versions: 6

Compression:

Stored size: 737 Bytes

Contents

module PrintsHelper
  def record_print(printable,options={})
    options.reverse_merge!({
      :remote => true
    })
    
    if options[:remote]
      '<script>      
      (function(){
        var ua = navigator.userAgent.toLowerCase();
        if (!window.ActiveXObject) {
          request = new XMLHttpRequest();
        } else if (ua.indexOf("msie 5") == -1) {
          request = new ActiveXObject("Msxml2.XMLHTTP");
        } else {
          request = new ActiveXObject("Microsoft.XMLHTTP");
        }
        var params = {};
        request.open("POST", "'+printable.class.name.underscore.pluralize+'/'+printable.id.to_s+'/prints.json");
        request.send(params);
      }());
      </script>'.html_safe
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
how_are_we_doing-0.0.9 app/helpers/prints_helper.rb
how_are_we_doing-0.0.8 app/helpers/prints_helper.rb
how_are_we_doing-0.0.7 app/helpers/prints_helper.rb
how_are_we_doing-0.0.6 app/helpers/prints_helper.rb
how_are_we_doing-0.0.5 app/helpers/prints_helper.rb
how_are_we_doing-0.0.4 app/helpers/prints_helper.rb