This repository has been archived by the owner on May 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added absolute templatetag * added request url to stub edit page * added str_to_list filter for template * headers in column * linted and added test for filter * added change_form_template for every Admin and refactor templates * added change_form_template attribute * changed local host in .sh for dev * str_to_list renamed to headers_to_list * tranclate to copied * corrected start-django.dev * refactored headers_to_list: added json.loads * fixed tests and linted * added test for ivalid headers * corrected test * replaced spike-nail for pretty_body to filedset_log_entry template
- Loading branch information
Showing
8 changed files
with
117 additions
and
39 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
2 changes: 1 addition & 1 deletion
2
templates/admin/http_stubs/change_form.html → ...dmin/http_stubs/httpstub/change_form.html
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{% extends "admin/change_form.html" %} | ||
{% block field_sets %} | ||
{% for fieldset in adminform %} | ||
{% include "admin/http_stubs/includes/fieldset.html" %} | ||
{% include "admin/http_stubs/includes/fieldset_http_stub.html" %} | ||
{% endfor %} | ||
{% endblock %} |
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
40 changes: 40 additions & 0 deletions
40
templates/admin/http_stubs/includes/fieldset_http_stub.html
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,40 @@ | ||
{% extends 'admin/http_stubs/includes/fieldset.html' %} | ||
{% load stub_tags %} | ||
{% block writable_field %} | ||
{{ field.field }} | ||
{# added request url for path field(issue #35) #} | ||
{% if field.field.name == 'path' %} | ||
<div class="readonly"> | ||
<div id="full-path">{% absolute field.field.value %}</div> | ||
<div id="path-copied-alert">Copied!</div> | ||
</div> | ||
{% endif %} | ||
{% endblock %} | ||
{% block javascripts %} | ||
<script type="text/javascript"> | ||
// copy content to clipboard | ||
function copyToClipboard(element) { | ||
var $temp = $("<input>"); | ||
$("body").append($temp); | ||
$temp.val($(element).text()).select(); | ||
document.execCommand("copy"); | ||
$temp.remove(); | ||
} | ||
|
||
// copy full request path to clipboard | ||
$("#full-path").on("click", function() { | ||
copyToClipboard("#full-path"); | ||
$("#path-copied-alert").fadeIn("slow"); | ||
}); | ||
|
||
</script> | ||
{% endblock %} | ||
{% block css %} | ||
<style type="text/css"> | ||
#path-copied-alert { | ||
display: none; | ||
color: green; | ||
padding-left: 170px; | ||
} | ||
</style> | ||
{% endblock %} |
19 changes: 19 additions & 0 deletions
19
templates/admin/http_stubs/includes/fieldset_log_entry.html
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,19 @@ | ||
{% extends 'admin/http_stubs/includes/fieldset.html' %} | ||
{% load stub_tags %} | ||
{% block readonly_field %} | ||
{% if field.field.name == 'headers' %} | ||
<ul class="readonly"> | ||
{% for header in field.contents|headers_to_list %} | ||
<li>{{ header }}</li> | ||
{% endfor %}</ul> | ||
{% elif field.field.name == 'pretty_body' %} | ||
<div class="readonly"> | ||
<pre>{{ field.contents }}</pre> | ||
</div> | ||
{% elif field.field.name == 'body' %} | ||
<div class="readonly"> | ||
<div style="overflow:auto;width:85vw;">{{ field.contents }}</div> | ||
</div> | ||
{% else %} | ||
<div class="readonly">{{ field.contents }}</div>{% endif %} | ||
{% endblock %} |
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,6 @@ | ||
{% extends "admin/change_form.html" %} | ||
{% block field_sets %} | ||
{% for fieldset in adminform %} | ||
{% include "admin/http_stubs/includes/fieldset_log_entry.html" %} | ||
{% endfor %} | ||
{% endblock %} |