Skip to content

Commit

Permalink
Merge pull request #247 from B2SHARE/record/dynamic-new-page-#235
Browse files Browse the repository at this point in the history
fixed #235: auto refreshing new record page
  • Loading branch information
llehtine committed Apr 11, 2014
2 parents 1444293 + 80f329e commit a5ad7f8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
3 changes: 1 addition & 2 deletions invenio/lib/record_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def decorated(recid, *args, **kwargs):
return redirect(url_for('webaccount.login', **url_args))
elif auth_code:
if check_fresh_record(current_user, recid):
flash(auth_msg, 'Please wait, your record is being processed')
abort(apache.HTTP_NOT_FOUND)
return render_template('record_waitforit.html', recid=recid)
else:
flash(auth_msg, 'error')
abort(apache.HTTP_UNAUTHORIZED)
Expand Down
7 changes: 2 additions & 5 deletions simplestore/etc/static/js/simplestore-deposit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ $(document).ready(function() {
$.post("addmeta/" + $('#sub_id').val(), $("#metaform_form").serialize(),
function(data) {
if (data.valid) {
//Load new page with success message
var newDoc = document.open("text/html", "replace");
newDoc.write(data.html);
newDoc.close();

// redirect to new url location, with history
window.location.href = data.newurl;
} else {
//Just replace metadata form with errors
$('#meta-fields').html(data.html);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "page.html" %}
{% block header %}
{{ super() }}
<meta http-equiv="refresh" content="10">
{% css 'css/simplestore-style.css', '50-simplestore' %}
{% endblock %}

Expand All @@ -9,26 +10,18 @@
<div id = "page-header">
<div class="container">
<div class="deposit-result">
<h1>Deposit Successful</h1>
<h1>New Record</h1>

<div class="deposit-text">
Your submission will shortly be available at: <br/>
<a href="{{ url_for('record.metadata', recid=recid) }}">
{{ url_for('record.metadata', recid=recid, _external=True) }}
</a>
<p/>
<p>Please note that it may take a few minutes to process your submission.
This record is being processed and will be available shortly. Please wait.
</div>
</div>
<div class="another-item">
<a href="{{ url_for('.deposit') }}">
<button class="btn btn-primary btn-large">Deposit another item</button>
</a>
</div>
<!-- MARC output
{{ marc }}
-->

</div>
</div>

{% endblock %}
4 changes: 2 additions & 2 deletions simplestore/lib/simplestore_deposit_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def addmeta(request, sub_id):
# all usual tasks have priority 0; we want the bibuploads to run first
task_low_level_submission('bibupload', 'webdeposit', '--priority', '1', '-r', tmp_file)
return jsonify(valid=True,
html=render_template('simplestore-finalize.html',
recid=recid, marc=marc))
newurl=url_for("record.metadata", recid=recid),
html=render_template('record_waitforit.html', recid=recid, marc=marc))

current_app.logger.error("returning form addmeta")
return jsonify(valid=False,
Expand Down

0 comments on commit a5ad7f8

Please sign in to comment.