Hey again, Andras,

Andras Kende a écrit :
> inplaceeditor saving image loads only first time once, or after page
> refresh:
> 
> http://www.kende.com/js/
> 
> Is this a bug ?
> 
> .inplaceeditor-saving {
> background: url(wait16.gif) bottom right no-repeat;
> }

Figured it out.  It will go away with the new, refactored version, but
here's the deal for the current one.

By default, the onComplete option triggers a Effect.Highlight on the
element, from the highlightcolor option to the saved background color.
As you may know, Effect.Highlight will attempt to clear the background
image during the fade, restoring it at the end.  The backup operation
relies on getStyle, which requires inline specification of the property
(it won't see any CSS-defined prop).  So it doesn't see your background
image, and restores to 'none'.

The best way around this, since inline styles are mostly difficult due
to the transient use of the background image, is to override the
onComplete default, like so:

new Ajax.InPlaceEditor('yourId', '/your/url', {
  // Whatever options you had,
  onComplete: function() {
    new Effect.Highlight(element, {
      startcolor: Ajax.InPlaceEditor.defaultHighlightColor,
      keepBackgroundImage: true // The key change!
    });
  }
});

The CSS class will be disabled anyway when onComplete triggers, so you
won't see your spinner during the fadeover after save.  But this will
prevent the effect from overriding the style's background-image
property, which in turn won't trumple your CSS-defined image.

If you customized the highlightcolor option, don't forget to use the
same value for the startcolor option here.

'HTH

-- 
Christophe Porteneuve a.k.a. TDD
"[They] did not know it was impossible, so they did it." --Mark Twain
Email: [EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to