Unverified Commit 80209b83 authored by David Haynes's avatar David Haynes
Browse files

/edit/[short] now has a template and is rendered

- simple page, no form implementation yet
parent 219c3d15
Pipeline #1171 passed with stage
in 1 minute and 25 seconds
<!-- include the base html template -->
{% extends 'layouts/base.html' %}
<!-- Tell Django to load static files -->
{% load staticfiles %}
<!-- load django crispy forms' tags -->
{% load crispy_forms_tags %}
<!-- define the page title block -->
{% block title %}
SRCT Go &bull; Edit Link
{% endblock %}
<!-- define the content block for the page -->
{% block content %}
<!-- define the page header div -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-wrench fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">Edit Link</i>
</strong></h1>
</div>
</div>
</div>
<!-- load some JS to hide/show the custom date field -->
<script src="{% static "js/new_link.js" %}"></script>
{% endblock %}
<!-- include the base html template --> <!-- include the base html template -->
{% extends 'layouts/base.html' %} {% extends 'layouts/base.html' %}
<!-- Tell Django to load static files -->
{% load staticfiles %}
<!-- load django crispy forms' tags --> <!-- load django crispy forms' tags -->
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
<!-- define the page title block --> <!-- define the page title block -->
{% block title %} {% block title %}
SRCT Go &bull; A University Branded URL Shortener SRCT Go &bull; New Link
{% endblock %} {% endblock %}
<!-- define the content block for the page --> <!-- define the content block for the page -->
...@@ -31,32 +34,6 @@ SRCT Go &bull; A University Branded URL Shortener ...@@ -31,32 +34,6 @@ SRCT Go &bull; A University Branded URL Shortener
{% crispy form %} {% crispy form %}
<!-- load some JS to hide/show the custom date field --> <!-- load some JS to hide/show the custom date field -->
<script type="text/javascript"> <script src="{% static "js/new_link.js" %}"></script>
$(function() {
// hide by default
$("div_id_expires_custom").hide();
// if the expires_custom checkbox is checked..
if ($("#id_expires_5").is(":checked")) {
// display the field
$("#div_id_expires_custom").slideDown();
} else {
// keep it up
$("#div_id_expires_custom").slideUp();
}
// if the expires_custom checkbox is clicked..
$("#div_id_expires").click(function() {
// if the expires_custom checkbox is checked..
if ($("#id_expires_5").is(":checked")) {
// display the field
$("#div_id_expires_custom").slideDown();
} else {
// keep it hidden
$("#div_id_expires_custom").slideUp();
}
})
})
</script>
{% endblock %} {% endblock %}
...@@ -58,8 +58,5 @@ ...@@ -58,8 +58,5 @@
<!-- Load in the footer template --> <!-- Load in the footer template -->
{% include 'layouts/footer.html' %} {% include 'layouts/footer.html' %}
<!-- Load in js that relies on page elements -->
<script src="{% static "js/copy.js" %}"></script>
</body> </body>
</html> </html>
...@@ -211,9 +211,14 @@ def edit(request, short): ...@@ -211,9 +211,14 @@ def edit(request, short):
# If the RegisteredUser is the owner of the URL # If the RegisteredUser is the owner of the URL
if url.owner == request.user.registereduser: if url.owner == request.user.registereduser:
# render the edit URL form # render the edit URL form
# TODO
# Render index.html passing the form to the template
return render(request, 'core/edit_link.html', {
})
# redirect to my_links # redirect to my_links
return redirect('my_links') # return redirect('my_links')
else: else:
# do not allow them to edit # do not allow them to edit
raise PermissionDenied() raise PermissionDenied()
......
...@@ -13,7 +13,7 @@ $('#copy-button').on('hidden.bs.tooltip', function () { ...@@ -13,7 +13,7 @@ $('#copy-button').on('hidden.bs.tooltip', function () {
$('#copy-button').attr('data-original-title', 'Copy to Clipboard'); $('#copy-button').attr('data-original-title', 'Copy to Clipboard');
}); });
clipboard.on('success', function(e) { clipboard.on('success', function (e) {
e.clearSelection(); e.clearSelection();
$('#copy-button').attr('data-original-title', 'Copied!').tooltip('show'); $('#copy-button').attr('data-original-title', 'Copied!').tooltip('show');
}); });
......
// hide by default
$("div_id_expires_custom").hide();
// if the expires_custom checkbox is checked..
if ($("#id_expires_5").is(":checked")) {
// display the field
$("#div_id_expires_custom").slideDown();
} else {
// keep it up
$("#div_id_expires_custom").slideUp();
}
// if the expires_custom checkbox is clicked..
$("#div_id_expires").click(function () {
// if the expires_custom checkbox is checked..
if ($("#id_expires_5").is(":checked")) {
// display the field
$("#div_id_expires_custom").slideDown();
} else {
// keep it hidden
$("#div_id_expires_custom").slideUp();
}
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment