Permalink
Browse files

Fix Back button when viewing an asset.

Has been broken by the HTML 5 standard, which has image inputs no longer submit their values, but their .x and .y positions. This is annoying, and more like how IE has always behaved. In [this commit](534e739) (and others like it for media nd templates), Scott fixed a bug related to get the Return button to work on the diff view. Removing that change fixes the view Return button, but breaks the Diff return button. So switch to using a very simple image link for the Diff page return button instead of the image input. That works on any browser, and so now the Return button should work properly both when viewing assets and when viewing diffs.

[#240 state:closed]
  • Loading branch information...
theory committed Dec 2, 2011
1 parent d6a7f4d commit 0d6c5651b42d680c64323e0f52686e1f4a74f5e0
@@ -171,14 +171,17 @@
&>
<& '/widgets/wrappers/table_bottom.mc' &>
% }
-<& '/widgets/profile/button.mc',
- disp => $lang->maketext("Return"),
- value => $param->{diff} ? 'diff' : undef,
- widget => $widget,
- cb => 'return_cb',
- button => 'return_dgreen',
- useTable => 0,
-&>
+% if ($param->{diff}) {
+ <& '/lib/util/back_button.mc' &>
+% } else {
+ <& '/widgets/profile/button.mc',
+ disp => $lang->maketext("Return"),
+ widget => $widget,
+ cb => 'return_cb',
+ button => 'return_dgreen',
+ useTable => 0,
+ &>
+% }
<%args>
$widget
$param
@@ -190,13 +190,17 @@
&>
<& '/widgets/wrappers/table_bottom.mc' &>
% }
-<& '/widgets/profile/button.mc',
- disp => $lang->maketext("Return"),
- value => $param->{diff} ? 'diff' : undef,
- widget => $widget,
- cb => 'return_cb',
- button => 'return_dgreen',
- useTable => 0 &>
+% if ($param->{diff}) {
+ <& '/lib/util/back_button.mc' &>
+% } else {
+ <& '/widgets/profile/button.mc',
+ disp => $lang->maketext("Return"),
+ widget => $widget,
+ cb => 'return_cb',
+ button => 'return_dgreen',
+ useTable => 0
+ &>
+% }
<%args>
$widget
$param
@@ -78,13 +78,17 @@
&>
<& '/widgets/wrappers/table_bottom.mc' &>
% }
-<& '/widgets/profile/button.mc',
- disp => 'Return',
- widget => $widget,
- cb => 'return_cb',
- button => 'return_dgreen',
- value => $param->{diff} ? 'diff' : undef,
- useTable => 0 &>
+% if ($param->{diff}) {
+ <& '/lib/util/back_button.mc' &>
+% } else {
+ <& '/widgets/profile/button.mc',
+ disp => 'Return',
+ widget => $widget,
+ cb => 'return_cb',
+ button => 'return_dgreen',
+ useTable => 0
+&>
+% }
<%args>
$widget
$param
@@ -453,9 +453,7 @@ sub return : Callback(priority => 6) {
my $version_view = get_state_data($widget, 'version_view');
my $media = get_state_data($widget, 'media');
- # note: $self->value =~ /^\d+$/ is for IE which sends the .x or .y position
- # of the mouse for <input type="image"> buttons
- if ($version_view || $self->value eq 'diff' || $self->value =~ /^\d+$/) {
+ if ($version_view || $self->value eq 'diff') {
my $media_id = $media->get_id;
$self->clear_my_state if $version_view;
$self->set_redirect("/workflow/profile/media/$media_id/?checkout=1");
@@ -327,10 +327,7 @@ sub return : Callback(priority => 6) {
my $version_view = get_state_data($widget, 'version_view');
my $story = get_state_data($widget, 'story');
-
- # note: $self->value =~ /^\d+$/ is for IE which sends the .x or .y position
- # of the mouse for <input type="image"> buttons
- if ($version_view || $self->value eq 'diff' || $self->value =~ /^\d+$/) {
+ if ($version_view || $self->value eq 'diff') {
my $story_id = $story->get_id;
$self->clear_my_state if $version_view;
$self->set_redirect("/workflow/profile/story/$story_id/?checkout=1");
@@ -246,9 +246,7 @@ sub return : Callback(priority => 6) {
my $version_view = get_state_data($widget, 'version_view');
my $fa = get_state_data($widget, 'template');
- # note: $self->value =~ /^\d+$/ is for IE which sends the .x or .y position
- # of the mouse for <input type="image"> buttons
- if ($version_view || $self->value eq 'diff' || $self->value =~ /^\d+$/) {
+ if ($version_view || $self->value eq 'diff') {
my $fa_id = $fa->get_id;
clear_state($widget) if $version_view;
$self->set_redirect("/workflow/profile/template/$fa_id/?checkout=1");

0 comments on commit 0d6c565

Please sign in to comment.