Clean up back end HTML templates.

The check-handlebars-templates script now looks at most of our
back end templates to try and find imbalanced tags.  This commit
fixes a bunch of the existing templates.

(imported from commit fad4a5d85d68160370dd588b41d6f125f64d198f)
This commit is contained in:
Steve Howell 2013-11-18 16:57:55 -05:00
parent 197ddd6edb
commit 1c91d1a5bc
18 changed files with 60 additions and 44 deletions

View File

@ -1,7 +1,7 @@
{{! Alert word in the settings page that can be removed }} {{! Alert word in the settings page that can be removed }}
<li class="alert-word-item" data-word='{{word}}'> <li class="alert-word-item" data-word='{{word}}'>
{{#if editing}} {{#if editing}}
<input class="edit-alert-word input-medium" type="text" placeholder="Alert Word"></input><button class="btn btn-mini add-alert-word" type="button">Add</button> <input class="edit-alert-word input-medium" type="text" placeholder="Alert Word"><button class="btn btn-mini add-alert-word" type="button">Add</button>
{{else}} {{else}}
{{word}}<button class="btn btn-mini remove-alert-word" type="button"><i class="icon-vector-remove"></i></button> {{word}}<button class="btn btn-mini remove-alert-word" type="button"><i class="icon-vector-remove"></i></button>
{{/if}} {{/if}}

View File

@ -5,7 +5,7 @@
{% block portico_content %} {% block portico_content %}
<br/> <br/>
<p class="lead">404: Page not found.<p> <p class="lead">404: Page not found.</p>
<p>We know this is stressful, but we still love you.</p> <p>We know this is stressful, but we still love you.</p>

View File

@ -10,7 +10,7 @@
{% block portico_content %} {% block portico_content %}
<br/> <br/>
<p class="lead">500: Internal server error.<p> <p class="lead">500: Internal server error.</p>
<p>Well oops. This one's probably our fault. Sorry about that!</p> <p>Well oops. This one's probably our fault. Sorry about that!</p>

View File

@ -8,16 +8,16 @@
<p>You're confirmed. We're not exactly sure what we confirmed you for, but whatever it is you're totally good.</p> <p>You're confirmed. We're not exactly sure what we confirmed you for, but whatever it is you're totally good.</p>
{% else %} {% else %}
<p class="lead">Whoops, something's not right. We couldn't find your confirmation ID!<p> <p class="lead">Whoops, something's not right. We couldn't find your confirmation ID!</p>
{% if enterprise % } {% if enterprise % }
<p>Make sure you copied the link correctly in to your browser.<p> <p>Make sure you copied the link correctly in to your browser.</p>
<p>If you're still having problems, please contact your Zulip administrator at <a <p>If you're still having problems, please contact your Zulip administrator at <a
href="mailto:{{ support_email }}">{{ support_email }}</a>.</p> href="mailto:{{ support_email }}">{{ support_email }}</a>.</p>
{% else % } {% else % }
<p>Make sure you copied the link correctly in to your browser. If you're <p>Make sure you copied the link correctly in to your browser. If you're
still encountering this page, its probably our fault. We're sorry.<p> still encountering this page, its probably our fault. We're sorry.</p>
<p>Anyway, shoot us a line at <a <p>Anyway, shoot us a line at <a
href="mailto:{{ support_email }}">{{ support_email }}</a> and we'll get href="mailto:{{ support_email }}">{{ support_email }}</a> and we'll get

View File

@ -54,7 +54,7 @@
<i class="icon-vector-user icon-vector-3x feature-icon"></i> <i class="icon-vector-user icon-vector-3x feature-icon"></i>
<h4>@-notifications</h4> <h4>@-notifications</h4>
<p>Want someone's attention in a conversation? @-notify them <p>Want someone's attention in a conversation? @-notify them
and they'll be right over. and they'll be right over.</p>
</div> </div>
<div class="feature-block"> <div class="feature-block">
<i class="icon-vector-bullhorn icon-vector-3x feature-icon"></i> <i class="icon-vector-bullhorn icon-vector-3x feature-icon"></i>

View File

@ -58,9 +58,7 @@
<p>If you have any questions, please contact us using the "Send feedback" <p>If you have any questions, please contact us using the "Send feedback"
button in Zulip or e-mail us button in Zulip or e-mail us
at <a href="mailto:support@zulip.com">support@zulip.com</a><p> at <a href="mailto:support@zulip.com">support@zulip.com</a></p>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -45,7 +45,7 @@
id="name" name="name" placeholder="Wolfgang A. Mozart" /><span class="punc">,</span> and id="name" name="name" placeholder="Wolfgang A. Mozart" /><span class="punc">,</span> and
you can email me at <input class="input-large" type="email" you can email me at <input class="input-large" type="email"
id="email" name="email" id="email" name="email"
placeholder="w.a.mozart@magicflute.com" /><span class="punc">.</span> placeholder="w.a.mozart@magicflute.com" /><span class="punc">.</span></p>
<p>I work at <input class="input-large" type="text" <p>I work at <input class="input-large" type="text"
@ -54,7 +54,7 @@
about <input class="input-mini" type="text" id="count" about <input class="input-mini" type="text" id="count"
name="count" placeholder="10" /> of us, and today we use name="count" placeholder="10" /> of us, and today we use
<input class="input-medium" type="text" id="product" <input class="input-medium" type="text" id="product"
name="product" placeholder="IRC" /> to chat.</p></span> name="product" placeholder="IRC" /> to chat.</span></p>
<div class="signup-signature"> <div class="signup-signature">
<p>I'm looking forward to it!</p> <p>I'm looking forward to it!</p>

View File

@ -71,7 +71,4 @@ mirror script instead of using Webathena.</p>
doing so will result in messages you sent being forwarded to doing so will result in messages you sent being forwarded to
Zephyr twice.</p> Zephyr twice.</p>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -17,7 +17,7 @@
<h3>You're done!</h3> <h3>You're done!</h3>
<p>If you have any questions, please contact us using the "Send feedback" button in Zulip or e-mail us at <p>If you have any questions, please contact us using the "Send feedback" button in Zulip or e-mail us at
<a href="mailto:support@zulip.com">support@zulip.com</a><p> <a href="mailto:support@zulip.com">support@zulip.com</a></p>
<h3>If you want to automatically transfer your existing Zephyr subscriptions</h3> <h3>If you want to automatically transfer your existing Zephyr subscriptions</h3>
@ -36,7 +36,7 @@
home view that you less commonly read. You can still easily access those streams home view that you less commonly read. You can still easily access those streams
from Zulip when you want to read them. You can control your subscriptions from Zulip when you want to read them. You can control your subscriptions
and what's in your home view by clicking the gear in the upper right-hand corner and what's in your home view by clicking the gear in the upper right-hand corner
and then selecting "Streams".</p> and then selecting "Streams".</p></li>
</ol> </ol>
<h3>If you subscribe to any encrypted Zephyr classes</h3> <h3>If you subscribe to any encrypted Zephyr classes</h3>
@ -48,7 +48,4 @@
</ol> </ol>
</p> </p>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -5,7 +5,7 @@
{% block portico_content %} {% block portico_content %}
<br/> <br/>
<p class="lead">We couldn't validate your Google account<p> <p class="lead">We couldn't validate your Google account</p>
<p>You might want to <a href="{% url 'django_openid_auth.views.login_begin' %}">try logging in via Google again</a> <p>You might want to <a href="{% url 'django_openid_auth.views.login_begin' %}">try logging in via Google again</a>
or <a href="{% url 'django.contrib.auth.views.login' %}">log in with a username or password.</a></p> or <a href="{% url 'django.contrib.auth.views.login' %}">log in with a username or password.</a></p>

View File

@ -20,7 +20,7 @@ Allow the user to accept the terms, creating an email record of that fact.
<div class="control-group"> <div class="control-group">
<label for="id_email" class="control-label">Email</label> <label for="id_email" class="control-label">Email</label>
<div class="controls fakecontrol"> <div class="controls fakecontrol">
<p>{{ email }}<p> <p>{{ email }}</p>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">

View File

@ -6,7 +6,7 @@
<div class="app portico-page"> <div class="app portico-page">
<div class="app-main portico-page-container"> <div class="app-main portico-page-container">
<h2>Thanks for signing up!</h2> <h2>Thanks for signing up!</h2>
<p class="lead">Check your email so we can get started.<p> <p class="lead">Check your email so we can get started.</p>
<p>Still no email? We can <a href="#" id="resend_email_link">resend it</a>.<br/> <p>Still no email? We can <a href="#" id="resend_email_link">resend it</a>.<br/>
<small>(Just in case, take a look at your Spam folder.)</small></p> <small>(Just in case, take a look at your Spam folder.)</small></p>

View File

@ -53,7 +53,7 @@
<p><em>Note: The latest versions of the Mac app require Mac OS <p><em>Note: The latest versions of the Mac app require Mac OS
X 10.7+. If you are running OS X 10.6 (Snow Leopard), please X 10.7+. If you are running OS X 10.6 (Snow Leopard), please
download <a href="https://zulip.com/dist/apps/mac/Zulip-0.3.8%20NoUpdate.dmg">this version</a> instead.</p></em> download <a href="https://zulip.com/dist/apps/mac/Zulip-0.3.8%20NoUpdate.dmg">this version</a> instead.</em></p>
<p style="text-align: center"> <p style="text-align: center">
{% if not_enterprise %} {% if not_enterprise %}
@ -89,10 +89,11 @@ sudo apt-get install zulip-desktop-sso
<h3>Other</h3> <h3>Other</h3>
{% if not_enterprise %} {% if not_enterprise %}
<p>We provide a <a href="https://zulip.com/dist/apps/linux/zulip-desktop_latest.bin.tar.gz">binary tarball</a> of the Zulip application, built for 64-bit systems. <p>We provide a <a href="https://zulip.com/dist/apps/linux/zulip-desktop_latest.bin.tar.gz">binary tarball</a> of the Zulip application, built for 64-bit systems.
</p>
{% else %} {% else %}
<p>We provide a <a href="https://zulip.com/dist/apps/sso/linux/zulip-desktop_latest.bin.tar.gz">binary tarball</a> of the Zulip application, built for 64-bit systems. <p>We provide a <a href="https://zulip.com/dist/apps/sso/linux/zulip-desktop_latest.bin.tar.gz">binary tarball</a> of the Zulip application, built for 64-bit systems.
</p>
{% endif %} {% endif %}
</p>
</div> </div>
<div class="tab-pane" id="windows"> <div class="tab-pane" id="windows">

View File

@ -185,7 +185,7 @@
<p>You will need your Basecamp account ID. You can find it as a sequence of numbers in the URL when you log in:</p> <p>You will need your Basecamp account ID. You can find it as a sequence of numbers in the URL when you log in:</p>
<img class="screenshot" src="/static/images/integrations/basecamp/001.png"> <img class="screenshot" src="/static/images/integrations/basecamp/001.png">
<p>Edit the Basecamp and Zulip credentials in <code>integrations/basecamp/zulip_basecamp_config.py</code> using <p>Edit the Basecamp and Zulip credentials in <code>integrations/basecamp/zulip_basecamp_config.py</code> using
your favorite editor: your favorite editor:</p>
<div class="codehilite"> <div class="codehilite">
@ -210,7 +210,7 @@
<p><b>Congratulations! You're done!</b><br /> Whenever you create a new project, <p><b>Congratulations! You're done!</b><br /> Whenever you create a new project,
calendar event, comment, message, or more, you'll get a notification in your selected stream calendar event, comment, message, or more, you'll get a notification in your selected stream
with the project or calendar as the topic. with the project or calendar as the topic.</p>
<img class="screenshot" src="/static/images/integrations/basecamp/002.png"> <img class="screenshot" src="/static/images/integrations/basecamp/002.png">
</div> </div>
@ -792,9 +792,10 @@ following, to the stream <code>commits</code> with a subject that matches the re
<ul> <ul>
<li>Did you set up a post-build action for your project?</li> <li>Did you set up a post-build action for your project?</li>
<li>Does the stream you picked (e.g. <code>jenkins</code>) already exist? If not, add yourself to it and try again.</li> <li>Does the stream you picked (e.g. <code>jenkins</code>) already exist? If not, add yourself to it and try again.</li>
<li>Are your access key and email address correct? Test them using <a href="/api">our curl API</a>. <li>Are your access key and email address correct? Test them using <a href="/api">our curl API</a>.</li>
<li>Still stuck? Email <a href="mailto:support@zulip.com?subject=Jenkins">support@zulip.com</a>.</li> <li>Still stuck? Email <a href="mailto:support@zulip.com?subject=Jenkins">support@zulip.com</a>.</li>
</ul> </ul>
</p>
</div> </div>
<div id="jira" class="integration-instructions"> <div id="jira" class="integration-instructions">
@ -872,6 +873,7 @@ following, to the stream <code>commits</code> with a subject that matches the re
<p>In the Administrators page, navigate to <code>Plugins > Other > Script Listeners</code>. In the <code>Add Listener</code> section, click on <p>In the Administrators page, navigate to <code>Plugins > Other > Script Listeners</code>. In the <code>Add Listener</code> section, click on
the <code>Custom Listener</code> option. Select the events you wish the Zulip integration to fire for, and the projects you wish Zulip to be notified for. the <code>Custom Listener</code> option. Select the events you wish the Zulip integration to fire for, and the projects you wish Zulip to be notified for.
In the <code>Name of groovy class</code> field, enter <code>org.zulip.jira.ZulipListener</code>. In the <code>Name of groovy class</code> field, enter <code>org.zulip.jira.ZulipListener</code>.
</p>
<p>Click <code>Add Listener</code>, and JIRA will now notify your Zulip of changes to your issues!</p> <p>Click <code>Add Listener</code>, and JIRA will now notify your Zulip of changes to your issues!</p>
@ -911,6 +913,7 @@ key=NAGIOS_BOT_API_KEY
GROUPS</code> section GROUPS</code> section
of <code>/etc/nagios3/conf.d/contacts.cfg</code>, doing of <code>/etc/nagios3/conf.d/contacts.cfg</code>, doing
something like: something like:
</p>
<div class="codehilite"><pre>define contactgroup{ <div class="codehilite"><pre>define contactgroup{
contactgroup_name admins contactgroup_name admins
@ -958,6 +961,7 @@ key=NAGIOS_BOT_API_KEY
https://github.com/zulip/phabricator-to-zulip https://github.com/zulip/phabricator-to-zulip
</a> </a>
to get it set up. to get it set up.
</p>
</div> </div>

View File

@ -74,7 +74,7 @@ autofocus('#id_username');
<div class="control-group"> <div class="control-group">
<label for="id_password" class="control-label">Password</label> <label for="id_password" class="control-label">Password</label>
<div class="controls"> <div class="controls">
<input id="id_password" name="password" class="required" type="password"> <input id="id_password" name="password" class="required" type="password" />
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@ -166,7 +166,7 @@ opt-in consent for the sharing of any sensitive personal information.</p>
</li> </li>
<li> <li>
<p><strong>With domain administrators</strong> <p><strong>With domain administrators</strong></p>
<p>If your Zulip Account is managed for you by a domain administrator then <p>If your Zulip Account is managed for you by a domain administrator then
your domain administrator and resellers who provide user support to your your domain administrator and resellers who provide user support to your

View File

@ -33,7 +33,7 @@ Form is validated both client-side using jquery-validate (see signup.js) and ser
<label for="id_email" class="control-label">Email</label> <label for="id_email" class="control-label">Email</label>
<div class="controls fakecontrol"> <div class="controls fakecontrol">
<input type='hidden' name='key' value='{{ key }}' /> <input type='hidden' name='key' value='{{ key }}' />
<p>{{ email }}<p> <p>{{ email }}</p>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">

View File

@ -6,13 +6,19 @@ import subprocess
class Record: class Record:
pass pass
def validate(fn): def validate(fn, check_indent=True):
text = open(fn).read() text = open(fn).read()
state = Record() state = Record()
def NoStartTag(end_tag): def NoStartTag(end_tag):
raise Exception('No start tag for %s' % end_tag) raise Exception('''
No start tag
fn: %s
end tag:
%s
line %d, col %d
''' % (fn, end_tag, state.line, state.col))
def start_tag_matcher(s): def start_tag_matcher(s):
start_line = state.line start_line = state.line
@ -25,7 +31,7 @@ def validate(fn):
problem = None problem = None
if start_tag != end_tag[2:-1]: if start_tag != end_tag[2:-1]:
problem = 'Mismatched tag.' problem = 'Mismatched tag.'
elif state.line > start_line + 1 and state.col != start_col: elif check_indent and state.line > start_line + 1 and state.col != start_col:
problem = 'Bad indentation.' problem = 'Bad indentation.'
if problem: if problem:
raise Exception(''' raise Exception('''
@ -40,7 +46,7 @@ def validate(fn):
''' % (fn, problem, s, start_line, start_col, end_tag, state.line, state.col)) ''' % (fn, problem, s, start_line, start_col, end_tag, state.line, state.col))
state.matcher = old_matcher state.matcher = old_matcher
state.depth -= 1 state.depth -= 1
return f state.matcher = f
state.depth = 0 state.depth = 0
state.i = 0 state.i = 0
@ -71,24 +77,37 @@ def validate(fn):
if s.startswith('</'): if s.startswith('</'):
state.matcher(s) state.matcher(s)
else: else:
if not s.endswith('/>'): tag = s[1:-1].split()[0]
state.matcher = start_tag_matcher(s) ignore = s.startswith('<!--') or s.endswith('/>') or tag in ['img', 'meta', 'br', 'input']
if not ignore:
start_tag_matcher(s)
advance(len(s)) advance(len(s))
continue continue
advance(1) advance(1)
assert state.depth == 0 if state.depth != 0:
return state.matcher("(NO TAG)")
git_files = map(str.strip, subprocess.check_output(['git', 'ls-files']).split('\n')) git_files = map(str.strip, subprocess.check_output(['git', 'ls-files']).split('\n'))
# Check all our handlebars templates. # Check all our handlebars templates.
templates = [fn for fn in git_files if fn.endswith('.handlebars')] templates = [fn for fn in git_files if fn.endswith('.handlebars')]
assert len(templates) >= 10 # sanity check that we are actually doing work assert len(templates) >= 10 # sanity check that we are actually doing work
# Django templates are pretty messy now, so we whitelist them for now.
templates += [
'templates/zerver/settings.html'
]
for fn in templates: for fn in templates:
validate(fn) validate(fn)
# Django templates are pretty messy now, so we do minimal checking.
templates = sorted([fn for fn in git_files if fn.endswith('.html') and 'templates' in fn])
def ok(fn):
if 'api.html' in fn: return False
if 'base.html' in fn: return False
if 'emails/' in fn: return False
return True
templates = filter(ok, templates)
assert len(templates) >= 10 # sanity check that we are actually doing work
for fn in templates:
validate(fn, check_indent=False)