Skip to content

Commit

Permalink
feat: Improve edit dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
drorganvidez committed Jul 18, 2024
1 parent ac8ceb5 commit c78a84d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
8 changes: 6 additions & 2 deletions app/modules/dataset/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,16 @@ def update_dataset():
logger.info("Updating dataset...")
dataset = dataset_service.update_from_form(form=form, current_user=current_user, dataset=dataset)
logger.info(f"Updating deposition with id {dataset.get_zenodo_deposition()}")
zenodo_service.update_deposition(deposition_id=dataset.get_zenodo_deposition(),
metadata=dataset.get_zenodo_metadata())
except Exception as exc:
logger.exception(f"Exception while saving dataset data in local {exc}")
return jsonify({"Exception while saving dataset data in local: ": str(exc)}), 400

try:
zenodo_service.update_deposition(deposition_id=dataset.get_zenodo_deposition(),
metadata=dataset.get_zenodo_metadata())
except Exception as exc:
logger.exception(f"Exception while update deposition in Zenodo: {exc}")

msg = "[Back] Everything works!"
return jsonify({"message": msg}), 200

Expand Down
26 changes: 24 additions & 2 deletions app/modules/dataset/templates/dataset/view_dataset.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,27 @@
</a>
</div>


</div>

<div class="row">

<div class="col-xl-8 col-lg-12 col-md-12 col-sm-12">
<div class="col-xl-8 col-lg-12 col-md-12 col-sm-12 order-md-1 order-sm-1">

<div class="card">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between">

<h1><b>{{ dataset.ds_meta_data.title }}</b></h1>
<div>
<span class="badge bg-secondary">{{ dataset.get_cleaned_publication_type() }}</span>
</div>
</div>

<div class="d-flex align-items-center justify-content-between">

</div>

<p class="text-secondary">{{ dataset.created_at.strftime('%B %d, %Y at %I:%M %p') }}</p>

<div class="row mb-4">
Expand Down Expand Up @@ -186,6 +193,21 @@ <h1><b>{{ dataset.ds_meta_data.title }}</b></h1>
</div>
{% endif %}

{% if dataset.is_mine() %}
<div class="card-body" style="padding-top: 0px">

<hr>

<a href="{{ url_for('dataset.edit_dataset', dataset_id=dataset.id)}}" class="btn btn-outline-primary" style="border-radius: 5px;">
<i data-feather="edit" class="center-button-icon"></i>
Edit
</a>

</div>
{% endif %}



</div>

<div class="card">
Expand Down Expand Up @@ -233,7 +255,7 @@ <h3> Related publication </h3>

</div>

<div class="col-xl-4 col-lg-12 col-md-12 col-sm-12">
<div class="col-xl-4 col-lg-12 col-md-12 col-sm-12 order-md-2 order-sm-2">

<div class="list-group">

Expand Down

0 comments on commit c78a84d

Please sign in to comment.