Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8002945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:31:25+00:00 2026-06-04T16:31:25+00:00

I can’t get how to put modals in partials. Help me, please ! I

  • 0

I can’t get how to put modals in partials. Help me, please !

I have button:

 <a class="btn btn-large" data-toggle="modal" href="#show_me_modal"
 onclick="printpage()">Name of button<sup>TM</sup> message in action</a>

and div modal:

    <div class="modal hide fade" id="show_me_modal">
     <div class="modal-header">
      <a class="close" data-dismiss="modal">×</a>
         </div>
      <div class="modal-body">
      <p>some text</p>

      <ul class="media-grid">
        <%= image_tag("/images/pic02.png") %>
      </ul>

    </div>

    <div class="modal-footer">
      <b><%= link_to "#", '#' %></b>          
    </div>
  </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:31:27+00:00Added an answer on June 4, 2026 at 4:31 pm

    I have created ModalHelper for one project. It helps dynamically create modals and links to them. Hope it helps you:

    Helper code:

    Create file app/helpers/modal_helper.rb

    module ModalHelper
        def modal(css_id, header_text, hidden = true, &block)
            content_tag(:div, :class => 'modal', :id => css_id, :style => ("display:none;" if hidden) ) do
                concat modal_header(header_text)
                concat modal_body(&block)
            end
        end
    
        def modal_button(link_text, href)
            modal_caller link_text, href, :button
        end
    
        def modal_link(link_text, href)
            modal_caller link_text, href
        end
    
        private
    
        def modal_caller(link_text, href, type = nil)
            options = { :"data-toggle" => "modal" }
            options.merge!({ :class => "btn" }) if type == :button
            link_to link_text, "#" + href, options
        end
    
        def modal_header(header_text)
            content_tag(:div, :class => 'modal-header') do
                concat content_tag(:button, 'x', :class => 'close', :"data-dismiss" => 'modal')
                concat content_tag(:h3, header_text)
            end
        end
    
        def modal_body
            content_tag(:div, :class => 'modal-body') do
                yield
            end     
        end 
    end
    

    Link to modal:

    Generates link to your modal.

    <%= modal_link('Sign up', "myModal") %>
    

    Rendering to modal:

    Contains code you want to render.

    <%= modal('myModal', 'Registration') do %>
        <% render 'devise/registrations/register' %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can find why i get this error can someone help? package Android.data; public class
Can someone help me with this scenario? *There is a button, which when tapped,
Can i get the source code for a WAMP stack installer somewhere? Any help
Can I enumerate the constants(const) from a class? I have tried MyClass = class
Can you please clarify about the perimeter variable in the below class. I understand
Can I order my users in the database, so I don't have to say
Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can any one tell, how to get the result of LINQ query contains group
Can we change the default action of the edit selected row button? Here is
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.