Skip to content
This repository
Browse code

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...
commit 6fbfbac9b29eb3ec9f2e4d4f0d9168c1187d9e75 1 parent 4d4d18a
David E. Wheeler authored
19  comp/widgets/media_prof/view_meta.html
@@ -171,14 +171,17 @@
171 171
 &>
172 172
 <& '/widgets/wrappers/table_bottom.mc' &>
173 173
 % }
174  
-<& '/widgets/profile/button.mc',
175  
-    disp      => $lang->maketext("Return"),
176  
-    value     => $param->{diff} ? 'diff' : undef,
177  
-    widget    => $widget,
178  
-    cb        => 'return_cb',
179  
-    button    => 'return_dgreen',
180  
-    useTable  => 0,
181  
-&>
  174
+% if ($param->{diff}) {
  175
+    <& '/lib/util/back_button.mc' &>
  176
+% } else {
  177
+    <& '/widgets/profile/button.mc',
  178
+        disp      => $lang->maketext("Return"),
  179
+        widget    => $widget,
  180
+        cb        => 'return_cb',
  181
+        button    => 'return_dgreen',
  182
+        useTable  => 0,
  183
+    &>
  184
+% }
182 185
 <%args>
183 186
 $widget
184 187
 $param
18  comp/widgets/story_prof/view_meta.html
@@ -190,13 +190,17 @@
190 190
 &>
191 191
 <& '/widgets/wrappers/table_bottom.mc' &>
192 192
 % }
193  
-<& '/widgets/profile/button.mc',
194  
-    disp      => $lang->maketext("Return"),
195  
-    value     => $param->{diff} ? 'diff' : undef,
196  
-    widget    => $widget,
197  
-    cb        => 'return_cb',
198  
-    button    => 'return_dgreen',
199  
-    useTable  => 0 &>
  193
+% if ($param->{diff}) {
  194
+    <& '/lib/util/back_button.mc' &>
  195
+% } else {
  196
+    <& '/widgets/profile/button.mc',
  197
+        disp      => $lang->maketext("Return"),
  198
+        widget    => $widget,
  199
+        cb        => 'return_cb',
  200
+        button    => 'return_dgreen',
  201
+        useTable  => 0
  202
+    &>
  203
+% }
200 204
 <%args>
201 205
 $widget
202 206
 $param
18  comp/widgets/tmpl_prof/view_meta.html
@@ -78,13 +78,17 @@
78 78
 &>
79 79
 <& '/widgets/wrappers/table_bottom.mc' &>
80 80
 % }
81  
-<& '/widgets/profile/button.mc',
82  
-    disp   => 'Return',
83  
-    widget  => $widget,
84  
-    cb      => 'return_cb',
85  
-    button  => 'return_dgreen',
86  
-    value   => $param->{diff} ? 'diff' : undef,
87  
-    useTable => 0 &>
  81
+% if ($param->{diff}) {
  82
+    <& '/lib/util/back_button.mc' &>
  83
+% } else {
  84
+    <& '/widgets/profile/button.mc',
  85
+        disp   => 'Return',
  86
+        widget  => $widget,
  87
+        cb      => 'return_cb',
  88
+        button  => 'return_dgreen',
  89
+        useTable => 0
  90
+&>
  91
+% }
88 92
 <%args>
89 93
 $widget
90 94
 $param
4  lib/Bric/App/Callback/Profile/Media.pm
@@ -453,9 +453,7 @@ sub return : Callback(priority => 6) {
453 453
     my $version_view = get_state_data($widget, 'version_view');
454 454
     my $media = get_state_data($widget, 'media');
455 455
 
456  
-    # note: $self->value =~ /^\d+$/ is for IE which sends the .x or .y position
457  
-    # of the mouse for <input type="image"> buttons
458  
-    if ($version_view || $self->value eq 'diff' || $self->value =~ /^\d+$/) {
  456
+    if ($version_view || $self->value eq 'diff') {
459 457
         my $media_id = $media->get_id;
460 458
         $self->clear_my_state if $version_view;
461 459
         $self->set_redirect("/workflow/profile/media/$media_id/?checkout=1");
5  lib/Bric/App/Callback/Profile/Story.pm
@@ -327,10 +327,7 @@ sub return : Callback(priority => 6) {
327 327
     my $version_view = get_state_data($widget, 'version_view');
328 328
 
329 329
     my $story = get_state_data($widget, 'story');
330  
-
331  
-    # note: $self->value =~ /^\d+$/ is for IE which sends the .x or .y position
332  
-    # of the mouse for <input type="image"> buttons
333  
-    if ($version_view || $self->value eq 'diff' || $self->value =~ /^\d+$/) {
  330
+    if ($version_view || $self->value eq 'diff') {
334 331
         my $story_id = $story->get_id;
335 332
         $self->clear_my_state if $version_view;
336 333
         $self->set_redirect("/workflow/profile/story/$story_id/?checkout=1");
4  lib/Bric/App/Callback/Profile/Template.pm
@@ -246,9 +246,7 @@ sub return : Callback(priority => 6) {
246 246
     my $version_view = get_state_data($widget, 'version_view');
247 247
     my $fa = get_state_data($widget, 'template');
248 248
 
249  
-    # note: $self->value =~ /^\d+$/ is for IE which sends the .x or .y position
250  
-    # of the mouse for <input type="image"> buttons
251  
-    if ($version_view || $self->value eq 'diff' || $self->value =~ /^\d+$/) {
  249
+    if ($version_view || $self->value eq 'diff') {
252 250
         my $fa_id = $fa->get_id;
253 251
         clear_state($widget) if $version_view;
254 252
         $self->set_redirect("/workflow/profile/template/$fa_id/?checkout=1");

0 notes on commit 6fbfbac

Please sign in to comment.
Something went wrong with that request. Please try again.