module Symphonia module BootstrapModalHelper # Ruby shortcut for generate modals # # <%= render_modal title: t(:title) do %> # <% render(template: 'path_to_template_or_partial', formats: [:html]) %> # <% end %> # template_or_partial example: # <%= title(@entity, back: !request.xhr?) %> # # <%= symphonia_form_for(@entity, remote: request.xhr?) do |f| %> # # <%= render(partial: 'form', locals: { f: f }) %> # # <%= f.primary unless request.xhr? %> # <% end -%> def render_modal(options = {}, &block) opts = options.slice(:id, :title, :submit, :large) opts[:submit] = t(:button_submit) unless opts.has_key?(:submit) id = options.delete(:id) || 'ad_hoc_modal' script = <