Hi: I have a show page with an in place editor field for description. It works great when description is populated. description can be nil, so I notice that when I show a record with no description, the in place editor either doesn''t work or has no place to click to edit. This is still something i''d like to have work. Is there something additional I have to do for when description isn''t populated? from the view: <b>Description:</b> <%= in_place_editor_field :goal, :description %> </p> Thanks so much in advance! Mike -- 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 read in Rails Recipes, that for in-place-editing to work, you need to have some value populated. Something like ''click to edit''... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
nolifetillpleather
2007-Jan-15 18:22 UTC
Re: unpopulated in_place_editor_field not working
Mike Dershowitz wrote:> Hi: > > I have a show page with an in place editor field for description. It > works great when description is populated. description can be nil, so I > notice that when I show a record with no description, the in place > editor either doesn''t work or has no place to click to edit. This is > still something i''d like to have work. Is there something additional I > have to do for when description isn''t populated? > > from the view: > > <b>Description:</b> > <%= in_place_editor_field :goal, :description %> > </p> > > Thanks so much in advance! > > Mike > > -- > Posted via http://www.ruby-forum.com/.use the :external_control option on the in_place_editor_field its the easiest way. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
nolifetillpleather wrote:> Mike Dershowitz wrote: >> >> <b>Description:</b> >> <%= in_place_editor_field :goal, :description %> >> </p> >> >> Thanks so much in advance! >> >> Mike >> >> -- >> Posted via http://www.ruby-forum.com/. > > > use the :external_control option on the in_place_editor_field > > its the easiest way.Thanks for this option. I was unable to find it in the api, so I tried: <b>Description:</b> <%= in_place_editor_field :goal, :description, :external_control %> </p> But that didn''t work. Then I fooled around a bit until I got to: <b>Description:</b> <%= in_place_editor_field :goal, :description, :in_place_editor_options => :external_control %> </p> And that compiled but still didn''t work. Any further sugestions besides setting the default value in the DB to "Add a description here" as the other poster suggests? Thanks again! Mike -- 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 -~----------~----~----~----~------~----~------~--~---
> Any further sugestions besides setting the default value in the DB to > "Add a description here" as the other poster suggests?I sure wish someone could answer this question. I have been poking around and don''t see anything that explains the syntax of the in_place_editor_options well enough that I can make this work. One thing that I wasted a bunch of time on was the :click_to_edit_text - that isn''t what Mike and I want. Instead it is supposed to change the tooltip text when you mouse over the text to edit. Is there a way for me to create a non-database backed attribute for the fake text? and then still have the real attribute edited? It doesn''t look like that is easy to do the way the In Place Editor API is set up. -- Cynthia Kiser cynthia.kiser-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
More searching turned up a post to this list referencing: http://www.akuaku.org/archives/2006/08/in_place_editor_1.shtml I dropped it in, restarted my server, and then started using it. For other newbies, that involved changing the controller line to add the :empty_text parameter: in_place_edit_for :page, :comments, :empty_text => ''(add comment)'' And changing my invocation of in_place_editor_field to include the in_place_editor_options hash: <%= in_place_editor_field :page, :comments, {}, { :nil_content_replacement => ''(add comment)'' } %> -- Cynthia Kiser cynthia.kiser-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 ran into this problem as well with in_place_editor. The :empty_text parameter hack is good. What I wound up doing is using an :external_control which is small-font "edit" text right next to whatever someone might want to edit. If the data is nil the "edit" link is still there. I find this looks better anyway, since short-length values are not that easy to click on. Here''s my code: <% if logged_in? && admin? %> <%=edit_text(@style,''style_num'')%> <% end %> <%= in_place_editor_field(''style'',''style_num'',{},{:external_control => edit_id(@style,''style_num''), :size => 10})%> and as helpers: def edit_id(object,field) "edit_#{object.class.to_s.downcase}_#{object.id}_#{field}" end def edit_text(object,field) "<span class=\"edit\" id=\"#{edit_id(object,field)}\">edit</span>" end Also, a warning: in_place_editor is broken for non-string values! If you try to change an integer type to nil (remove it, basically) you get a nasty error. I submitted a very easy patch for this: http://dev.rubyonrails.org/ticket/7067 No action on it yet though. :( -- 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 -~----------~----~----~----~------~----~------~--~---
nolifetillpleather
2007-Jan-24 00:20 UTC
Re: unpopulated in_place_editor_field not working
Its working for me with Integers and Strings, but I get an error on Float fields. It says Undefined method `size'' for 0.03:Float It does change the value in the database though... On Jan 22, 11:04 pm, Carl Johnson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I ran into this problem as well within_place_editor. The :empty_text > parameter hack is good. What I wound up doing is using an > :external_control which is small-font "edit" text right next to whatever > someone might want to edit. If the data is nil the "edit" link is still > there. I find this looks better anyway, since short-length values are > not that easy to click on. > > Here''s my code: > > <% if logged_in? && admin? %> > <%=edit_text(@style,''style_num'')%> > <% end %> > <%= in_place_editor_field(''style'',''style_num'',{},{:external_control => > edit_id(@style,''style_num''), :size => 10})%> > > and as helpers: > > def edit_id(object,field) > "edit_#{object.class.to_s.downcase}_#{object.id}_#{field}" > end > > def edit_text(object,field) > "<span class=\"edit\" id=\"#{edit_id(object,field)}\">edit</span>" > end > > Also, a warning:in_place_editoris broken for non-string values! If you > try to change an integer type to nil (remove it, basically) you get a > nasty error. I submitted a very easy patch for this: > > http://dev.rubyonrails.org/ticket/7067 > > No action on it yet though. :( > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
nolifetillpleather wrote:> Its working for me with Integers and StringsWhat happens if you change an integer type to nothing? For example if it is currently 5000, blank it out. -- 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 -~----------~----~----~----~------~----~------~--~---
nolifetillpleather
2007-Jan-24 00:56 UTC
Re: unpopulated in_place_editor_field not working
ah, you are right. template missing error. value is updated in the database. On Jan 23, 4:50 pm, Carl Johnson <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> nolifetillpleather wrote: > > Its working for me with Integers and StringsWhat happens if you change an integer type to nothing? For example if it > is currently 5000, blank it out. > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---