Skip to content

Commit 985c275

Browse files
author
Olena Harkusha
committed
Minor changes to the first example
1 parent d3b1623 commit 985c275

3 files changed

Lines changed: 37 additions & 24 deletions

File tree

app/click/examples/eg001_create_clickwrap/controller.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ def worker(args):
7777
clickwrap_request=clickwrap_request,
7878
account_id=args["account_id"]
7979
)
80+
8081
return response

app/click/examples/eg001_create_clickwrap/views.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
import json
55

66
from docusign_click.client.api_exception import ApiException
7-
from flask import render_template, current_app, Blueprint
7+
from flask import render_template, current_app, Blueprint, session
88

99
from .controller import Eg001Controller
1010
from app.docusign import authenticate
11+
from app.ds_config import DS_CONFIG
1112
from app.error_handlers import process_error
1213

1314
eg = "eg001" # reference (and url) for this example
@@ -29,19 +30,23 @@ def create_clickwrap():
2930
# 2. Call the worker method to create a new clickwrap
3031
results = Eg001Controller.worker(args)
3132
clickwrap_id = results.clickwrap_id
33+
clickwrap_name = args['clickwrap_name']
3234
current_app.logger.info(
33-
f"""The clickwrap "{args['clickwrap_name']}" has been created! clickwrap ID: {clickwrap_id}"""
35+
f"""The clickwrap "{clickwrap_name}" has been created!"""
3436
)
3537
except ApiException as err:
3638
return process_error(err)
3739

40+
# Save for use by other examples which need an clickwrapId and clickwrapName
41+
session["clickwrap_id"] = clickwrap_id
42+
session["clickwrap_name"] = clickwrap_name
43+
3844
# 3. Render the response
3945
return render_template(
4046
"example_done.html",
4147
title="Creating a new clickwrap",
4248
h1="Creating a new clickwrap",
43-
message=f"""The clickwrap "{args['clickwrap_name']}" has been created!<br/>
44-
Clickwrap ID: {clickwrap_id}.""",
49+
message=f"""The clickwrap "{args['clickwrap_name']}" has been created!""",
4550
json=json.dumps(json.dumps(results.to_dict(), default=str))
4651
)
4752

@@ -54,4 +59,6 @@ def get_view():
5459
"eg001_create_clickwrap.html",
5560
title="Creating a new clickwrap",
5661
source_file=path.basename(path.dirname(__file__)) + "/controller.py",
62+
source_url=DS_CONFIG["github_example_url"] + path.basename(
63+
path.dirname(__file__)) + "/controller.py",
5764
)
Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
<!-- extend base layout --> {% extends "base.html" %} {% block content %}
22
<h4>1. Creating a clickwrap</h4>
3-
<p>This example demonstrates how to use DocuSign Click to create a
4-
clickwrap that you can embed in your website or app.</p>
3+
<p>This example demonstrates how to use DocuSign Click to create a
4+
clickwrap that you can embed in your website or app.</p>
55

6-
{% if show_doc %}
7-
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a>
8-
about this example.</p>
9-
{% endif %}
6+
{% if show_doc %}
7+
<p><a target='_blank' href='{{ documentation | safe }}'>Documentation</a>
8+
about this example.</p>
9+
{% endif %}
1010

11-
<p>API method used:
12-
<a target='_blank'
13-
href="https://developers.docusign.com/docs/click-api/reference/accounts/clickwraps/createclickwrap/">ClickWraps::createClickwrap</a>
14-
</p>
11+
<p>API method used:
12+
<a target='_blank'
13+
href="https://developers.docusign.com/docs/click-api/reference/accounts/clickwraps/createclickwrap/">ClickWraps::createClickwrap</a>
14+
</p>
1515

16-
<form class="eg" action="" method="post" data-busy="form">
17-
<div class="form-group">
18-
<label for="clickwrap_name">Clickwrap name</label>
19-
<input type="text" class="form-control" id="clickwrap_name"
20-
name="clickwrap_name" required>
21-
</div>
22-
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
23-
<button type="submit" class="btn btn-docu">Submit</button>
24-
</form>
16+
<p>
17+
View source file <a target="_blank" href="{{ source_url | safe }}">{{
18+
source_file }}</a> on GitHub.
19+
</p>
2520

26-
{% endblock %}
21+
<form class="eg" action="" method="post" data-busy="form">
22+
<div class="form-group">
23+
<label for="clickwrap_name">Clickwrap name</label>
24+
<input type="text" class="form-control" id="clickwrap_name"
25+
name="clickwrap_name" required>
26+
</div>
27+
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
28+
<button type="submit" class="btn btn-docu">Submit</button>
29+
</form>
30+
31+
{% endblock %}

0 commit comments

Comments
 (0)