Thanks for the screencast
Does any one know if it can be integrated with simple_form ?
Is theere any easy way to add a submit and cancel buttons instead of hitting enter/esc ?
Ryan says "when I un-focus" so it doesn't seem that Enter are required for the editions to take place,,, guess the best-in-place js s take care of that
I was asking the a similar thing myself: "what if I want to have a carriage return in the middle of batman's bio ???"
Hi @Gr, I agree you should use best in place only in the right places and when it makes sense. However the overload you might experience will be low since these requests do not render any content and will be served fast.
Anyway best in place is not meant to be used as an alternative to large forms, only for small and concrete things.
Do you recommend anything like this that could be used for larger forms?
Something that doesn't send a request every time, but rather when you save the page?
well... you could change your whole edit action view to look exactly the same as your show, so the user gets that feeling that he/she is editing the thing directly....
this could be activated by some nice button that says "Activate edit mode" (which also warns that the changes are instantly saved)
and at the bottom of the page (or wherever it fits) another button saying "Finished with my edits" , which redirects to show view...
this way you would cut down on requests that aren't made precisely to edit (some user randomly clicking your UI... happens....)
@gaaady: the on_the_spot gem offers similar functionality, but uses jEditable under the cover, so standard comes with the Ok/Cancel buttons and is form-builder agnostic, so usable from simple_form, formtastic, ...
Great screencast - great gem. However, there's one big problem with validation. It tells you what you did wrong, but it doesn't show you what you did. It's especially bad with the email example. The field contains a valid email. The user changes it to an invalid email. The valid email is redisplayed with a message saying it's invalid!
I think one of the prime directives of UI should be that if the user makes a mistake, he should be able to edit it, rather than re-enter it.
I can see some uses for this gem, but I would not use it if validation is needed.
This is almost eerie. I was just now Googling around for an in-place edit solution in Rails... and suddenly it shows up as one of the latest Railscasts :). Awesome!
I sometimes wonder if Ryan has a way to check the most searched google queries related to Rails (does Google provide such a feature?) or that he simply checks the search queries on his site. It's way too often that I've seen Ryan releasing tutorials that I or at least a few viewers where actually looking for in the past weeks.
yes, google for webmasters allows you to see a count estimate of the any related topic you may be watching,,, it was created as a tool for SEO but i guess you could use it that way too...
Can somebody give an example of how to use type :date? Is there a way to format the display? I'd like to pick the day/month/year without any time elements. When I use
Hey guys, great cast. It totally works as long I don't use my authentication filter in the controller. That before_filter just checks if session[:user_id] exists (derived from "Authentication from scratch"). It redirects to an info page in the latter case that no user is signed in.
So I am using best_in_place from a signed in state but what happens is that the changes are not propagated and additionally the session seems to be reset since I am logged out then.
this was extremely awesome. now if we can do multiple fields update that would be brilliant. almost reach the same level as those javascript MVC frameworks.
I am using devise and I am getting this error. I know it has something to do with devise or authentication tokens. Can anyone give me some advise? Here is my error.
I have put this tag in my layout
<%= csrf_meta_tag %>
Completed 401 Unauthorized
What would be the case if I dont want to specify the gender array in the /users/show.html.erb page as collection: [["Male", "Male"], ["Female", "Female"], ["", "Unspecified"]]
but rather define an array in the gender action inside the user class and reference it on show page?
def gender
['Male', 'Female']
end
and how to call these in the index using best_in_place syntax?
Sometimes after trying to edit a field, best in place rejects the edit. When I try clicking on the same field to edit again, it doesn't let me click until I refresh. Any idea why this happens?
In these cases, no error message flashes. In the cases where the error message does flash, I can re-enter the invalid data as normal. So the two seem to co-occur.
Clicking on the "Edit" button, in my case, the first time does not activate the editing
I have to click on the description text once and then click on the "Edit" button to activate the editing.
I can't get the javascript to load. I mean, the javascript file I see in my code, but then I can't get anything to call the best_in_place thing properly. Everything errors saying it isn't there.
Bashing head into wall. Debugging Javascript is impossible.
I'm having the same issue now. I get a "TypeError: Object [object Object] has no method 'best_in_place'" from the dom ready call. Did you ever figure it out?
Thanks Ryan, i have been looking for this. You are the best. How can one use this with tinymce or allow some HTML?
I take it back, i figured it out.
Do you mind telling us how?
I'm crying laughing at that xkcd comic. Let's be friends =)
Thanks for the screencast
Does any one know if it can be integrated with simple_form ?
Is theere any easy way to add a submit and cancel buttons instead of hitting enter/esc ?
Ryan says "when I un-focus" so it doesn't seem that Enter are required for the editions to take place,,, guess the best-in-place js s take care of that
I was asking the a similar thing myself: "what if I want to have a carriage return in the middle of batman's bio ???"
thanks for the screencast but i think we must use it carefully cause it sends much more request to the server than the usual form.
Hi @Gr, I agree you should use best in place only in the right places and when it makes sense. However the overload you might experience will be low since these requests do not render any content and will be served fast.
Anyway best in place is not meant to be used as an alternative to large forms, only for small and concrete things.
Do you recommend anything like this that could be used for larger forms?
Something that doesn't send a request every time, but rather when you save the page?
@amzwebcreations, that would be really, really nice
read my post from up here,,, maybe that will help...
How about using normal edit form and style out of focus inputs to resemble normal text (without borders etc.)
well... you could change your whole edit action view to look exactly the same as your show, so the user gets that feeling that he/she is editing the thing directly....
this could be activated by some nice button that says "Activate edit mode" (which also warns that the changes are instantly saved)
and at the bottom of the page (or wherever it fits) another button saying "Finished with my edits" , which redirects to show view...
this way you would cut down on requests that aren't made precisely to edit (some user randomly clicking your UI... happens....)
thanks Ryan, really good as usual.
Do you think it's complicate to replace the text_area
by ck_editor or some like that ?
I haven't look into that but as far as I can tell it looks complicated to integrate.
@gaaady: the on_the_spot gem offers similar functionality, but uses jEditable under the cover, so standard comes with the Ok/Cancel buttons and is form-builder agnostic, so usable from simple_form, formtastic, ...
Hope this helps.
I recommend on_the_spot - Great Gem and Nathan is a badass.
It's impossible to edit a field with a blank value ;) At least in Ryan's Demo. Some styling might help?
+1
maybe some modifications to the js are needed... out of my head I can think of including the label on the :onclick event that triggers the edition...
or maybe changing the empty value to something like "none"
Is there any way to make sure that only if logged_in? and post_owner? conditions are satisfied before showing the editing area
If you use
<%= best_in_class_if (logged_in? && post_owner?), @post, :title %>
Then it will render uneditable text if you don't satisfy the if statement.
Great screencast - great gem. However, there's one big problem with validation. It tells you what you did wrong, but it doesn't show you what you did. It's especially bad with the email example. The field contains a valid email. The user changes it to an invalid email. The valid email is redisplayed with a message saying it's invalid!
I think one of the prime directives of UI should be that if the user makes a mistake, he should be able to edit it, rather than re-enter it.
I can see some uses for this gem, but I would not use it if validation is needed.
Great plugin, great screencast.
Any way to
tab
through the multiple fields (MS Excel style) andsubmit
once the mouse clicks outside of the fields?Do you think this can work for "complex forms" or "nested_forms"?
great as usual
how can edit grid data?
i wanna using it to admin panel
This is almost eerie. I was just now Googling around for an in-place edit solution in Rails... and suddenly it shows up as one of the latest Railscasts :). Awesome!
I sometimes wonder if Ryan has a way to check the most searched google queries related to Rails (does Google provide such a feature?) or that he simply checks the search queries on his site. It's way too often that I've seen Ryan releasing tutorials that I or at least a few viewers where actually looking for in the past weeks.
Anyway, can't complain either way!
yes, google for webmasters allows you to see a count estimate of the any related topic you may be watching,,, it was created as a tool for SEO but i guess you could use it that way too...
but this time I think you were just lucky :D
has anyone used this with paperclip or carrierwave for swapping out images on-the-fly?
what else needs to be added for something like this github feature
best_in_place and mongoid are compatible?
gem 'best_in_place_mongoid' :D
Does anyone know how is the red pen implemented?
That's just CSS. It's a background-image that floats in from the left using CSS3 Transitions!
Is it possible to use best_in_place with decorators (e.g. Draper)? If so, how?
Got it.
Can somebody give an example of how to use type :date? Is there a way to format the display? I'd like to pick the day/month/year without any time elements. When I use
<%= best_in_place @class_time, :completion_date, type: :date %>
the field is not editable
Hey guys, great cast. It totally works as long I don't use my authentication filter in the controller. That before_filter just checks if session[:user_id] exists (derived from "Authentication from scratch"). It redirects to an info page in the latter case that no user is signed in.
So I am using best_in_place from a signed in state but what happens is that the changes are not propagated and additionally the session seems to be reset since I am logged out then.
Anyone an idea?
Okay: problem was very n00bey :D I accidentally removed the csrf meta token from my layout. That caused the session reset.
this was extremely awesome. now if we can do multiple fields update that would be brilliant. almost reach the same level as those javascript MVC frameworks.
Hi, Sorry Noobee! <8-( In-Line Editing not working! Followed in tutorial to the letter but for Rails 3.0.11 ruby 1.9.2.
On Clicking the text field appears but on pressing tab or enter the data is not edited.
Also I was wandering if this could apply to the index page i.e any other page within the controller for that matter!
Ryan Love Your Casts! You Rock!
check the runtime dependencies in http://rubygems.org prior to starting any feature addition ....
for example... http://rubygems.org/gems/best_in_place best_in_place requires Rails ~> 3.1.0 ....
Thanks for the awesome tutorial, just got a bit stuck though.
I am up to the stage of amending my show.html.erb, but when I try reloading the page I am getting...
undefined method `movie_title_path' for #<#Class:0xa16fea4:0xa434a2c>
I am using nested resources which gives me the url /movie/movie_titles/6.
Is there something I am missing?
Thanks!!!
All good, just done what I should do before posting anything...google search.
Found that you can add the option :path => movie_movie_titles_path to the inputs
Thanks!
I am using devise and I am getting this error. I know it has something to do with devise or authentication tokens. Can anyone give me some advise? Here is my error.
I have put this tag in my layout
<%= csrf_meta_tag %>
Completed 401 Unauthorized
Is there a way to display just the checkbox instead of a word ?
I posted a possible solution for that on stackoverflow
Has anyone run into the problem that best_in_place editing works only once, and to work again one has to refresh the page?
Without refreshing the page, clicking on the field doesn't change it into an input field.
Yes, just now!
and one similar issue is open on the Github page.
Hi, the application is running well with firefox but not with google chrome. chrome does not recognize when I click on a field.
How can this be used on a create action to keep the user on the same page? Any ideas?
Hi Ryan, Indeed great screencast.
What would be the case if I dont want to specify the gender array in the
/users/show.html.erb page
ascollection: [["Male", "Male"], ["Female", "Female"], ["", "Unspecified"]]
but rather define an array in the gender action inside the user class and reference it on show page?
def gender
['Male', 'Female']
end
and how to call these in the index using best_in_place syntax?
Thanks,
I'm not sure if I'm understanding your question correctly. You could call
@user.gender
in the view if you want to put the array in a method.Sometimes after trying to edit a field, best in place rejects the edit. When I try clicking on the same field to edit again, it doesn't let me click until I refresh. Any idea why this happens?
In these cases, no error message flashes. In the cases where the error message does flash, I can re-enter the invalid data as normal. So the two seem to co-occur.
Any help is greatly appreciated!
In addition to that, I also have major problems with the Callbacks. If I use it, the in-place-edit function simply stops working.
I have the following code
<%= bestin_place comment, :description, :type => :textarea,:ok_button => "Save", :cancel_button => "Cancel",:activator => "#edit#{comment.id}" %>
<%= buttontag "Edit" , :id => "edit#{comment.id}" %>
I have multiple of these in my view.
Clicking on the "Edit" button, in my case, the first time does not activate the editing
I have to click on the description text once and then click on the "Edit" button to activate the editing.
I can't get the javascript to load. I mean, the javascript file I see in my code, but then I can't get anything to call the best_in_place thing properly. Everything errors saying it isn't there.
Bashing head into wall. Debugging Javascript is impossible.
I'm having the same issue now. I get a "TypeError: Object [object Object] has no method 'best_in_place'" from the dom ready call. Did you ever figure it out?
Place this in the Gemfile:
gem 'best_in_place', github: 'bernat/best_in_place'
Another option is X-editable. It offers similar functionality, but uses Bootstrap/JqueryUI/Jquery elements. Really works fantastic in my Bootstrap UI.
I learn some new stuff from it too, thanks for sharing your information.