Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

message_history: Migrate to handlebars.

Ganesh Pawar8744b42beb61
diff --git a/static/js/message_edit_history.js b/static/js/message_edit_history.js
index fccf89ec32e..faefa7304a4 100644
--- a/static/js/message_edit_history.js
+++ b/static/js/message_edit_history.js
@@ -2,6 +2,7 @@ import {format, isSameDay} from "date-fns";
import $ from "jquery";
import render_message_edit_history from "../templates/message_edit_history.hbs";
+import render_message_history from "../templates/message_history.hbs";
import * as channel from "./channel";
import {$t_html} from "./i18n";
@@ -78,3 +79,10 @@ export function show_history(message) {
overlays.open_modal("#message-edit-history");
fetch_and_render_message_history(message);
}
+
+export function initialize() {
+ // TODO: Migrate this modal to be rendered when
+ // opened rather than once at startup.
+ const rendered_message_history = render_message_history();
+ $("#message_feed_container").append(rendered_message_history);
+}
diff --git a/static/js/ui_init.js b/static/js/ui_init.js
index f585765059b..07a88d80250 100644
--- a/static/js/ui_init.js
+++ b/static/js/ui_init.js
@@ -32,6 +32,7 @@ import * as linkifiers from "./linkifiers";
import * as markdown from "./markdown";
import * as markdown_config from "./markdown_config";
import * as message_edit from "./message_edit";
+import * as message_edit_history from "./message_edit_history";
import * as message_fetch from "./message_fetch";
import * as message_lists from "./message_lists";
import * as message_scroll from "./message_scroll";
@@ -531,6 +532,7 @@ export function initialize_everything() {
starred_messages.initialize();
user_status_ui.initialize();
fenced_code.initialize(generated_pygments_data);
+ message_edit_history.initialize();
}
$(() => {
diff --git a/templates/zerver/app/message_history.html b/static/templates/message_history.hbs
similarity index 71%
rename from templates/zerver/app/message_history.html
rename to static/templates/message_history.hbs
index 1a121e6a7ba..abea2da4dda 100644
--- a/templates/zerver/app/message_history.html
+++ b/static/templates/message_history.hbs
@@ -1,14 +1,14 @@
<div class="modal hide modal-bg new-style" id="message-edit-history" tabindex="-1" role="dialog"
aria-labelledby="message-history-label" aria-hidden="true">
<div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="{{ _('Close') }}"><span aria-hidden="true">&times;</span></button>
- <h3 id="message-history-label">{{ _('Message edit history') }}</h3>
+ <button type="button" class="close" data-dismiss="modal" aria-label="{{t 'Close' }}"><span aria-hidden="true">&times;</span></button>
+ <h3 id="message-history-label">{{t "Message edit history" }}</h3>
</div>
<div class="modal-body">
<div id="message-history-error"></div>
<div class="controls" id="message-history"></div>
</div>
<div class="modal-footer">
- <button class="button small rounded" id="message-history-cancel" data-dismiss="modal">{{ _("Close") }}</button>
+ <button class="button small rounded" id="message-history-cancel" data-dismiss="modal">{{t "Close" }}</button>
</div>
</div>
diff --git a/templates/zerver/app/home.html b/templates/zerver/app/home.html
index d32915735f6..78cf449768b 100644
--- a/templates/zerver/app/home.html
+++ b/templates/zerver/app/home.html
@@ -154,7 +154,6 @@
</div>
-{% include "zerver/app/message_history.html" %}
<audio id="notification-sound-audio">
<source id="notification-sound-source-ogg" type="audio/ogg" />
<source id="notification-sound-source-mp3" type="audio/mpeg" />