Displaying 20 results from an estimated 2000 matches similar to: "HOW I: Wrap content sections using blocks and then nest them using lambdas"
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>
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=?]",
2006 Aug 05
2
yield :layout, add extra content at controller level
Hi,
Could someone point me in the right direction for specifying content at
the controller level so that I could use something similar to "yield
:left_nav_content" as well as "yield :layout" in my layouts?
I know I can specifiy this content in my view using something like:
<% content_for("left_nav_content") do %>
<h1>Some Menu Options</h1>
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
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,
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
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 =>
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 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
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
2005 Dec 14
1
writing an MDA, help me avoid corrupted indexes
Hello.
First, I want to thank those responsible for Dovecot IMAP as it was a
real treat to implement in comparison to my mostly-failed attempts with
Cyrus. The passwd-file authentication was exactly what I needed as I
really didn't want to have to deal with PAM or LDAP but where I am
setting up a server with virtual accounts.
I'm using Postfix as an MTA, and it quite handily passes
2010 Jan 31
3
Append/Prepend to a template from controller method
I want a method in app/controllers/application.rb that can
prepend/append text to whatever template gets rendered. Of course I
can''t call render twice w/o getting a double render error, so is this
possible?
I want to redirect after a delay using a meta refresh. Here''s what I''ve
got:
app/controllers/application_controller.rb:
def redirect_after_delay (url, delay)
2007 Jul 03
5
HOW TO: Easily output alternating item styles via metaprogramming
I always need to apply alternating item styles when outputting a collection,
here''s what I''ve been using recently.
In the app helper I define this method:
def alternate(items,alt=false
items.map{|i| i.class}.each { |k| k.class_eval {attr_accessor :alt}}
items.each { |i| i.alt, alt = alt, !alt }
end
When I call the partial I wrap the collection with this method:
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
2010 May 05
2
Add method to get at captured content_for
In Rails 3 the only way to get for content captured with the
content_for method in a view is to call yield from within a view.
However, sometimes is it useful to get to this data from within a
helper (for instance to provide a default value). Calling yield from
within the helper method won''t work, and accessing the @_content_for
variable directly is not encouraged.
Proposed solution: add
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 =>
2010 Aug 26
1
[PATCH] Adding the ability to select a Host to start a VM
Signed-off-by: Simon COURTOIS <scourtois at linagora.com>
---
src/app/controllers/vm_controller.rb | 5 ++
src/app/models/vm_task.rb | 4 +-
src/app/views/vm/start.rhtml | 77 ++++++++++++++++++++++++++++++++++
src/task-omatic/taskomatic.rb | 7 +++-
4 files changed, 91 insertions(+), 2 deletions(-)
create mode 100644 src/app/views/vm/start.rhtml
diff
2010 Aug 25
0
[PATCH] Adding the VM Pool migration for vms
Signed-off-by: Simon COURTOIS <scourtois at linagora.com>
---
src/app/controllers/vm_controller.rb | 16 +++++++++++++
src/app/views/vm/edit_vmpool.rhtml | 39 ++++++++++++++++++++++++++++++++
src/app/views/vm/show.rhtml | 3 ++
src/public/images/icon_vmpool_11px.png | Bin 0 -> 542 bytes
4 files changed, 58 insertions(+), 0 deletions(-)
create mode 100644
2010 Sep 01
1
[PATCH 1/3] Adding the VM Pool migration for vms
Signed-off-by: Simon COURTOIS <scourtois at linagora.com>
---
src/app/controllers/vm_controller.rb | 16 ++++++++++++++
src/app/views/vm/edit_vmpool.rhtml | 36 ++++++++++++++++++++++++++++++++
src/app/views/vm/show.rhtml | 3 ++
src/public/images/icon_vmpool_11px.png | Bin 0 -> 542 bytes
4 files changed, 55 insertions(+), 0 deletions(-)
create mode 100644