Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(83)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 3589041: Add confirmation checkbox to Delete button (closes issue #252)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 1 month ago by techtonik
Modified:
14 years, 2 months ago
CC:
codereview-discuss_googlegroups.com
Base URL:
http://rietveld.googlecode.com/svn/trunk/
Visibility:
Public.
BUG=http://code.google.com/p/rietveld/issues/detail?id=252

Patch Set 1 #

Patch Set 2 : Updated for IE #

Patch Set 3 : Alternative onsubmit works 100% #

Total comments: 3
Created: 15 years, 1 month ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -1 line) Patch
M templates/edit.html View 1 2 1 chunk +3 lines, -1 line 3 comments Download
Total messages: 16
|
techtonik
15 years, 1 month ago (2010年12月11日 15:14:13 UTC) #1
Sign in to reply to this message.
gvrpython
Doesn't this require changes to the view code that handles the POST request? On Sat, ...
15 years, 1 month ago (2010年12月11日 16:06:09 UTC) #2
Doesn't this require changes to the view code that handles the POST request?
On Sat, Dec 11, 2010 at 7:14 AM, <techtonik@gmail.com> wrote:
> Reviewers: Andi Albrecht,
>
>
>
> Please review this at http://codereview.appspot.com/3589041/
>
> Affected files:
> M   templates/edit.html
>
>
> Index: templates/edit.html
> ===================================================================
> --- templates/edit.html (revision 623)
> +++ templates/edit.html (working copy)
> @@ -33,9 +33,11 @@
> {%ifequal issue.owner user%}
> <h2>Delete This Issue</h2>
>
> -<form action="{%url codereview.views.delete issue.key.id%}" method="post">
> +<form action="{%url codereview.views.delete issue.key.id%}"
> +   method="post" name="delete">
> <input type="hidden" name="xsrf_token" value="{{xsrf_token}}">
> -<input type="submit" value="Delete Issue"> There is no undo!
> +<input type="checkbox" name="confirm">
> +<input type="submit" value="Delete Issue" onclick="return
> document.delete.confirm.checked"> There is no undo!
> </form>
> {%endifequal%}
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "codereview-discuss" group.
> To post to this group, send email to codereview-discuss@googlegroups.com.
> To unsubscribe from this group, send email to
> codereview-discuss+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/codereview-discuss?hl=en.
>
>
-- 
--Guido van Rossum (python.org/~guido)
Sign in to reply to this message.
techtonik
No. Delete button doesn't activate if onclick handler returns false. Copy/paste this form into http://www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_1 ...
15 years, 1 month ago (2010年12月11日 16:18:52 UTC) #3
No. Delete button doesn't activate if onclick handler returns false.
Copy/paste this form into
http://www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_1 and try
yourself.
<form method="post" name="delete" action="">
<input type="checkbox" name="confirm">
<input type="submit" value="Delete Issue" onclick="return
document.delete.confirm.checked"> There is no undo!
</form>
On 2010年12月11日 16:06:09, guido_python.org wrote:
> Doesn't this require changes to the view code that handles the POST request?
> 
> On Sat, Dec 11, 2010 at 7:14 AM, <mailto:techtonik@gmail.com> wrote:
> > Reviewers: Andi Albrecht,
> >
> >
> >
> > Please review this at http://codereview.appspot.com/3589041/
> >
> > Affected files:
> > &nbsp;M &nbsp; &nbsp; templates/edit.html
> >
> >
> > Index: templates/edit.html
> > ===================================================================
> > --- templates/edit.html (revision 623)
> > +++ templates/edit.html (working copy)
> > @@ -33,9 +33,11 @@
> > &nbsp;{%ifequal issue.owner user%}
> > &nbsp;<h2>Delete This Issue</h2>
> >
> > -<form action="{%url codereview.views.delete issue.key.id%}" method="post">
> > +<form action="{%url codereview.views.delete issue.key.id%}"
> > + &nbsp; &nbsp; &nbsp;method="post" name="delete">
> > &nbsp;<input type="hidden" name="xsrf_token" value="{{xsrf_token}}">
> > -<input type="submit" value="Delete Issue"> There is no undo!
> > +<input type="checkbox" name="confirm">
> > +<input type="submit" value="Delete Issue" onclick="return
> > document.delete.confirm.checked"> There is no undo!
> > &nbsp;</form>
> > &nbsp;{%endifequal%}
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "codereview-discuss" group.
> > To post to this group, send email to
mailto:codereview-discuss@googlegroups.com.
> > To unsubscribe from this group, send email to
> > mailto:codereview-discuss+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/codereview-discuss?hl=en.
> >
> >
> 
> 
> 
> -- 
> --Guido van Rossum (python.org/~guido)
Sign in to reply to this message.
gvrpython
Ok! On Sat, Dec 11, 2010 at 8:18 AM, <techtonik@gmail.com> wrote: > No. Delete button ...
15 years, 1 month ago (2010年12月11日 16:37:15 UTC) #4
Ok!
On Sat, Dec 11, 2010 at 8:18 AM, <techtonik@gmail.com> wrote:
> No. Delete button doesn't activate if onclick handler returns false.
>
> Copy/paste this form into
> http://www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_1 and
> try yourself.
>
> <form method="post" name="delete" action="">
> <input type="checkbox" name="confirm">
> <input type="submit" value="Delete Issue" onclick="return
> document.delete.confirm.checked"> There is no undo!
> </form>
>
>
> On 2010年12月11日 16:06:09, guido_python.org wrote:
>>
>> Doesn't this require changes to the view code that handles the POST
>
> request?
>
>> On Sat, Dec 11, 2010 at 7:14 AM, <mailto:techtonik@gmail.com> wrote:
>> > Reviewers: Andi Albrecht,
>> >
>> >
>> >
>> > Please review this at http://codereview.appspot.com/3589041/
>> >
>> > Affected files:
>> > &nbsp;M &nbsp; &nbsp; templates/edit.html
>> >
>> >
>> > Index: templates/edit.html
>> > ===================================================================
>> > --- templates/edit.html (revision 623)
>> > +++ templates/edit.html (working copy)
>> > @@ -33,9 +33,11 @@
>> > &nbsp;{%ifequal issue.owner user%}
>> > &nbsp;<h2>Delete This Issue</h2>
>> >
>> > -<form action="{%url codereview.views.delete issue.key.id%}"
>
> method="post">
>>
>> > +<form action="{%url codereview.views.delete issue.key.id%}"
>> > + &nbsp; &nbsp; &nbsp;method="post" name="delete">
>> > &nbsp;<input type="hidden" name="xsrf_token" value="{{xsrf_token}}">
>> > -<input type="submit" value="Delete Issue"> There is no undo!
>> > +<input type="checkbox" name="confirm">
>> > +<input type="submit" value="Delete Issue" onclick="return
>> > document.delete.confirm.checked"> There is no undo!
>> > &nbsp;</form>
>> > &nbsp;{%endifequal%}
>> >
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>
> Groups
>>
>> > "codereview-discuss" group.
>> > To post to this group, send email to
>
> mailto:codereview-discuss@googlegroups.com.
>>
>> > To unsubscribe from this group, send email to
>> > mailto:codereview-discuss+unsubscribe@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/codereview-discuss?hl=en.
>> >
>> >
>
>
>
>> --
>> --Guido van Rossum (python.org/~guido)
>
>
>
> http://codereview.appspot.com/3589041/
>
> --
> You received this message because you are subscribed to the Google Groups
> "codereview-discuss" group.
> To post to this group, send email to codereview-discuss@googlegroups.com.
> To unsubscribe from this group, send email to
> codereview-discuss+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/codereview-discuss?hl=en.
>
>
-- 
--Guido van Rossum (python.org/~guido)
Sign in to reply to this message.
techtonik
Actually, the IE behaved not so good, so I've updated the patch. On 2010年12月11日 16:37:15, ...
15 years, 1 month ago (2010年12月11日 17:06:48 UTC) #5
Actually, the IE behaved not so good, so I've updated the patch.
On 2010年12月11日 16:37:15, guido_python.org wrote:
> Ok!
> 
> On Sat, Dec 11, 2010 at 8:18 AM, <mailto:techtonik@gmail.com> wrote:
> > No. Delete button doesn't activate if onclick handler returns false.
> >
> > Copy/paste this form into
> > http://www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_1 and
> > try yourself.
> >
> > <form method="post" name="delete" action="">
> > <input type="checkbox" name="confirm">
> > <input type="submit" value="Delete Issue" onclick="return
> > document.delete.confirm.checked"> There is no undo!
> > </form>
> >
> >
> > On 2010年12月11日 16:06:09, http://guido_python.org wrote:
> >>
> >> Doesn't this require changes to the view code that handles the POST
> >
> > request?
> >
> >> On Sat, Dec 11, 2010 at 7:14 AM, &nbsp;<mailto:techtonik@gmail.com> wrote:
> >> > Reviewers: Andi Albrecht,
> >> >
> >> >
> >> >
> >> > Please review this at http://codereview.appspot.com/3589041/
> >> >
> >> > Affected files:
> >> > &nbsp;M &nbsp; &nbsp; templates/edit.html
> >> >
> >> >
> >> > Index: templates/edit.html
> >> > ===================================================================
> >> > --- templates/edit.html (revision 623)
> >> > +++ templates/edit.html (working copy)
> >> > @@ -33,9 +33,11 @@
> >> > &nbsp;{%ifequal issue.owner user%}
> >> > &nbsp;<h2>Delete This Issue</h2>
> >> >
> >> > -<form action="{%url codereview.views.delete issue.key.id%}"
> >
> > method="post">
> >>
> >> > +<form action="{%url codereview.views.delete issue.key.id%}"
> >> > + &nbsp; &nbsp; &nbsp;method="post" name="delete">
> >> > &nbsp;<input type="hidden" name="xsrf_token" value="{{xsrf_token}}">
> >> > -<input type="submit" value="Delete Issue"> There is no undo!
> >> > +<input type="checkbox" name="confirm">
> >> > +<input type="submit" value="Delete Issue" onclick="return
> >> > document.delete.confirm.checked"> There is no undo!
> >> > &nbsp;</form>
> >> > &nbsp;{%endifequal%}
> >> >
> >> >
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >
> > Groups
> >>
> >> > "codereview-discuss" group.
> >> > To post to this group, send email to
> >
> > mailto:codereview-discuss@googlegroups.com.
> >>
> >> > To unsubscribe from this group, send email to
> >> > mailto:codereview-discuss+unsubscribe@googlegroups.com.
> >> > For more options, visit this group at
> >> > http://groups.google.com/group/codereview-discuss?hl=en.
> >> >
> >> >
> >
> >
> >
> >> --
> >> --Guido van Rossum (python.org/~guido)
> >
> >
> >
> > http://codereview.appspot.com/3589041/
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "codereview-discuss" group.
> > To post to this group, send email to
mailto:codereview-discuss@googlegroups.com.
> > To unsubscribe from this group, send email to
> > mailto:codereview-discuss+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/codereview-discuss?hl=en.
> >
> >
> 
> 
> 
> -- 
> --Guido van Rossum (python.org/~guido)
Sign in to reply to this message.
techtonik
Damn. I refuse to understand why this code works on http://www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_1 but not it Rietveld? ...
15 years, 1 month ago (2010年12月11日 18:02:03 UTC) #6
Damn. I refuse to understand why this code works on
http://www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_1
but not it Rietveld?
<html>
<body>
<form method="post" name="zed">
<input type="hidden" value="{{xsrf_token}}">
<input type="checkbox" id="confirm-delete2">
<input type="text" id="confirm-delete2">
<input type="submit" value="Delete Issue" onclick="return false;"> There is no
undo!
</form>
</body>
</html>
Sign in to reply to this message.
imirkin_alum.mit.edu
I think you need to add a onsubmit= on the form, not an onclick on ...
15 years, 1 month ago (2010年12月11日 21:29:46 UTC) #7
I think you need to add a onsubmit= on the form, not an onclick on the
button. Although generally speaking, I'm not sure why your way doesn't
work.
That's a cool site BTW. You might be interested in jsfiddle.net which
does things along the same lines, but I think is more powerful.
On Sat, Dec 11, 2010 at 1:02 PM, <techtonik@gmail.com> wrote:
> Damn. I refuse to understand why this code works on
> http://www.tutorialspoint.com/cgi-bin/practice.cgi?file=javascript_1
> but not it Rietveld?
>
>
> <html>
> <body>
> <form method="post" name="zed">
> <input type="hidden" value="{{xsrf_token}}">
> <input type="checkbox" id="confirm-delete2">
> <input type="text" id="confirm-delete2">
> <input type="submit" value="Delete Issue" onclick="return false;"> There
> is no undo!
> </form>
> </body>
> </html>
>
>
> http://codereview.appspot.com/3589041/
>
-- 
Ilia Mirkin
imirkin@alum.mit.edu
Sign in to reply to this message.
techtonik
I found the cause thanks to Chrome. It appears that our M_clickCommon handler (used only ...
15 years, 1 month ago (2010年12月12日 00:36:38 UTC) #8
I found the cause thanks to Chrome. It appears that our M_clickCommon handler
(used only to hide help window) shadows code in onclick attribute for IE7. I'll
commit onsubmit stuff if it looks ok for you (last patchset). 
BTW, thanks for jsfiddle.net - I've added it to bookmarks.
Sign in to reply to this message.
bruceleban
I think confirmation after you click delete is a bit more common than confirming before ...
15 years, 1 month ago (2010年12月12日 04:24:33 UTC) #9
I think confirmation after you click delete is a bit more common than confirming
before you click delete. Alternative change below.
http://codereview.appspot.com/3589041/diff/10001/templates/edit.html
File templates/edit.html (right):
http://codereview.appspot.com/3589041/diff/10001/templates/edit.html#newcode36
templates/edit.html:36: <form action="{%url codereview.views.delete
issue.key.id%}" method="post"
I was thinking of something more like this. Note that the fixed width for the
delete button is so that it doesn't change size when the user clicks so if they
double click the button it won't hit the other button.
<form action="{%url codereview.views.delete issue.key.id%}" method="post">
<input type="hidden" name="xsrf_token" value="{{xsrf_token}}">
<input id="pre-delete" type="button" value="Delete Issue"
 style="width:100"
 onclick="var x = document.getElementById('real-delete').style;
 x.display = x.display == '' ? 'none' : ''
 x = document.getElementById('pre-delete');
 x.value = x.value == 'Cancel' ? 'Delete Issue' : 'Cancel';">
