Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

edit-in-place

edited July 2006 in Vanilla 1.0 Help
I would really like to see an add-on that would allow users to edit there comments "in-place".

Comments

  • what do you mean? just click edit on the right side like this? http://24ways.org/advent/edit-in-place-with-ajax
  • exactly
  • I was thinking of doing this... Flickr style.
  • edited July 2006
    how do you get that editin lace working? it talks about php and such but where do i put the php and all? i have fixed it. Didnt realise you have to change the name of the php file in prototype.js
  • Immersion: Did you already get this done? I guess I will stop coding then :-)
  • oh lol no wallphone :P i meant i couldnt even get the example to work :p carry on coding
  • I would have tryed it but I've been so busy on my blog code.
  • OK, I am almost done with this... one question: Does anybody know a way to get an array of all the CommentBody IDs that belong to the current user?
  • MarkMark Vanilla Staff
    edited July 2006
    You'd need to run a query. But I don't recommend it because that's a heavy query - especially for every person on every page load. Why not just add your own edit button using the same logic as the existing edit button. Then if that button is clicked, use some fancy javascript to replace the Comment_## id'd element with your input form and present the text for editing. Once a save button is clicked, ajax the save and js the comment back to it's orignal xhtml setup with the new comments in place. I bet you could use sirnot's preview button as a good guideline for the ajaxing.
  • edited July 2006
    Or you could do this. Or just add a "quick edit" button as Mark said.
  • edited July 2006
    Interesting all the different ways this can be done. I am actually removing the edit button. On hover, the CommentBodyID div highlights, and on click it is ajax-replaced with the comment form. Problem is the script needs to know the CommentBodyIDs of the comments the current user may edit in advance so they can be defined in the <head>. I was thinking of a delegate that I could parse out and save the IDs into an array as the comment grid is being built. /me trudges through more code. Thus edith /me: Ha! I can just use the same delegate that I am using to remove the edit links!
  • edited July 2006
    Just give some of the comments a class of "editable" if the user credentials are valid, then loop through the divs looking for that classname. Actually, I'm not sure if there's a way to do that from an extension (no delegate in the middle of the comment classname) without replacing the whole comment grid control. Oh, and be sure to authenticate on the Ajax side too! (but you would have anyway, right?)
  • @bergamot Yah, I am calling the existing comment form control, which has the authentication built in.
This discussion has been closed.