Skip to content

Commit

Permalink
#12 #19 help resource with arg
Browse files Browse the repository at this point in the history
  • Loading branch information
yn-coder committed Jul 26, 2018
1 parent b5230fb commit 0bad2bc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ def post_new_q():

return resp

@app.route('/help/resource/<path:res_name>', methods=['GET'])
@app.route('/help/resource/<path:res_name>', methods=['GET']) # arg from url will redirects to template
def help_resource(res_name):
try:
resp = make_response( render_template( '/resource/' + res_name.lower() + '.html' ) )
resp = make_response( render_template( '/resource/' + res_name.lower() + '.html', args=request.args.to_dict() ) )
except:
resp = make_response("<pre>No special resource is exists!</pre>")
# CORS
Expand Down
2 changes: 1 addition & 1 deletion templates/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h2>On-line help for Azure Notebooks</h2>

<ul>
<li><a href="/help/resource/intro">Intro</a></li>
<li><a href="/help/resource/first.ipynb">First.ipynb</a></li>
<li><a href="/help/resource/first.ipynb">First.ipynb</a> (and <a href="/help/resource/first.ipynb?cell_code=first_step">First.ipynb</a> with arguments)</li>
<li>More:
<ul>
<li><a href="/help/resource/more/special">special</a></li>
Expand Down
6 changes: 5 additions & 1 deletion templates/resource/first.ipynb.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<h1>First.ipynb book</h1>

{% if args.cell_code %}
<p>{{args.cell_code}}</p>
{% endif %}

<pre>Here is a video</pre>

<iframe src="https://zoom.us/recording/share/nrNcLul22vgcponajTRL3O_kZoyipLhbFOG6valiS1-wIumekTziMw?startTime=1529610118000" width="512" height="288" frameborder="0" ></iframe>
<iframe src="https://zoom.us/recording/share/nrNcLul22vgcponajTRL3O_kZoyipLhbFOG6valiS1-wIumekTziMw?startTime=1529610118000" width="512" height="288" frameborder="0" ></iframe>

0 comments on commit 0bad2bc

Please sign in to comment.