Sha256: 2daa9273fd02c42bf3281a6a342bc6d8bcbdef9c331c9988103c023d74170ed8

Contents?: true

Size: 665 Bytes

Versions: 2

Compression:

Stored size: 665 Bytes

Contents

module Trestle
  module ModalHelper
    def modal_options!(options)
      modal_options.merge!(options)
    end

    def modal_options
      @_modal_options ||= {}
    end

    def modal_wrapper_attributes
      {
        class: ["modal", "fade", modal_options[:wrapper_class]],
        tabindex: "-1",
        role: "dialog",
        data: {
          controller: ["modal", modal_options[:controller]].compact.join(" ")
        }
      }.deep_merge(modal_options.except(:class, :wrapper_class, :controller))
    end

    def modal_dialog_attributes
      {
        class: ["modal-dialog", modal_options[:class]],
        role: "document"
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trestle-0.10.0 app/helpers/trestle/modal_helper.rb
trestle-0.10.0.pre2 app/helpers/trestle/modal_helper.rb