Displaying 20 results from an estimated 300 matches similar to: "Add method to get at captured content_for"
2010 Aug 18
2
RSpec 2/Rails 3 - content_for in view specs
My main layout includes separate content_for/yield sections for my header,
sidebar, footer, and content. However, when running a view spec, the
`rendered` variable seems to only contain a string of just the primary
content and ignores the header/footer/sidebar as well as the rest of my
layout file (the "render" call just returns my primary content wrapped in
generic <html> and
2007 May 23
4
content_for
Any ideas how I would go about writing specs for views which make use
of content_for?
I''d like, for example, to be able to specify that ABC view places XYZ
in the sidebar, which I do using content_for(:sidebar).
Am I missing something obvious?
Kyle
2008 Apr 19
4
Is testing output within content_for possible?
I wanted to test that the links below were being rendered in the views.
- content_for :sidebar do
%ul.links
%li= edit_link edit_admin_contact_url(@contact), "Contact"
# view test
it "should have the correct side bar links" do
do_render
response.should have_tag("ul.links") do
with_tag("a[href=?]",
2007 Jul 16
4
Accessing content_for html in view specs?
Hi All,
Hope all is going well.
I''ve got a few views that create some content using ''content_for'' blocks
<% content_for :blah do %>
.....
<% end %>
Has anyone worked out a way to be able to access the html that''s
generated inside those blocks?
Since they''re not part of the view, have_tag('''') seems to miss them,
2008 Jan 24
3
Help to spec a rails helper method that uses content_for
Hi guys,
I am a Rspec newbie and am having problems creating a spec for a RoR helper
method.
I have in fact already implemented the helper method and am trying to create
retrospective specs. I know its the wrong way to do it but I am still
learning Rspec.
In my view I have a call to a helper method.
<% body_class "users" %>
which sets a CSS class declaration in the content_for
2008 Sep 17
2
Layouts and content_for
when i studied the tutorial about layouts & content_for from railscast.I
need a clarification as per their tutorial.
url:http://railscasts.com/episodes/8-layouts-and-content-for
<!- projects/index.rhtml ->
<% content_for :head do %> <= stylesheet_link_tag ‘projects’ %>
< end %>
<!- layouts/application.rhtml ->
<head> <title>Todo List</title>
2006 Apr 27
0
partials and content_for
let''s say i''ve got a partial that looks like this:
<% content_for :foo do -%>
partial.id
<% end -%>
then the following works:
<%= render :partial => "partial", :collection => @collection %>
<%= @content_for_foo %>
but this does not:
<%= @content_for_foo %>
<%= render :partial => "partial", :collection =>
2010 Apr 30
0
Content_for & Capture helper
Hi,
Whether content_for and capture helpers will work on ajax updates or in
ajax pagination.
Please help us.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from
2008 May 19
0
How to fetch a block provided by content_for in a helper?
Hi,
I got a title_tag helper that renders default page title or title
provided by content_for block, if such block is present. Currently I
call this method like this: "title_tag(yield(:title))". Is it possible
to fetch :title block inside the helper without explicitly passing it
as a parameter to this helper?
--~--~---------~--~----~------------~-------~--~----~
You received this
2006 Jul 13
5
Generic page element display initializer in a layout?
All,
I''ve run into a snag. I need to handle the display of elements on my
page and I want to use my Javascript event handlers on page load.
However, my BODY tag is trapped in my generic layout.
I''m thinking that I can put an onLoad on the BODY tag that will just
call a Javascript method called initializePage() and then provide this
initializePage() call in my specific page
2011 May 26
8
Is there a way I can create a sub-layout with ERB?
I have 2 pages that have almost the same content except for stuff in
the middle. I''d basically like to have a sub-layout that wraps the
content that is different - exactly the way a normal layout file
would.
How can I call into a layout inside of erb? I''d like to do something
like this:
<%= render :sub-layout => "reusable-wrapper" %>
2006 Apr 04
3
Keeping javascript in the <head>
Given that Rails has built in ways to do almost everything else :) , is
there a way to keep view specific javascripts inside the head tag of a
layout without having to include that javascript on every page?
--
Marlon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060404/65e9bb6d/attachment.html
2008 Mar 11
1
view spec on rails questions
Hi
I have a couple of questions
1)
how do you test the response inside a content_for block
I see reference to it in the release notes but dont know where to
find it (tried http://rspec.info/rdoc-rails/ )
2)
I dont seem to be able to stub partials in a different directory eg
<%= render :partial => "foos/show" %>
And I put this in the spec
template.stub_render(:partial =>
2006 May 23
11
adding layouts within layouts
Hi,
I want to be able to have several layouts within each other so that I don''t
have to keep repeating the layout code for one, in another. An example
would be having a layout for the title of your web page and then having an
embedded layout for the body portion in which the HTML for whatever view
gets displayed. Is this possible?
Thanks.
-------------- next part --------------
An
2007 Sep 21
3
TextMate Bundle and exception when switching to alternate file.
Hey,
sorry if this is something better suited to another list.
I''ve encountered a strange problem with the RSpec.tmbundle in trunk -
namely that it was raising an exception when pressing
ctrl-shift-downarrow (switch between spec and source - "Alternate
File").
I tracked down the issue to be handling of the file_type in
switch_command.rb#content_for() - the code expected the
2007 May 09
5
layouts + routes = confused
I''m new to RoR and the tutorials I''ve found on the web, while helpful,
aren''t as "complete" as I''d like them. I understand the basics when
it comes to layouts and routes, but I''m trying to get them to work
together.
MY first task was to implement a user authentication system
(registration/login/logout/change_password). This works fine with
2006 Mar 17
2
How to let the layout be more OO?
I am confused about the @content_for_layout.''cause it will display all
the views in the layout.Do I have any methods to let the layout be more
OO? I mean that for example,the app currently have more than one views
to be displayed,but only some of them to be displayed at the same time
at different <div></div> units. I hope there exists a kind of way that:
<%= if
2008 Sep 13
2
<meta http-equiv="refresh" content="5"/>
Do you know of any way for me to stick a meta tag in using a
before_filter or after_filter or around_filter?
<meta http-equiv="refresh" content="5"/>
I have been trying to figure out out and just cannot make sense of it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2011 Mar 09
1
" instead of " in js code rendered by erb
Having problems rendering javascript in erb file. Thanks for
suggestions.
//layout erb file
(function() {
...
var widget_properties = {};
<%= content_for?(:extend_widget) ? "widget_properties = " +
yield(:extend_widget) : '''' %>
...
})();
//view erb file
<% content_for :extend_widget do %>
extend = {
_init: function() {
2008 Feb 01
2
proposed patch for fb_request_form_submit
Hi, according to the Facebook docs, you can add a uid to the
fb_request_form_submit button which will pre select the user for the
form.
So you can do:
<fb:request-form action="/my_tasks" method="POST" invite="true"
type="MyApp" content="wants to invite you to xyz app">
<fb:request-form-submit uid="FRIENDID" />