mirror of https://github.com/zulip/zulip.git
frontend: Remove html_submit_button paramter passed to dialog_widget.
We used html_submit_button to pass text to be present in the modal submit button. There are only two possible options as of now - "Confirm" and "Save changes" and the correct one can be determined using is_confirm_modal parameter. So, we remove this paramter for now and we can add it later if we have more type of modals using this widget.
This commit is contained in:
parent
ec3c5547ff
commit
dff374a48b
|
@ -103,7 +103,6 @@ export function build_user_avatar_widget(upload_function) {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Delete profile picture"}),
|
html_heading: $t_html({defaultMessage: "Delete profile picture"}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: delete_user_avatar,
|
on_click: delete_user_avatar,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
|
import {$t_html} from "./i18n";
|
||||||
import * as dialog_widget from "./dialog_widget";
|
import * as dialog_widget from "./dialog_widget";
|
||||||
|
|
||||||
export function launch(conf) {
|
export function launch(conf) {
|
||||||
dialog_widget.launch({...conf, is_confirm_dialog: true});
|
dialog_widget.launch(
|
||||||
|
{...conf,
|
||||||
|
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
||||||
|
is_confirm_dialog: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import render_dialog_widget from "../templates/dialog_widget.hbs";
|
||||||
import render_dialog_heading from "../templates/dialog_widget_heading.hbs";
|
import render_dialog_heading from "../templates/dialog_widget_heading.hbs";
|
||||||
|
|
||||||
import * as blueslip from "./blueslip";
|
import * as blueslip from "./blueslip";
|
||||||
|
import {$t_html} from "./i18n";
|
||||||
import * as overlays from "./overlays";
|
import * as overlays from "./overlays";
|
||||||
import * as settings_data from "./settings_data";
|
import * as settings_data from "./settings_data";
|
||||||
|
|
||||||
|
@ -64,18 +65,17 @@ export function launch(conf) {
|
||||||
const html = render_dialog_widget({fade: conf.fade});
|
const html = render_dialog_widget({fade: conf.fade});
|
||||||
const dialog = $(html);
|
const dialog = $(html);
|
||||||
|
|
||||||
const conf_fields = [
|
const mandatory_fields = [
|
||||||
// The next three fields should be safe HTML. If callers
|
// The html_ fields should be safe HTML. If callers
|
||||||
// interpolate user data into strings, they should use
|
// interpolate user data into strings, they should use
|
||||||
// templates.
|
// templates.
|
||||||
"html_heading",
|
"html_heading",
|
||||||
"html_body",
|
"html_body",
|
||||||
"html_submit_button",
|
|
||||||
"on_click",
|
"on_click",
|
||||||
"parent",
|
"parent",
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const f of conf_fields) {
|
for (const f of mandatory_fields) {
|
||||||
if (conf[f] === undefined) {
|
if (conf[f] === undefined) {
|
||||||
blueslip.error("programmer omitted " + f);
|
blueslip.error("programmer omitted " + f);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,8 @@ export function launch(conf) {
|
||||||
|
|
||||||
const submit_button_span = dialog.find(".dialog_submit_button span");
|
const submit_button_span = dialog.find(".dialog_submit_button span");
|
||||||
|
|
||||||
submit_button_span.html(conf.html_submit_button);
|
let html_submit_button = conf.html_submit_button || $t_html({defaultMessage: "Save changes"});
|
||||||
|
submit_button_span.html(html_submit_button);
|
||||||
|
|
||||||
if (conf.post_render !== undefined) {
|
if (conf.post_render !== undefined) {
|
||||||
conf.post_render();
|
conf.post_render();
|
||||||
|
|
|
@ -1004,7 +1004,6 @@ export function delete_message(msg_id) {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Delete message"}),
|
html_heading: $t_html({defaultMessage: "Delete message"}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
help_link: "/help/edit-or-delete-a-message#delete-a-message",
|
help_link: "/help/edit-or-delete-a-message#delete-a-message",
|
||||||
on_click: do_delete_message,
|
on_click: do_delete_message,
|
||||||
loading_spinner: true,
|
loading_spinner: true,
|
||||||
|
|
|
@ -37,7 +37,6 @@ export function confirm_mute_user(user_id) {
|
||||||
html_heading: $t({defaultMessage: "Mute user"}),
|
html_heading: $t({defaultMessage: "Mute user"}),
|
||||||
help_link: "/help/mute-a-user",
|
help_link: "/help/mute-a-user",
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t({defaultMessage: "Confirm"}),
|
|
||||||
on_click,
|
on_click,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -603,7 +603,6 @@ export function set_up() {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Deactivate your account"}),
|
html_heading: $t_html({defaultMessage: "Deactivate your account"}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: handle_confirm,
|
on_click: handle_confirm,
|
||||||
help_link: "/help/deactivate-your-account",
|
help_link: "/help/deactivate-your-account",
|
||||||
fade: true,
|
fade: true,
|
||||||
|
|
|
@ -269,7 +269,6 @@ export function set_up() {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Override built-in emoji?"}),
|
html_heading: $t_html({defaultMessage: "Override built-in emoji?"}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: submit_custom_emoji_request,
|
on_click: submit_custom_emoji_request,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -206,7 +206,6 @@ export function on_load_success(invites_data, initialize_event_handlers) {
|
||||||
? $t_html({defaultMessage: "Revoke invitation link"})
|
? $t_html({defaultMessage: "Revoke invitation link"})
|
||||||
: $t_html({defaultMessage: "Revoke invitation to {email}"}, {email}),
|
: $t_html({defaultMessage: "Revoke invitation to {email}"}, {email}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: do_revoke_invite,
|
on_click: do_revoke_invite,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
@ -232,7 +231,6 @@ export function on_load_success(invites_data, initialize_event_handlers) {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Resend invitation"}),
|
html_heading: $t_html({defaultMessage: "Resend invitation"}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: do_resend_invite,
|
on_click: do_resend_invite,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1174,7 +1174,6 @@ export function build_page() {
|
||||||
html_heading: $t_html({defaultMessage: "Deactivate organization"}),
|
html_heading: $t_html({defaultMessage: "Deactivate organization"}),
|
||||||
help_link: "/help/deactivate-your-organization",
|
help_link: "/help/deactivate-your-organization",
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: do_deactivate_realm,
|
on_click: do_deactivate_realm,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -366,7 +366,6 @@ export function set_up() {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Delete user group"}),
|
html_heading: $t_html({defaultMessage: "Delete user group"}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: delete_user_group,
|
on_click: delete_user_group,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -447,7 +447,6 @@ function confirm_deactivation(row, user_id, status_field) {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Deactivate {email}"}, {email: user.email}),
|
html_heading: $t_html({defaultMessage: "Deactivate {email}"}, {email: user.email}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: handle_confirm,
|
on_click: handle_confirm,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,6 @@ export function confirm_unstar_all_messages() {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Unstar all messages"}),
|
html_heading: $t_html({defaultMessage: "Unstar all messages"}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: message_flags.unstar_all_messages,
|
on_click: message_flags.unstar_all_messages,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -41,7 +40,6 @@ export function confirm_unstar_all_messages_in_topic(stream_id, topic) {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Unstar messages in topic"}),
|
html_heading: $t_html({defaultMessage: "Unstar messages in topic"}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click,
|
on_click,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -441,7 +441,6 @@ export function set_up_handlers() {
|
||||||
parent: modal_parent,
|
parent: modal_parent,
|
||||||
html_heading: $t_html({defaultMessage: "Large number of subscribers"}),
|
html_heading: $t_html({defaultMessage: "Large number of subscribers"}),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: () => {
|
on_click: () => {
|
||||||
create_stream();
|
create_stream();
|
||||||
},
|
},
|
||||||
|
|
|
@ -899,7 +899,6 @@ export function initialize() {
|
||||||
{stream_name: sub.name},
|
{stream_name: sub.name},
|
||||||
),
|
),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: remove_user_from_private_stream,
|
on_click: remove_user_from_private_stream,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
@ -968,7 +967,6 @@ export function initialize() {
|
||||||
),
|
),
|
||||||
help_link: "/help/archive-a-stream",
|
help_link: "/help/archive-a-stream",
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: do_archive_stream,
|
on_click: do_archive_stream,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -671,7 +671,6 @@ export function register_topic_handlers() {
|
||||||
html_heading: $t_html({defaultMessage: "Delete topic"}),
|
html_heading: $t_html({defaultMessage: "Delete topic"}),
|
||||||
help_link: "/help/delete-a-topic",
|
help_link: "/help/delete-a-topic",
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: () => {
|
on_click: () => {
|
||||||
message_edit.delete_topic(stream_id, topic);
|
message_edit.delete_topic(stream_id, topic);
|
||||||
},
|
},
|
||||||
|
|
|
@ -970,7 +970,6 @@ export function unsubscribe_from_private_stream(sub, from_stream_popover) {
|
||||||
{stream_name: sub.name},
|
{stream_name: sub.name},
|
||||||
),
|
),
|
||||||
html_body,
|
html_body,
|
||||||
html_submit_button: $t_html({defaultMessage: "Confirm"}),
|
|
||||||
on_click: unsubscribe_from_stream,
|
on_click: unsubscribe_from_stream,
|
||||||
fade: true,
|
fade: true,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue