Skip to content
This repository has been archived by the owner on Nov 16, 2017. It is now read-only.

Commit

Permalink
Fixed overall whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
bartTC committed Aug 8, 2009
1 parent 78d6914 commit 9dfdbf9
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 92 deletions.
1 change: 1 addition & 0 deletions AUTHORS
@@ -1,2 +1,3 @@
Martin Mahner <http://www.mahner.org/>
Filip Noetzel <http://filip.noetzel.co.uk/>
rlaager
10 changes: 5 additions & 5 deletions setup.py
@@ -1,23 +1,23 @@
import os
from distutils.core import setup
from distutils.command.install import INSTALL_SCHEMES

app_name = 'templatesadmin'
version = __import__(app_name).__version__

# Tell distutils to put the data_files in platform-specific installation
# locations. See here for an explanation:
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
for scheme in INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']

# Compile the list of packages available, because distutils doesn't have
# an easy way to do this.
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)

for dirpath, dirnames, filenames in os.walk(app_name):
# Ignore dirnames that start with '.'
for i, dirname in enumerate(dirnames):
Expand All @@ -31,7 +31,7 @@
prefix = dirpath[len(app_name)+1:] # Strip "app_name/" or "app_name\"
for f in filenames:
data_files.append(os.path.join(prefix, f))

setup(name='django-'+app_name,
version=version,
description='A Django app to make minor changes to your templates on the fly.',
Expand Down
1 change: 0 additions & 1 deletion templatesadmin/edithooks/__init__.py
Expand Up @@ -16,4 +16,3 @@ def post_save(cls, request, form, template_path):
@classmethod
def contribute_to_form(cls, form, template_path):
return form

6 changes: 3 additions & 3 deletions templatesadmin/edithooks/hgcommit.py
Expand Up @@ -22,7 +22,7 @@ def post_save(cls, request, form, template_path):
author = request.user.username

message = form.cleaned_data['commitmessage'] or '--'

path = None
for template_dir in settings.TEMPLATE_DIRS:
if dir.startswith(template_dir):
Expand All @@ -37,9 +37,9 @@ def post_save(cls, request, form, template_path):
commit_file = commit_file[1:]
uio = ui.ui(interactive=False, report_untrusted=False, quiet=True)
repo = hg.repository(uio, path=path)

repo.commit([str(commit_file)], text=message, user="%s <%s>" % (author, request.user.email))

return "Template '%s' was committed succesfully into mercurial repository." % commit_file

@classmethod
Expand Down
53 changes: 23 additions & 30 deletions templatesadmin/templates/templatesadmin/base.html
@@ -1,23 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">$
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="{{ADMIN_MEDIA_PREFIX}}css/forms.css" type="text/css"/>
<link rel="stylesheet" href="{{ADMIN_MEDIA_PREFIX}}css/changelists.css" type="text/css"/>
<style type="text/css" media="screen">
{% block extrastyle %}{% endblock %}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="{{ADMIN_MEDIA_PREFIX}}css/forms.css" type="text/css"/>
<link rel="stylesheet" href="{{ADMIN_MEDIA_PREFIX}}css/changelists.css" type="text/css"/>$
<style type="text/css" media="screen">
{% block extrastyle %}{% endblock %}$
</style>
<script>
/* <![CDATA[ */
(function() {
var saved = window.onload;
var hash = window.location.hash;

var hash = window.location.hash;$
window.onload = function() {
saved && saved();

saved && saved();$
var elements = document.getElementsByTagName("a");
for(var i = 0; i< elements.length; i++) {
if("#" + elements[i].getAttribute("name") == hash) {
Expand All @@ -28,34 +25,30 @@
})();
/* ]]> */
</script>
<title>Templates Admin</title>
<title>Templates Admin</title>
</head>
<body>
<div id="container">
<div id="header">
<div id="branding">
<h1 id="site-name"><a href="">Templates Admin</a> </h1>
</div>
</div>

<div class="breadcrumbs">{% block breadcumbs %}{% endblock %}</div>

{% if messages %}
<ul class="messagelist">{% for message in messages %}<li>{{ message|escape }}</li>{% endfor %}</ul>
{% endif %}

</div>$
<div class="breadcrumbs">{% block breadcumbs %}{% endblock %}</div>$
{% if messages %}
<ul class="messagelist">{% for message in messages %}<li>{{ message|escape }}</li>{% endfor %}</ul>
{% endif %}$
<div id="content" class="flex">
{% block main %}{% endblock %}
</div>

</div>$
<div id="footer" class="breadcumbs">
<hr/>
<p style="margin: 0.5em; 0; font-size: 0.9em;">
<a href="http://code.google.com/p/django-templatesadmin/">
Django Templatesadmin
</a> on Google Code
</p>
<hr/>
<p style="margin: 0.5em; 0; font-size: 0.9em;">
<a href="http://code.google.com/p/django-templatesadmin/">
Django Templatesadmin
</a> on Google Code
</p>
</div>
</div>
</body>
</html>
</html>$
72 changes: 34 additions & 38 deletions templatesadmin/templates/templatesadmin/edit.html
@@ -1,42 +1,38 @@
{% extends "templatesadmin/base.html" %}
{% load i18n %}

{% load i18n %}$
{% block breadcumbs %}
<a href="{% url templatesadmin-overview %}">{% trans "Home" %}</a> &rsaquo;
<a href="{% url templatesadmin-overview %}">{% trans "File selection" %}</a> &rsaquo;
{{ short_path }}
{% endblock %}

<a href="{% url templatesadmin-overview %}">{% trans "Home" %}</a> &rsaquo;$
<a href="{% url templatesadmin-overview %}">{% trans "File selection" %}</a> &rsaquo;$
{{ short_path }}
{% endblock %}$
{% block main %}
<h2>{{ template_path }}</h2>
<form enctype="multipart/form-data" action="" method="post" id="site_form">
{{ form.errors }}
{{ form.content }}

<div class="submit-row">
{% if template_writeable %}
{% for field in form %}
{% ifnotequal field.label "Content" %}
<p class="float-left">
{{ field.label }} {{ field }}
</p>
{% if forloop.last %} <input type="submit" value="{% trans "Save" %}" class="default" /> {% endif %}
<br clear="both"/>
{% endifnotequal %}
{% endfor %}
{% else %}
{% trans "This template is not writeable." %}
<br clear="both"/>
{% endif %}
</div>
</form>
{% endblock %}

<h2>{{ template_path }}</h2>
<form enctype="multipart/form-data" action="" method="post" id="site_form">
{{ form.errors }}$
{{ form.content }}$
<div class="submit-row">
{% if template_writeable %}
{% for field in form %}
{% ifnotequal field.label "Content" %}
<p class="float-left">
{{ field.label }} {{ field }}
</p>
{% if forloop.last %} <input type="submit" value="{% trans "Save" %}" class="default" /> {% endif %}
<br clear="both"/>
{% endifnotequal %}
{% endfor %}
{% else %}
{% trans "This template is not writeable." %}
<br clear="both"/>
{% endif %}
</div>
</form>
{% endblock %}$
{% block extrastyle %}
textarea#id_content{
width: 99%;
height: 400px;
margin: 1em 0;
font-family: monospace;
}
{% endblock %}
textarea#id_content{
width: 99%;
height: 400px;
margin: 1em 0;
font-family: monospace;
}
{% endblock %}$
26 changes: 14 additions & 12 deletions templatesadmin/templates/templatesadmin/overview.html
@@ -1,36 +1,38 @@
{% extends "templatesadmin/base.html" %}

{% load i18n %}
{% load templatesadmin_tags %}
{% load templatesadmin_tags %}$

{% block breadcumbs %}<a href="{% url templatesadmin-overview %}">{% trans "Home" %}</a> &rsaquo; {% trans "File selection" %}{% endblock %}

{% block main %}
{% for template in template_dict %}
{% ifchanged template.rootpath %}
{% if not forloop.first %}
{% for template in template_dict %}
{% ifchanged template.rootpath %}
{% if not forloop.first %}
</tbody>
</table>
</div>
{% endif %}
{% endif %}
<div class="module">
<a name="{{ template.rootpath }}"></a>
<h2>{{ template.rootpath }}</h2>
<h2>{{ template.rootpath }}</h2>$
<table cellspacing="0" style="width: 100%;">
<thead>
<tr>
<th>{% trans "File" %}</th>
<th class="r">{% trans "Modified" %}</th>
<th class="r">{% trans "Modified" %}</th>$
</tr>
</thead>
<tbody>
{% endifchanged %}
{% endifchanged %}
<tr class="{% cycle row1,row2 %}">
<td style="width: 99%;">
{% if not template.writeable %}{% trans "(read only)" %} {% endif %}
<a href="{% url templatesadmin-edit template.abspath %}">{{ template.abspath|shortenfilepath }}</a></td>
{% if not template.writeable %}{% trans "(read only)" %} {% endif %}
<a href="{% url templatesadmin-edit template.abspath %}">{{ template.abspath|shortenfilepath }}</a></td>
<td style="white-space: nowrap;" class="r">{{ template.modified|date:_("DATETIME_FORMAT") }}</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}
{% endblock %}$
2 changes: 1 addition & 1 deletion templatesadmin/templatetags/templatesadmin_tags.py
Expand Up @@ -6,4 +6,4 @@
@register.filter
def shortenfilepath(path, num_dirs=2, pathsep='/'):
splitted = path.split(path)[1]
return pathsep.join(path.split(pathsep)[-num_dirs:])
return pathsep.join(path.split(pathsep)[-num_dirs:])
4 changes: 2 additions & 2 deletions templatesadmin/views.py
Expand Up @@ -160,8 +160,8 @@ def modify(request,
file_content = f.read()
f.close()

# browser tend to strip newlines from <textarea/>s before
# HTTP-POSTing: re-insert them if neccessary
# browser tend to strip newlines from <textarea/>s before
# HTTP-POSTing: re-insert them if neccessary

# content is in dos-style lineending, will be converted in next step
if (file_content[-1] == '\n' or file_content[:-2] == '\r\n') \
Expand Down

0 comments on commit 9dfdbf9

Please sign in to comment.