Quantcast

supporting @template=oktempl|errortmpl

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

supporting @template=oktempl|errortmpl

John P. Rouillard
Hi everybody.

You may have seen the earlier discussion between Ralf and me on
choosing a template on submission error.

    https://sourceforge.net/p/roundup/mailman/roundup-devel/thread/20170205190838.12B6580693%40vm71.cs.umb.edu/#msg35648327

TL;DR when implementing a modal interaction:

  read only -> edit -> read only

if the edit -> read only generates an error, the error is displayed
but the contents of the form used for the edit are thrown away. None
of the changes make it to the db and the user has lost his/her
work. What I wanted to implement was:

   read only -> edit -> if successful -> read only
                     -> if error -> edit

where the error edit condition preserves all the changes.

Let's refer to this as a modal template model.

Rather than creating a new @errortemplate and trying to work that
through all the code, I am changing the format of the @template
parameter. Is is now:

  either a pure template name (item, index, register ....)

or

  two templates separated by a vbar '|' The left hand template is used
  if no error is detected and the right hand template is used if there
  is an error.

I originally tried implementing modal templates in the handler
function for the EditItemAction and NewItemAction classes in
cgi/actions.py. However if a user creates a new action as part of a
tracker and that action raises an error, the user has to implement the
modal template model in their action.

I think I found the correct place to implement this which is in
Client::selectTemplate() in cgi/client.py. A 6 line change at the top
of the function seems to implement the modal template model that works
for the cases I threw at it.

I have an automated test in place and the code ready to go. So does
anybody have an objection to my committing this change?

Also does anybody have a suggestion where this change should be
documented. Is customizing.txt really the only place the template url
param is discussed?

--
                                -- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Roundup-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/roundup-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: supporting @template=oktempl|errortmpl

Ralf Schlatterbeck-3
On Thu, Feb 16, 2017 at 09:05:44PM -0500, John P. Rouillard wrote:
[...]

> Let's refer to this as a modal template model.
>
> Rather than creating a new @errortemplate and trying to work that
> through all the code, I am changing the format of the @template
> parameter. Is is now:
>
>   either a pure template name (item, index, register ....)
>
> or
>
>   two templates separated by a vbar '|' The left hand template is used
>   if no error is detected and the right hand template is used if there
>   is an error.
>
> I originally tried implementing modal templates in the handler
> function for the EditItemAction and NewItemAction classes in
> cgi/actions.py. However if a user creates a new action as part of a
> tracker and that action raises an error, the user has to implement the
> modal template model in their action.
>
> I think I found the correct place to implement this which is in
> Client::selectTemplate() in cgi/client.py. A 6 line change at the top
> of the function seems to implement the modal template model that works
> for the cases I threw at it.
>
> I have an automated test in place and the code ready to go. So does
> anybody have an objection to my committing this change?
>
> Also does anybody have a suggestion where this change should be
> documented. Is customizing.txt really the only place the template url
> param is discussed?

Looks good to me, thanks for following this through with me dropping out
of the conversation...
I'd say go ahead and implement it this way.

Ralf
--
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   http://www.runtux.com
Reichergasse 131, A-3411 Weidling       email: [hidden email]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Roundup-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/roundup-devel
Loading...