Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add widget link on viewing a map #314

Merged
merged 3 commits into from
Sep 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion geonode/maps/templates/maps/map_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ <h4>{% trans "Embed this map" %}</h4>
<li>
<a href="javascript:$('#embed-iframe').modal()">Embed Iframe Link</a></li>
<li>
<a href="#">Embed Widget Link</a></li>
<a href="javascript:$('#embed-widget').modal()">Embed Widget Link</a></li>
</ul>
</div>
</li>
Expand Down Expand Up @@ -275,6 +275,40 @@ <h4 class="modal-title" id="myModalLabel">{% trans "Embed Iframe" %}</h4>
</div>
</div>

<div class="modal fade" id="embed-widget" tabindex="-1" role="dialog" aria-labelledby="Embed Widget"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">{% trans "Embed Widget" %}</h4>
</div>
<div class="modal-body">
<p>To embed this map, the first step is to import a library and a js function to the html's head section on your site:</p>
<p style="font-weight: bold; font-size: small;">
<p>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;</p>
<p>&lt;script type="text/javascript"&gt;</p>
<ul style="list-style: none;">
<li>$.get("{{ SITEURL|slice:":-1" }}{% url "map_embed" resource.id %}", function(data) {</li>
<li>&nbsp;&nbsp;&nbsp;if(data) {</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$("#embed-map-link").html(data)</li>
<li>&nbsp;&nbsp;&nbsp;}</li>
<li>});</li>
</ul>
<p>&lt;/script&gt;</p>
</p>

<p>Finally, insert the div tag below into a location suits your need in the html's body</p>
<p style="font-weight: bold;font-size: small;">
&lt;div id="embed-map-link"&gt;&lt;/div&gt;
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div>
</div>
</div>

{% endblock %}

Expand Down