I''am trying to set a live preview for my rails app
I using recipe 3 from rails recipies.
It''s a recipe from rails 1.0 in 2.0 i get no live preview
in my testapp i have the following code
:controller
def new
@Post = Post.new
end
def preview
render :layout => false
end
:model
class Post < ActiveRecord::Base
attr_accessor :title, :body
end
view new.rhtml
<html>
<head>
<%= javascript_include_tag "prototype"%>
</head>
<body>
<% form_for :post, @post, :url=> {:action =>
''create'', :id =>
"entry-form" } do |f| %>
<%= f.text_field :title %></p>
<%= f.text_area :body %>
<%= submit_tag "Post" %>
<% end %>
<%= observe_form "post-form",
:update => "live_preview",
:complete => "Element.show(''live-preview'')",
:url => { :action => "preview" }
%>
<div id="live-preview" style="display: none; border: 1px
solid">
</div>
</body>
</html>
:preview.rhtml
<%= textilize params[:page][:body]%>
I got no preview i got nothing.
The only difference in my code and the book i have is into the new.rhtml
because start_form_tag
does not longer exists in 2.0
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I searched and searched but there is happening nothing. Maybe recipe 3 of the book rails recipies is wrong or something. How can i use observe_form? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
For now the log gets all the new information from the preview.
But i got nothing on screen only a black line
This is into my log
Processing HomeController#preview (for 127.0.0.1 at 2008-02-01 13:38:28)
[POST]
Session ID:
BAh7BzoMY3NyZl9pZCIlZDQ0ZGRlMmEwOTIwMzA2OTA3M2UyYTQ2ZWQ0NTU3%0ANTUiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh%0Ac2h7AAY6CkB1c2VkewA%3D--f5e9513b61438c135c515f4e91ff56f0596d1691
Parameters: {"commit"=>"Post",
"post"=>{"title"=>"",
"body"=>"fdfdffddf"},
"authenticity_token"=>"90dfa19958c89b163d86e29bebe88b1bf56fc90a",
"action"=>"preview",
"controller"=>"home"}
Rendering home/preview
Post Columns (0.003355) SHOW FIELDS FROM `posts`
Completed in 0.01117 (89 reqs/sec) | Rendering: 0.00172 (15%) | DB:
0.00336 (30%) | 200 OK [http://0.0.0.0/home/preview]
In my view i have this
<%= observe_form "post-form",
:frequency => 1,
:update => "live_preview",
:complete => "Element.show(''live-preview'')",
:url => { :action => "preview" }
%>
<div id="live-preview" style="display: none; border: 1px
solid"></div>
but the div gives no result of the preview method
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---