-
-
Notifications
You must be signed in to change notification settings - Fork 996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modals width variations (large/small/medium) not working?!?! #728
Comments
i've investigated the issue... here is my implementation: modal_helper.rb --> using this modded helper, <%= modal_dialog :id => "modal", :size => "modal-lg", the optional param ":size" correctly assigns the modal-lg or modal-sm class to the object and resizes the modal window accordingly to bootstrap 3 specs!! hoping to be helpful, francesco |
ok.... <%= modal_dialog :id => "my_modal_id", :size => "modal-lg"
:header => { :show_close => true, :dismiss => 'modal', :title => 'Modal Title' },
:body => { :content =>'', :style => 'height:180px;'},
:footer => { :content =>''} %> as you see: we can now set a modal ":id", the the header will have id equal to ":id"with the suffix "-header", the body will have suffix "-body" and the foot part "-footer"; hoping to be helpful.... here is my version of modal_helper.rb: module ModalHelper
#modals have a header, a body, a footer for options.
def modal_dialog(options = {}, &block)
content_tag :div, :id => options[:id], :class => "modal fade" do
content_tag :div, :class => "modal-dialog " + (!options[:size].nil? ? options[:size] : '') do
content_tag :div, :class => "modal-content" do
modal_header(options[:header].merge(:id => options[:id])) +
modal_body(options[:body].merge(:id => options[:id])) +
modal_footer(options[:footer].merge(:id => options[:id]))
end
end
end
end
def modal_header(options = {}, &block)
content_tag :div, :class => 'modal-header', :id => options[:id]+"-header" do
if options[:show_close]
close_button(options[:dismiss]) +
content_tag(:h4, options[:title], :class => 'modal-title', &block)
else
content_tag(:h4, options[:title], :class => 'modal-title', &block)
end
end
end
def modal_body(options = {}, &block)
content_tag :div, options[:content], :class => 'modal-body', :id => options[:id]+"-body", :style => options[:style], &block
end
def modal_footer(options = {}, &block)
content_tag :div, options[:content], :class => 'modal-footer', :id => options[:id]+"-footer", &block
end
def close_button(dismiss)
#It doesn't seem to like content_tag, so we do this instead.
raw("<button class=\"close\" data-dismiss=\"#{dismiss}\" aria-hidden=\"true\">×</button>")
end
def modal_toggle(content_or_options = nil, options = {}, &block)
if block_given?
options = content_or_options if content_or_options.is_a?(Hash)
default_options = { :class => 'btn btn-default', "data-toggle" => "modal", "href" => options[:dialog] }.merge(options)
content_tag :a, nil, default_options, true, &block
else
default_options = { :class => 'btn btn-default', "data-toggle" => "modal", "href" => options[:dialog] }.merge(options)
content_tag :a, content_or_options, default_options, true
end
end
def modal_cancel_button content, options = {}
default_options = { :class => "btn bootstrap-modal-cancel-button" }
content_tag_string "a", content, default_options.merge(options)
end
end regards, |
FWIW I updated the readme on the 3.1.1 branch as this will require people to add a content: attribute |
having issue with modals width variations...
seems the helper is not setting class correctly??
javascript will process the class settings accordingly with the width set??
available to try helping in solving this issue (i think related to latest 3.x bootstrap framework).....
waiting your comments/suggestions
The text was updated successfully, but these errors were encountered: