templates: Move all core app templates into a subdirectory.

This should make it easier to find the templates that are actually
part of the core webapp, instead of having them all mixed together
with the portico pages.
This commit is contained in:
Tim Abbott 2018-04-21 22:02:19 -07:00
parent 8fc04a074d
commit 1703e23980
30 changed files with 37 additions and 37 deletions

View File

@ -46,7 +46,7 @@ See [our docs](../subsystems/html-templates.html) for details on Zulip's
templating systems.
* `templates/zerver/` For [Jinja2](http://jinja.pocoo.org/) templates
for the backend (for zerver app).
for the backend (for zerver app; logged-in content is in `templates/zerver/app`).
* `static/templates/` [Handlebars](http://handlebarsjs.com/) templates for the frontend.

View File

@ -32,8 +32,8 @@ renders the template. For example, if you want to find the context
passed to `index.html`, you can do:
```
$ git grep zerver/index.html '*.py'
zerver/views/home.py: response = render(request, 'zerver/index.html',
$ git grep zerver/app/index.html '*.py'
zerver/views/home.py: response = render(request, 'zerver/app/index.html',
```
The next line in the code being the context definition.

View File

@ -100,7 +100,7 @@ places:
your changes won't be supported in the frontend processor.
* If desired, the typeahead logic in `static/js/composebox_typeahead.js`.
* The test suite, probably via adding entries to `zerver/tests/fixtures/markdown_test_cases.json`.
* The in-app markdown documentation (`templates/zerver/markdown_help.html`).
* The in-app markdown documentation (`templates/zerver/app/markdown_help.html`).
* The list of changes to markdown at the end of this document.
Important considerations for any changes are:

View File

@ -121,7 +121,7 @@ feature requires UI changes, you may need to add additional CSS to this
file.
**Templates:** The initial page structure is rendered via Jinja2
templates located in `templates/zerver`. For JavaScript, Zulip uses
templates located in `templates/zerver/app`. For JavaScript, Zulip uses
Handlebars templates located in `static/templates`. Templates are
precompiled as part of the build/deploy process.

View File

@ -101,7 +101,7 @@ def home(request):
### Writing a template
Templates for the main website are found in
[templates/zerver](https://github.com/zulip/zulip/blob/master/templates/zerver).
[templates/zerver/app](https://github.com/zulip/zulip/blob/master/templates/zerver/app).
## Writing API REST endpoints

View File

@ -131,8 +131,8 @@
</div>
{% include "zerver/message_history.html" %}
{% include "zerver/delete_message.html" %}
{% include "zerver/compose.html" %}
{% include "zerver/app/message_history.html" %}
{% include "zerver/app/delete_message.html" %}
{% include "zerver/app/compose.html" %}
<div id="notifications-area">
</div>

View File

@ -41,7 +41,7 @@
{{ render_bundle('katex') }}
{% include "zerver/topic_is_muted.html" %}
{% include "zerver/app/topic_is_muted.html" %}
{% endblock %}
{% block content %}
@ -59,14 +59,14 @@
</script>
</div>
{% include "zerver/lightbox_overlay.html" %}
{% include "zerver/subscriptions.html" %}
{% include "zerver/drafts.html" %}
{% include "zerver/app/lightbox_overlay.html" %}
{% include "zerver/app/subscriptions.html" %}
{% include "zerver/app/drafts.html" %}
<div id="settings_overlay_container" class="overlay" data-overlay="settings" aria-hidden="true">
{% include "zerver/settings_overlay.html" %}
{% include "zerver/app/settings_overlay.html" %}
</div>
{% include "zerver/navbar.html" %}
{% include "zerver/app/navbar.html" %}
<div class="fixed-app">
<div class="app-main">
@ -105,7 +105,7 @@
</div>
<div class="app-main">
<div class="column-left">
{% include "zerver/left_sidebar.html" %}
{% include "zerver/app/left_sidebar.html" %}
</div>
<div class="column-middle">
<div class="column-middle-inner tab-content">
@ -132,18 +132,18 @@
</div>
</div>
</div>
{% include "zerver/home.html" %}
{% include "zerver/app/home.html" %}
</div>
{% if show_debug %}
<div class="tab-pane" id="debug">
{% include "zerver/debug.html" %}
{% include "zerver/app/debug.html" %}
</div>
{% endif %}
</div><!--/tab-content-->
</div>
<div class="column-right">
{% include "zerver/right_sidebar.html" %}
{% include "zerver/app/right_sidebar.html" %}
</div><!--/right sidebar-->
</div><!--/row-->
<div class="informational-overlays overlay new-style" data-overlay="informationalOverlays" aria-hidden="true">
@ -152,16 +152,16 @@
<button class="button no-style exit">&times;</button>
</div>
<div class="overlay-body">
{% include "zerver/keyboard_shortcuts.html" %}
{% include "zerver/search_operators.html" %}
{% include "zerver/markdown_help.html" %}
{% include "zerver/app/keyboard_shortcuts.html" %}
{% include "zerver/app/search_operators.html" %}
{% include "zerver/app/markdown_help.html" %}
</div>
</div>
</div>
{% include "zerver/invite_user.html" %}
{% include "zerver/bankruptcy.html" %}
{% include "zerver/logout.html" %}
{% include "zerver/deprecation_notice.html" %}
{% include "zerver/app/invite_user.html" %}
{% include "zerver/app/bankruptcy.html" %}
{% include "zerver/app/logout.html" %}
{% include "zerver/app/deprecation_notice.html" %}
<div class='notifications top-right'></div>
</div>
{% endblock %}

View File

@ -136,6 +136,6 @@
</div>
</div>
{% include "zerver/settings_sidebar.html" %}
{% include "zerver/app/settings_sidebar.html" %}
</div>
</div>

View File

@ -11,7 +11,7 @@
</a>
</li>
<li>
{% include 'zerver/logout.html' %}
{% include 'zerver/app/logout.html' %}
<a href="#logout">
<span class="logout">
<i class="icon-vector-off"></i>

View File

@ -100,7 +100,7 @@ def check_html_templates(templates, all_dups):
# prevent cleaning them.
'templates/corporate/zephyr-mirror.html',
# Can't clean this because of `preserve_spaces`
'templates/zerver/markdown_help.html',
'templates/zerver/app/markdown_help.html',
]
validate(fn=fn, check_indent=(fn not in bad_files))
@ -111,7 +111,7 @@ def check_html_templates(templates, all_dups):
# to convert it to a /help/ markdown article.
'templates/corporate/zephyr-mirror.html',
# Can't clean this because of `preserve_spaces`
'templates/zerver/markdown_help.html',
'templates/zerver/app/markdown_help.html',
]
# TODO: Clean these files
for fn in templates:

View File

@ -614,7 +614,7 @@ def build_custom_checkers(by_lang):
'bad_lines': ["<p title='foo'></p>"]},
{'pattern': 'title="[^{\:]',
'exclude_line': set([
('templates/zerver/markdown_help.html',
('templates/zerver/app/markdown_help.html',
'<td><img alt=":heart:" class="emoji" src="/static/generated/emoji/images/emoji/heart.png" title=":heart:" /></td>')
]),
'exclude': set(["templates/zerver/emails"]),
@ -622,8 +622,8 @@ def build_custom_checkers(by_lang):
{'pattern': '\Walt=["\'][^{"\']',
'description': "alt argument should be enclosed by _() or it should be an empty string.",
'exclude': set(['static/templates/settings/display-settings.handlebars',
'templates/zerver/keyboard_shortcuts.html',
'templates/zerver/markdown_help.html']),
'templates/zerver/app/keyboard_shortcuts.html',
'templates/zerver/app/markdown_help.html']),
'good_lines': ['<img src="{{source_url}}" alt="{{ _(name) }}" />', '<img alg="" />'],
'bad_lines': ['<img alt="Foo Image" />']},
{'pattern': '\Walt=["\']{{ ?["\']',
@ -642,7 +642,7 @@ def build_custom_checkers(by_lang):
'exclude_pattern': r'.*style ?=["' + "'" + '](display: ?none|background: {{|color: {{|background-color: {{).*',
'exclude': set([
# KaTeX output uses style attribute
'templates/zerver/markdown_help.html',
'templates/zerver/app/markdown_help.html',
# 5xx page doesn't have external CSS
'static/html/5xx.html',
# Group PMs color is dynamically calculated
@ -665,14 +665,14 @@ def build_custom_checkers(by_lang):
'templates/zerver/email_log.html',
# Probably just needs to be changed to display: none so the exclude works
'templates/zerver/navbar.html',
'templates/zerver/app/navbar.html',
# Needs the width cleaned up; display: none is fine
'static/templates/settings/account-settings.handlebars',
# Inline styling for an svg; could be moved to CSS files?
'templates/zerver/landing_nav.html',
'templates/zerver/home.html',
'templates/zerver/app/home.html',
'templates/zerver/features.html',
'templates/zerver/portico-header.html',

View File

@ -236,7 +236,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
show_invites = False
request._log_data['extra'] = "[%s]" % (register_ret["queue_id"],)
response = render(request, 'zerver/index.html',
response = render(request, 'zerver/app/index.html',
context={'user_profile': user_profile,
'page_params': JSONEncoderForHTML().encode(page_params),
'nofontface': is_buggy_ua(request.META.get("HTTP_USER_AGENT", "Unspecified")),