Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Rendering Partials into Bootstrap Modals
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Scott Elwood  
View profile  
 More options Nov 7 2012, 4:01 pm
From: Scott Elwood <mcpant...@gmail.com>
Date: Wed, 7 Nov 2012 13:01:30 -0800 (PST)
Local: Wed, Nov 7 2012 4:01 pm
Subject: Rendering Partials into Bootstrap Modals

I was looking for an easy way to do this, so this is what I came up with...

First, include the modal somewhere in your applications html file,

<div class="modal hide fade" data-yield="modal"></div>

Now we create a helper file called modal_helper.js.coffee and put this
inside:

AppName.modal = (context, path) ->
  context.render {source: path, into: 'modal'}
  $(".modal").modal()

Now in our controller action, we can call this:

AppName.modal(@, "path/to/_partial")

And it works perfect for me, hope someone else can find this helpful
because I couldn't find many resources regarding this specific usage.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott Elwood  
View profile  
 More options Nov 7 2012, 4:33 pm
From: Scott Elwood <mcpant...@gmail.com>
Date: Wed, 7 Nov 2012 13:33:40 -0800 (PST)
Local: Wed, Nov 7 2012 4:33 pm
Subject: Re: Rendering Partials into Bootstrap Modals

I modified the helper a little bit to include a hide ability in case you
want to close the modal in your controller,

The new helper:

AppName.modal = (context, path) =>
  if context is 'hide'
    $(".modal").modal('hide')
  else
    context.render {source: path, into: 'modal'}
    $(".modal").modal()

So you can now call the previous function in your controllers...

AppName.modal(@, "path/to/_partial")

Or close the modal with this...

AppName.modal("hide")


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »