Displaying 20 results from an estimated 2000 matches similar to: "" instead of " in js code rendered by erb"
2011 Oct 12
4
How to access controller's instance variable in a js.erb loaded by javascript_include_tag?
Hello!
In rails 3.1 app I have a controller UsersController with ''show'' action.
show.html.erb contains:
<% content_for(:head) do %>
<%= javascript_include_tag ''myscript'' %>
<% end %>
<p>Hello @user.name</p>
And I have this in myscript.js.erb
$jQuery(document).ready(function() {
alert(<%= @user.name %>);
});
@user is being
2011 Feb 09
16
rails 3.0.4 broke yield :javascript ?
hello,
I have today updated my rails app to 3.0.4 security release but now this
yield :javascripts
fails in the layout and I get my custom js escaped as text in the view.
anybody seeing this also?
tia,
jk
--
www.least-significant-bit.com
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to
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=?]",
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>
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
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
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" %>
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
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 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)
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>
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
2008 Feb 27
2
observe_field not generating any script
Hi - I have a view:
<% content_for(:page) do %>
<h1>New user</h1>
<% form_for :user, @user, :url => { :action => "create" } do |form| %>
<%= render :partial => ''form'', :locals => { :form => form, :genders
=> @genders} %>
<%= submit_tag "Create" %>
<%end%>
<%
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
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" />
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
2010 Jan 18
7
Ruby Array to Java Script Array
Hi,
How can we use an array created in Ruby in Java script ?
Regards,
Prashant
--
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 this group, send email to