Start to clean up settings.html.

Check that settings.html has at least balanced tags, and
automate the checking of those tags.

(imported from commit 35e9be269caa211803d64f2b54cb0287e13707b3)
This commit is contained in:
Steve Howell 2013-10-25 14:47:03 -04:00
parent 06d9eb78d4
commit 3494ce6ebc
2 changed files with 27 additions and 9 deletions

View File

@ -4,11 +4,13 @@
<div class="alert" id="settings-status"></div> <div class="alert" id="settings-status"></div>
<div id="settings-change-box"> <div id="settings-change-box">
<form action="/json/settings/change" method="post" <form action="/json/settings/change" method="post"
class="form-horizontal">{% csrf_token %} class="form-horizontal">{% csrf_token %}
<div id="account-settings" class="settings-section"> <div id="account-settings" class="settings-section">
<div class="settings-section-title"><i class="icon-vector-user settings-section-icon"></i>Your Account</div> <div class="settings-section-title"><i class="icon-vector-user settings-section-icon"></i>Your Account</div>
<div class="account-settings-form"> <div class="account-settings-form">
<div class="control-group" id="name_change_container"> <div class="control-group" id="name_change_container">
<label for="full_name" class="control-label">Full name</label> <label for="full_name" class="control-label">Full name</label>
<div class="controls"> <div class="controls">
@ -21,7 +23,7 @@
<label for="change_password_button" class="control-label">Password</label> <label for="change_password_button" class="control-label">Password</label>
<div class="controls"> <div class="controls">
<button class="btn change_password_button" data-dismiss="modal" aria-hidden="true">Change Password</button> <button class="btn change_password_button" data-dismiss="modal" aria-hidden="true">Change Password</button>
</div> </div>
</div> </div>
<div id="pw_change_controls"> <div id="pw_change_controls">
@ -81,7 +83,7 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -143,13 +145,18 @@
<input type="submit" name="change_settings" value="Save changes" class="btn btn-big btn-primary" /> <input type="submit" name="change_settings" value="Save changes" class="btn btn-big btn-primary" />
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</form> </form>
</div> </div>
<div id="bot-settings" class="settings-section"> <div id="bot-settings" class="settings-section">
<div class="settings-section-title"><i class="icon-vector-github settings-section-icon"></i>Your Bots</div> <div class="settings-section-title"><i class="icon-vector-github settings-section-icon"></i>Your Bots</div>
<div class="bot-settings-form"> <div class="bot-settings-form">
<p class="bot-settings-note">Looking for our <a href="/integrations" target="_blank">Integrations</a> <p class="bot-settings-note">Looking for our <a href="/integrations" target="_blank">Integrations</a>
or <a href="/api" target="_blank">API</a> documentation?</p> or <a href="/api" target="_blank">API</a> documentation?</p>
@ -181,7 +188,8 @@
<button class="btn" id="bot_avatar_upload_button">Customize avatar</button> (Optional) <button class="btn" id="bot_avatar_upload_button">Customize avatar</button> (Optional)
</div> </div>
</div> </div>
</p> </div>
<p> <p>
<div id="bot_avatar_file_input_error" class="text-error"></div> <div id="bot_avatar_file_input_error" class="text-error"></div>
</p> </p>
@ -192,7 +200,7 @@
</div> </div>
<div id="create_bot_spinner"></div> <div id="create_bot_spinner"></div>
</div> </div>
</div>
</form> </form>
<hr class="settings_separator" /> <hr class="settings_separator" />
@ -200,7 +208,8 @@
<p class="api-key-note">For most bots using the API, you'll want to give each bot <p class="api-key-note">For most bots using the API, you'll want to give each bot
its own name and API key using the above section. But if you its own name and API key using the above section. But if you
want to write a bot that can access your own private want to write a bot that can access your own private
messages, you should use your personal API key.</p> messages, you should use your personal API key.
</p>
<div class="control-group"> <div class="control-group">
<button class="btn" id="api_key_button">Show/change your API key</button> <button class="btn" id="api_key_button">Show/change your API key</button>
</div> </div>
@ -231,7 +240,8 @@
</div> </div>
</div> </div>
</div> </div>
<div id="word-alert-settings" class="settings-section"> <div id="word-alert-settings" class="settings-section">

View File

@ -84,7 +84,15 @@ def validate(fn):
assert state.depth == 0 assert state.depth == 0
git_files = map(str.strip, check_output(['git', 'ls-files']).split('\n')) git_files = map(str.strip, check_output(['git', 'ls-files']).split('\n'))
# 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)