Commit a8641b4d authored by Chris Rebert's avatar Chris Rebert

Merge pull request #10632 from stuartpb/patch-1

Customizer: Alert on successful save to Gist
parents ef436c76 d5d64c2e
...@@ -24,6 +24,12 @@ window.onload = function () { // wait for load in a dumb way because B-0 ...@@ -24,6 +24,12 @@ window.onload = function () { // wait for load in a dumb way because B-0
throw err throw err
} }
function showSuccess(msg) {
$('<div class="bs-callout bs-callout-info">' +
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + msg +
'</div>').insertAfter('.bs-customize-download')
}
function showCallout(msg, showUpTop) { function showCallout(msg, showUpTop) {
var callout = $('<div class="bs-callout bs-callout-danger">' + var callout = $('<div class="bs-callout bs-callout-danger">' +
'<h4>Attention!</h4>' + '<h4>Attention!</h4>' +
...@@ -60,10 +66,13 @@ window.onload = function () { // wait for load in a dumb way because B-0 ...@@ -60,10 +66,13 @@ window.onload = function () { // wait for load in a dumb way because B-0
data: JSON.stringify(data) data: JSON.stringify(data)
}) })
.success(function (result) { .success(function (result) {
var gistUrl = result.html_url;
var origin = window.location.protocol + '//' + window.location.host var origin = window.location.protocol + '//' + window.location.host
var newUrl = origin + window.location.pathname + '?id=' + result.id var customizerUrl = origin + window.location.pathname + '?id=' + result.id
history.replaceState(false, document.title, newUrl) showSuccess('<strong>Success!</strong> Your configuration has been saved to <a href="' + gistUrl + '">' + gistUrl + '</a> ' +
callback(result.html_url, newUrl) 'and can be revisited here at <a href="' + customizerUrl + '">' + customizerUrl + '</a> for further customization.')
history.replaceState(false, document.title, customizerUrl)
callback(gistUrl, customizerUrl)
}) })
.error(function (err) { .error(function (err) {
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment