|
@ -31,7 +31,13 @@ $(function () { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$.post('/editor/test-login', {}, function(response) { |
|
|
$.post('/editor/test-login', {}, function(response) { |
|
|
$('#publish_btn span').text(response.logged_in ? 'Publish' : 'Sign In'); |
|
|
|
|
|
|
|
|
if(response.logged_in) { |
|
|
|
|
|
$('.publish-dropdown .action-publish').removeClass('hidden'); |
|
|
|
|
|
$('.publish-dropdown .action-signin').addClass('hidden'); |
|
|
|
|
|
} else { |
|
|
|
|
|
$('.publish-dropdown .action-publish').addClass('hidden'); |
|
|
|
|
|
$('.publish-dropdown .action-signin').removeClass('hidden'); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$('#publish_btn').click(function(){ |
|
|
$('#publish_btn').click(function(){ |
|
@ -42,8 +48,23 @@ $(function () { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$('#--publish_btn').click(function(){ |
|
|
|
|
|
if($('#publish_btn span').text() == 'Publish') { |
|
|
|
|
|
|
|
|
$('#new_btn').click(function(){ |
|
|
|
|
|
if(confirm('This will discard your current post. Are you sure?')) { |
|
|
|
|
|
reset_page(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('#signin-domain').on('keydown', function(e){ |
|
|
|
|
|
if(e.keyCode == 13) { |
|
|
|
|
|
$('#signin-btn').click(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
$('#signin-btn').click(function(){ |
|
|
|
|
|
window.location = '/auth/start?me=' + encodeURIComponent($('#signin-domain').val()) + '&redirect=/editor'; |
|
|
|
|
|
}); |
|
|
|
|
|
$('#publish-confirm').click(function(){ |
|
|
|
|
|
$('#publish-help').addClass('hidden'); |
|
|
|
|
|
$('#publish-in-progress').removeClass('hidden'); |
|
|
|
|
|
|
|
|
$.post('/editor/publish', { |
|
|
$.post('/editor/publish', { |
|
|
name: $("#post-name").val(), |
|
|
name: $("#post-name").val(), |
|
@ -51,19 +72,19 @@ $(function () { |
|
|
}, function(response) { |
|
|
}, function(response) { |
|
|
if(response.location) { |
|
|
if(response.location) { |
|
|
reset_page().then(function(){ |
|
|
reset_page().then(function(){ |
|
|
window.location = response.location; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$('#publish-success-url').attr('href', response.location); |
|
|
|
|
|
$('#publish-in-progress').addClass('hidden'); |
|
|
|
|
|
$('#publish-error-debug').html('').addClass('hidden'); |
|
|
|
|
|
$('#publish-error').addClass('hidden'); |
|
|
|
|
|
$('#publish-success').removeClass('hidden'); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
var url = prompt("Enter your URL"); |
|
|
|
|
|
window.location = '/auth/start?me=' + encodeURIComponent(url) + '&redirect=/editor'; |
|
|
|
|
|
|
|
|
$('#publish-in-progress').addClass('hidden'); |
|
|
|
|
|
$('#publish-error-debug').html(response.response).removeClass('hidden'); |
|
|
|
|
|
$('#publish-error').removeClass('hidden'); |
|
|
|
|
|
$('#publish-success').addClass('hidden'); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$('#new_btn').click(function(){ |
|
|
|
|
|
reset_page(); |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|