mirror of https://github.com/scrapy/scrapy.git
Override admin base template with a custom one that has some JS to resize textaeras, useful when editing an article
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40108
This commit is contained in:
parent
ee8d9a594a
commit
56e110af78
|
|
@ -0,0 +1,39 @@
|
|||
{% extends "admin/base.html" %}
|
||||
|
||||
{% block footer %}
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
function textarea_resize() {
|
||||
//
|
||||
// Resize all textareas
|
||||
//
|
||||
textareas = document.getElementsByTagName("textarea");
|
||||
for (var i = 0; i <= textareas.length-1; i++) {
|
||||
try {
|
||||
textarea = textareas[i];
|
||||
try {
|
||||
rows = textarea.firstChild.data.split("\n").length;
|
||||
if (rows > 30) {
|
||||
rows = 30;
|
||||
}
|
||||
} catch(e) {
|
||||
rows = 30;
|
||||
}
|
||||
textarea.rows = rows;
|
||||
} catch (e) {
|
||||
alert("textarea_resize() error:" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
textarea_resize()
|
||||
/* ]]> */
|
||||
</script>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
font-family: monospace;
|
||||
}
|
||||
.colM .aligned .vLargeTextField, .colM .aligned .vXMLLargeTextField {
|
||||
width:80%;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
Loading…
Reference in New Issue