Sha256: e1582defa612d4c34f71b86b6c36ae1144c6e63091af3a4361dd289847d490d3

Contents?: true

Size: 641 Bytes

Versions: 1

Compression:

Stored size: 641 Bytes

Contents

module RailsToastifyHelper
  def rails_toastify_container
    content_tag :div, '', id: 'toast-container', class: "toast-container #{RailsToastify.configuration.position}"
  end

  def rails_toastify_script
    javascript_tag do
      <<-JS.html_safe
        document.addEventListener('DOMContentLoaded', function() {
          window.RailsToastify = {
            show: function(message, options) {
              var config = #{RailsToastify.configuration.to_json};
              options = options || {};
              showToast(message, Object.assign({}, config, options));
            }
          };
        });
      JS
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_toastify-1.1.0 app/helpers/rails_toastify_helper.rb