-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add user interface for URL and email redirects (#3523)
* Add user interface for URL and email redirects * Move help text to fix failing test * Fix less than/greater than * Fix lint error * Fix test?
- Loading branch information
1 parent
f56ddc2
commit 816d26d
Showing
6 changed files
with
274 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
{% extends "main.html" %} | ||
|
||
{% block title %} | ||
URL and Email Redirect Management | ||
{% endblock %} | ||
|
||
{% block stylesheets %} | ||
{{ block.super }} | ||
<link rel="stylesheet" href="/media/styles/forms.css" type="text/css" /> | ||
<link rel="stylesheet" href="/media/styles/expand_display.css" type="text/css" /> | ||
{% endblock %} | ||
|
||
{% block xtrajs %} | ||
<script type="text/javascript"> | ||
function deleteRedirect() { | ||
if (confirm('Are you sure you would like to delete this redirect?')) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
function deleteEmailRedirect() { | ||
if (confirm('Are you sure you would like to delete this email redirect?')) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
</script> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
|
||
<h1> | ||
URL and Email Redirect Management | ||
</h1> | ||
|
||
<p>Welcome to the redirect management page. Here you can create, edit, and delete <b>URL redirects</b> which redirect users from one URL to another and | ||
<b>email redirects</b> which redirect emails sent to a custom or real email address on your domain to one or more real email addresses on any domain.</p> | ||
|
||
<div id="program_form"> | ||
|
||
{% if open_section == "redirects" %} | ||
<button class="dsphead active"> | ||
<b>URL Redirects</b> (click to expand/contract) | ||
</button> | ||
|
||
<div class="dspcont active"> | ||
{% else %} | ||
<button class="dsphead"> | ||
<b>URL Redirects</b> (click to expand/contract) | ||
</button> | ||
|
||
<div class="dspcont"> | ||
{% endif %} | ||
|
||
<form method="post"> | ||
<input type="hidden" name="command" value="{% if redirect_form.instance.id %}edit{% else %}add{% endif %}" /> | ||
{% if redirect_form.instance.id %} | ||
<input type="hidden" name="id" value="{{ redirect_form.instance.id }}" /> | ||
{% endif %} | ||
<input type="hidden" name="object" value="redirect" /> | ||
<table align="center" cellpadding="0" cellspacing="0" width="100%"> | ||
<tr><th colspan="2" class="small">Add/Edit URL Redirects</th></tr> | ||
{{ redirect_form }} | ||
<tr><td colspan="2" align="center"><input class="fancybutton" type="submit" value="{% if redirect_form.instance.id %}Edit{% else %}Add{% endif %} URL Redirect" /></td></tr> | ||
</table> | ||
</form> | ||
|
||
<br /> | ||
|
||
<table align="center" cellpadding="0" cellspacing="0" width="100%"> | ||
<tr><th colspan="4">URL Redirects</th></tr> | ||
<tr> | ||
<td><b>Old URL</b></td> | ||
<td></td> | ||
<td><b>New URL</b></td> | ||
<td><b>Options</b></td> | ||
</tr> | ||
{% for redirect in redirects %} | ||
<tr> | ||
<td>{{ redirect.old_path }}</td> | ||
<td>⟶</td> | ||
<td>{{ redirect.new_path }}</td> | ||
<td> | ||
<center> | ||
<a href="{{ redirect.old_path }}" target="_blank" class="btn btn-primary" />Test</a> | ||
<form method="post"> | ||
<input type="hidden" name="id" value="{{ redirect.id }}" /> | ||
<input type="hidden" name="command" value="load" /> | ||
<input type="hidden" name="object" value="redirect" /> | ||
<input type="submit" value="Edit" class="btn btn-primary" /> | ||
</form> | ||
<form method="post" onsubmit="return deleteRedirect()"> | ||
<input type="hidden" name="id" value="{{ redirect.id }}" /> | ||
<input type="hidden" name="command" value="delete" /> | ||
<input type="hidden" name="object" value="redirect" /> | ||
<input type="submit" value="Delete" class="btn btn-danger" /> | ||
</form> | ||
</center> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
</div> | ||
|
||
{% if open_section == "email_redirects" %} | ||
<button class="dsphead active"> | ||
<b>Email Redirects</b> (click to expand/contract) | ||
</button> | ||
|
||
<div class="dspcont active"> | ||
{% else %} | ||
<button class="dsphead"> | ||
<b>Email Redirects</b> (click to expand/contract) | ||
</button> | ||
|
||
<div class="dspcont"> | ||
{% endif %} | ||
|
||
<form method="post"> | ||
<input type="hidden" name="command" value="{% if email_redirect_form.instance.id %}edit{% else %}add{% endif %}" /> | ||
{% if email_redirect_form.instance.id %} | ||
<input type="hidden" name="id" value="{{ email_redirect_form.instance.id }}" /> | ||
{% endif %} | ||
<input type="hidden" name="object" value="email_redirect" /> | ||
<table align="center" cellpadding="0" cellspacing="0" width="100%"> | ||
<tr><th colspan="2" class="small">Add/Edit Email Redirects</th></tr> | ||
{{ email_redirect_form }} | ||
<tr><td colspan="2" align="center"><input class="fancybutton" type="submit" value="{% if email_redirect_form.instance.id %}Edit{% else %}Add{% endif %} Email Redirect" /></td></tr> | ||
</table> | ||
</form> | ||
|
||
<br /> | ||
|
||
<table align="center" cellpadding="0" cellspacing="0" width="100%"> | ||
<tr><th colspan="6">Email Redirects</th></tr> | ||
<tr> | ||
<td><b>Original Email Address</b></td> | ||
<td></td> | ||
<td><b>Destination Email Address(es)</b></td> | ||
<td><b>Options</b></td> | ||
</tr> | ||
{% for er in email_redirects %} | ||
<tr> | ||
<td>{{ er.original }}</td> | ||
<td>⟶</td> | ||
<td>{{ er.destination }}</td> | ||
<td> | ||
<center> | ||
<form method="post"> | ||
<input type="hidden" name="id" value="{{ er.id }}" /> | ||
<input type="hidden" name="command" value="load" /> | ||
<input type="hidden" name="object" value="email_redirect" /> | ||
<input type="submit" value="Edit" class="btn btn-primary" /> | ||
</form> | ||
<form method="post" onsubmit="return deleteEmailRedirect()"> | ||
<input type="hidden" name="id" value="{{ er.id }}" /> | ||
<input type="hidden" name="command" value="delete" /> | ||
<input type="hidden" name="object" value="email_redirect" /> | ||
<input type="submit" value="Delete" class="btn btn-danger" /> | ||
</form> | ||
</center> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
</div> | ||
|
||
</div> | ||
|
||
<script type="text/javascript" src="/media/scripts/expand_display.js"></script> | ||
|
||
{% endblock %} |