<input id="real-delete" type="submit" value="Confirm Delete - NO UNDO!"
style="display:none">
</form>
Sign in to reply to this message.
techtonik
http://jsfiddle.net/UAFp9/ Looks interesting, but to make it work on IE, we need to make our ...
15 years, 1 month ago (2010年12月12日 09:44:47 UTC) #10
http://jsfiddle.net/UAFp9/ Looks interesting, but to make it work on IE, we need
to make our M_clickCommon handler to become active only when help window is
visible. Otherwise M_clickCommon will be fired instead of your onclick event.
Sign in to reply to this message.
gvrpython
Email test, please ignore.
14 years, 8 months ago (2011年05月11日 02:19:23 UTC) #11
Email test, please ignore.
Sign in to reply to this message.
techtonik
My IE is broken, so I won't be able to test any JS that is ...
14 years, 6 months ago (2011年07月06日 15:21:07 UTC) #12
My IE is broken, so I won't be able to test any JS that is more complicated than
my last patch set. So, any LGTM to proceed?
Bruce, you will be able to submit your enhancement in a separate patch once we
have the basic protection in place.
Sign in to reply to this message.
Andi Albrecht
http://codereview.appspot.com/3589041/diff/10001/templates/edit.html File templates/edit.html (right): http://codereview.appspot.com/3589041/diff/10001/templates/edit.html#newcode39 templates/edit.html:39: <input type="checkbox" id="confirm-delete"> A plain checkbox before a button ...
14 years, 6 months ago (2011年07月07日 19:27:42 UTC) #13
http://codereview.appspot.com/3589041/diff/10001/templates/edit.html
File templates/edit.html (right):
http://codereview.appspot.com/3589041/diff/10001/templates/edit.html#newcode39
templates/edit.html:39: <input type="checkbox" id="confirm-delete">
A plain checkbox before a button isn't really self-explaining IMO. Without
knowledge of this review, I wouldn't know what to do with this checkbox and when
it's not checked there's even no feedback when clicking the delete button.
From a UI point of view I see no benefit in this change in the current form.
What about adding at least some descriptive text like "Yes, I understand that
there's NO UNDO." or something similar?
Sign in to reply to this message.
bruceleban
http://codereview.appspot.com/3589041/diff/10001/templates/edit.html File templates/edit.html (right): http://codereview.appspot.com/3589041/diff/10001/templates/edit.html#newcode39 templates/edit.html:39: <input type="checkbox" id="confirm-delete"> On 2011年07月07日 19:27:43, Andi Albrecht wrote: ...
14 years, 6 months ago (2011年07月07日 22:23:44 UTC) #14
http://codereview.appspot.com/3589041/diff/10001/templates/edit.html
File templates/edit.html (right):
http://codereview.appspot.com/3589041/diff/10001/templates/edit.html#newcode39
templates/edit.html:39: <input type="checkbox" id="confirm-delete">
On 2011年07月07日 19:27:43, Andi Albrecht wrote:
> A plain checkbox before a button isn't really self-explaining IMO. Without
> knowledge of this review, I wouldn't know what to do with this checkbox and
when
> it's not checked there's even no feedback when clicking the delete button.
> 
> From a UI point of view I see no benefit in this change in the current form.
> What about adding at least some descriptive text like "Yes, I understand that
> there's NO UNDO." or something similar?
I agree with Andi. My proposal was to instead add a button. When you click
delete, a second button appears that says "Confirm Delete - NO UNDO!" and you
have to press that to delete. (The delete button also changes to cancel so
double click on delete does nothing.) See the code in my previous comment of
12/12/2010. Note that the Delete button is fixed width so it does not change
size when the label changes to cancel. I can submit it as a separate patch if
necessary or I'm happy for techtonik to submit.
Sign in to reply to this message.
gvrpython
This is a test, attempting to send email from guido@python.org. Expect it to fail.
14 years, 2 months ago (2011年10月24日 17:05:21 UTC) #15
This is a test, attempting to send email from guido@python.org. Expect it to
fail.
Sign in to reply to this message.
techtonik
On 2011年10月24日 17:05:21, gvrpython wrote: > This is a test, attempting to send email from ...
14 years, 2 months ago (2011年10月25日 09:04:48 UTC) #16
On 2011年10月24日 17:05:21, gvrpython wrote:
> This is a test, attempting to send email from mailto:guido@python.org. Expect
it to
> fail.
Apparently, it didn't.
Sign in to reply to this message.
|
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /