Edgewall Software

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#10398 closed defect (fixed)

auto_preview_timeout has no effect — at Version 11

Reported by: franz.mayer@… Owned by: Remy Blank
Priority: normal Milestone: 1.0
Component: ticket system Version: 0.13dev
Severity: normal Keywords: bitesized
Cc: Branch:
Release Notes:

When creating a new ticket, only show the preview after the first modification.

API Changes:
Internal Changes:

Description

Using Trac 0.13dev-r10801 option auto_preview_timeout has no effect. I set it as following

auto_preview_timeout = 0.0

but when creating a new ticket a preview is always shown. But I don't want an auto-preview.

Change History (12)

comment:1 by Remy Blank, 13 years ago

Milestone: 0.13
Resolution: worksforme
Status: newclosed

Works fine here, with the same version. Did you set the option in the [trac] section?

in reply to:  1 ; comment:2 by franz.mayer@…, 13 years ago

Replying to rblank:

Works fine here, with the same version. Did you set the option in the [trac] section?

Yes I set the option in [trac] section.

I debugged following Javascript code and the Firebug shows the correct value for auto_preview_timeout (0).

$.fn.autoSubmit = function(args, update, busy) {
    if (this.length == 0 || auto_preview_timeout <= 0)
      return this;
   ...
}

The strange thing is that it only appears, when I create a new ticket, but when I edit an existing ticket, I get no preview.

Do you have any hint, why this effect does appear? Could it be any plugin? (Yet I search all plugins with string auto_preview_timeout, but haven't found anything).

comment:3 by franz.mayer@…, 13 years ago

It seems that trac sends the preview page already with the very first GET newticket. So in the HTTP response in Firebug I see following HTML:

<div id="ticket" class="ticketdraft">
  <div class="date">
    <p><span class="trac-loading"></span><i>(Ticket noch nicht erstellt)</i></p>

in reply to:  2 ; comment:4 by Remy Blank, 13 years ago

Component: generalticket system
Keywords: bitesized added
Milestone: 0.12.3

Replying to franz.mayer@…:

The strange thing is that it only appears, when I create a new ticket, but when I edit an existing ticket, I get no preview.

Ah, now I see what you mean. You don't actually have an auto-preview, you just have the preview of the "empty" ticket. That must be a simple error in the template. I'll look into it, but feel free to beat me to it :)

by franz.mayer@…, 13 years ago

Attachment: ticket_10398.patch added

possible patch for this ticket

in reply to:  4 comment:5 by franz.mayer@…, 13 years ago

Replying to rblank:

Ah, now I see what you mean. You don't actually have an auto-preview, you just have the preview of the "empty" ticket. That must be a simple error in the template. I'll look into it, but feel free to beat me to it :)

I uploaded a possible patch … maybe putting auto_preview_timeout into req.args isn't that nice, but it works (and I don't want to mess Trac, so I tried to change as little as possible).

comment:6 by Remy Blank, 13 years ago

Resolution: worksforme
Status: closedreopened

No, req.args is indeed not the place to do that. I'm not sure yet, but I think the style of the preview box should be set to display: none if this is the first time the page is shown (i.e. not after hitting "Preview") and it should be shown with JavaScript on page load if auto_preveiw_timeout is non-zero.

(Forgot to reopen.)

comment:7 by Remy Blank, 13 years ago

Milestone: 0.12.30.13

This is actually 0.13-specific.

comment:8 by franz.mayer@…, 12 years ago

I had a little bug in my patch. When hitting the preview button for a new ticket, the preview didn't work anymore.

Here's the diff for the fix:

  • (a) old vs. (b) new

    a b  
    369       <xi:include href="ticket_box.html" py:if="not ticket.exists and auto_preview_timeout > 0" py:with="preview_mode = True"/>
     369      <xi:include href="ticket_box.html" py:if="(not ticket.exists and auto_preview_timeout > 0) or preview_mode == True" py:with="preview_mode = True"/>

comment:9 by Remy Blank, 12 years ago

Owner: set to Remy Blank
Status: reopenednew

comment:10 by Remy Blank, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in [11060]. The preview is now hidden until the user makes her first change. With auto-preview, that's as soon as she edits a field. Without, it's when hitting the "Preview" button.

comment:11 by Christian Boos, 12 years ago

Release Notes: modified (diff)
Note: See TracTickets for help on using tickets.