From: Matt Arnold <matt@thegnuguru.org>
---
mastertext/webfrontend/routes.py | 7 ++++++-
mastertext/webfrontend/templates/document.html | 4 ++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/mastertext/webfrontend/routes.py b/mastertext/webfrontend/routes.py
index e1fefe5..31e45e5 100644
--- a/mastertext/webfrontend/routes.py
+++ b/mastertext/webfrontend/routes.py
@@ -84,6 +84,8 @@ def timeline():
@login_required
def create_blob():
form = forms.CreateForm()
+ clone = request.args.get('clone', None)
+ title = "Create a Blob"
if form.validate_on_submit():
blobinfo = ts.create_object(form.body.data)
if blobinfo['count'] == 1:
@@ -97,7 +99,10 @@ def create_blob():
flash("Coder error Replace Coder")
return redirect('/index')
else:
- return render_template('create.html', title="Create A Blob", form=form)
+ if clone is not None:
+ form.body.data = ts.retrieve_object(clone)
+ title = "Clone " + clone
+ return render_template('create.html', title=title, form=form)
@app.route('/login', methods=['GET', 'POST'])
diff --git a/mastertext/webfrontend/templates/document.html b/mastertext/webfrontend/templates/document.html
index 1c45846..014e8aa 100644
--- a/mastertext/webfrontend/templates/document.html
+++ b/mastertext/webfrontend/templates/document.html
@@ -1,5 +1,9 @@
{% extends "base.html" %}
{% block content %}
+<hr>
+<a href="{{url_for('create_blob', clone=docdata.hash)}}"> 🪴
+ Clone
+</a>
<h1> Document {{ docdata.hash }} </h1>
<div class="cm">
--
2.30.2