New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate left_sidebar
and right_sidebar
to handlebars.
#19048
Migrate left_sidebar
and right_sidebar
to handlebars.
#19048
Conversation
832c2dd
to
46309fb
Compare
Updated the pr along with its commit message. |
46309fb
to
4fc3db4
Compare
Latest push changes along with rebase -
|
This commit migrates the `left_sidebar.html` Django template to handlebars by creating a new file as `left_sidebar.hbs` which is then rendered using `ui_init` module. These are the minor changes introduced by virtue of template migration - - The `compute_show_invites_and_add_streams` function now only concerns with the invite_to_realm_policy. - Renamed the `compute_show_invites_and_add_streams` function to `compute_show_invites` due to the above change. - Fixes relevant `test_home.py` tests due to the above changes. Fixes part of zulip#18792.
static/templates/left_sidebar.hbs
Outdated
<a href="#recent_topics"> | ||
<span class="filter-icon"> | ||
<i class="fa fa-clock-o" aria-hidden="true"></i> | ||
</span> | ||
{#- squash whitespace -#} | ||
<span>{{ _('Recent topics') }}</span> | ||
{{!-- squash whitespace --}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The squash whitespace
comments were not correctly migrated to actually squash whitespace using handlebars whitespace control; I fixed that while merging.
templates/zerver/app/index.html
Outdated
@@ -91,7 +91,7 @@ <h3>{{ _('Loading...') }}</h3> | |||
</div> | |||
<div class="app-main"> | |||
<div class="column-left"> | |||
{% include "zerver/app/left_sidebar.html" %} | |||
<div id = "left-sidebar-holder"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided it was better to add left-sidebar-container
as an ID on the column-left
class here, to avoid creating an additional unnecessary div.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also note that we don't use space around the =
in our HTML style.
static/js/ui_init.js
Outdated
// to build the page layout early so that it's rendered content | ||
// can be used by other modules. | ||
// For example- Populating the stream lists/populating private messages. | ||
initialize_left_sidebar(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rewrote the comments, since this should be next to compose
and share its comment.
This commit migrates the `right_sidebar.html` Django template to handlebars by creating a new file as `right_sidebar.hbs` which is then rendered using `ui_init` module. It also removes the tests in `test_home` due to the template migration, since these elements aren't rendered on the backend anymore. We also remove `test_compute_show_invites_and_add_streams*`. Fixes part of zulip#18792.
static/js/ui_init.js
Outdated
@@ -138,6 +139,14 @@ function initialize_left_sidebar() { | |||
$("#left-sidebar-holder").html(rendered_sidebar); | |||
} | |||
|
|||
function initialize_right_sidebar() { | |||
const rendered_sidebar = render_right_sidebar({ | |||
can_invite_others_to_realm: page_params.show_invites, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this to settings_data.user_can_invite_others_to_realm()
, since we can compute this on the frontend.
This may mean we get to remove compute_show_invites
as well in a follow-up PR.
4fc3db4
to
1339983
Compare
Merged after making that batch of changes, thanks @aryanshridhar! Can you look at whether we get to delete the backend |
Added a couple of commits to migrate the
left_sidebar.html
(8ba6d0a) andright_sidebar.html
(9c28c91) to handlebars.The templates (
left_sidebar.hbs
andright_sidebar.hbs
) are then rendered usingui_init.js
.Fixes parts of #18792.