Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes .../edit&switch_locale=en... bug with copywriting. #1820

Merged
merged 1 commit into from

3 participants

@gwagener
Collaborator

The error that 8d0c1a7 fixed was not caused by d0cef21, but rather by 4d3488b (the fix for #1397). Previously the first three replace lines had removed things after the ?, but not the ? itself. Then the last two replace lines cleaned up any mess, either a trailing ? or ?&... With the ? removed the last two replace lines did nothing and the result was .../edit&switch_locale=en...

In the 2-0-stable branch 8a457dd reverted 8a457dd, but did not override the fix for #1397 so it didn't actually fix anything.

This change combines the first three lines into one and replaces the last two lines with a regex that replaces the offending & with a ? (but not any subsequent &s or anything if the url is already correct).

This also brings the fix for #1397 into https://github.com/resolve/refinerycms/blob/2-0-stable/core/app/assets/javascripts/refinery/modal_dialogs.js.erb. I think d0cef21 and 8a457dd should be safe to re-submit.

@parndt
Owner

Good show old chap.

Feel free to re-submit the commit we reverted earlier.

@parndt parndt merged commit 637be40 into refinery:2-0-stable
@travisbot

This pull request fails (merged 637be40 into 01cf674).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
7 core/app/assets/javascripts/refinery/admin.js.erb
@@ -68,11 +68,8 @@ init_modal_dialogs = function(){
'dialog-width': parseInt($($(anchor).attr('href').match("width=([0-9]*)")).last().get(0), 10)||928
, 'dialog-height': parseInt($($(anchor).attr('href').match("height=([0-9]*)")).last().get(0), 10)||473
, 'dialog-title': ($(anchor).attr('title') || $(anchor).attr('name') || $(anchor).html() || null)
- }).attr('href', $(anchor).attr('href').replace(/((\&(amp\;)?)|\?)dialog\=true/, '')
- .replace(/((\&(amp\;)?)|\?)width\=\d+/, '')
- .replace(/((\&(amp\;)?)|\?)height\=\d+/, '')
- .replace(/(\?&(amp\;)?)/, '?')
- .replace(/\?$/, ''))
+ }).attr('href', $(anchor).attr('href').replace(/(&(amp;)?|\?)(dialog=true|(width|height)=\d+)/g, '')
+ .replace(/(\/[^&\?]*)&(amp;)?/, '$1?'))
.click(function(e){
$anchor = $(this);
iframe_src = (iframe_src = $anchor.attr('href'))
View
7 core/app/assets/javascripts/refinery/modal_dialogs.js.erb
@@ -5,11 +5,8 @@ init_modal_dialogs = function(){
'dialog-width': parseInt($($(anchor).attr('href').match("width=([0-9]*)")).last().get(0), 10)||928
, 'dialog-height': parseInt($($(anchor).attr('href').match("height=([0-9]*)")).last().get(0), 10)||473
, 'dialog-title': ($(anchor).attr('title') || $(anchor).attr('name') || $(anchor).html() || null)
- }).attr('href', $(anchor).attr('href').replace(/(\&(amp\;)?)?dialog\=true/, '')
- .replace(/(\&(amp\;)?)?width\=\d+/, '')
- .replace(/(\&(amp\;)?)?height\=\d+/, '')
- .replace(/(\?&(amp\;)?)/, '?')
- .replace(/\?$/, ''))
+ }).attr('href', $(anchor).attr('href').replace(/(&(amp;)?|\?)(dialog=true|(width|height)=\d+)/g, '')
+ .replace(/(\/[^&\?]*)&(amp;)?/, '$1?'))
.click(function(e){
$anchor = $(this);
iframe_src = (iframe_src = $anchor.attr('href'))
Something went wrong with that request. Please try again.