From d14f2763224a573a55369959baebf14244f207eb Mon Sep 17 00:00:00 2001 From: Rishi Gupta Date: Tue, 25 Oct 2016 14:19:43 -0700 Subject: [PATCH] topic_edit_form: Rename message_edit_topic to inline_topic_edit. message_edit_form.handlebars already has a message_edit_topic that refers to the topic edit section of message editing, and this made things very confusing. --- static/js/message_edit.js | 13 ++++++++++--- static/styles/zulip.css | 4 +++- static/templates/topic_edit_form.handlebars | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/static/js/message_edit.js b/static/js/message_edit.js index 7775cfd43a..fdf1a0f64d 100644 --- a/static/js/message_edit.js +++ b/static/js/message_edit.js @@ -56,10 +56,13 @@ exports.save = function (row, from_topic_edited_only) { var topic_changed = false; var new_topic; if (message.type === "stream") { - new_topic = row.find(".message_edit_topic").val(); + if (from_topic_edited_only) { + new_topic = row.find(".inline_topic_edit").val(); + } else { + new_topic = row.find(".message_edit_topic").val(); + } topic_changed = (new_topic !== message.subject && new_topic.trim() !== ""); } - // Editing a not-yet-acked message (because the original send attempt failed) // just results in the in-memory message being changed if (message.local_id !== undefined) { @@ -119,6 +122,10 @@ function handle_edit_keydown(from_topic_edited_only, e) { // Hitting enter in topic field isn't so great. e.stopPropagation(); e.preventDefault(); + } else if (e.target.id === "inline_topic_edit" && code === 13) { + // Hitting enter in topic field isn't so great. + e.stopPropagation(); + e.preventDefault(); } } @@ -310,7 +317,7 @@ exports.start_topic_edit = function (recipient_row) { if (topic === compose.empty_topic_placeholder()) { topic = ''; } - form.find(".message_edit_topic").val(topic).select().focus(); + form.find(".inline_topic_edit").val(topic).select().focus(); }; exports.is_editing = function (id) { diff --git a/static/styles/zulip.css b/static/styles/zulip.css index 86f00dc1ad..cf239b7f83 100644 --- a/static/styles/zulip.css +++ b/static/styles/zulip.css @@ -1551,11 +1551,12 @@ div.focused_table { line-height: 22px; } +#inline_topic_edit, #message_edit_topic { margin-bottom: 5px; } -#message_edit_topic.header-v { +#inline_topic_edit.header-v { height: 18px; display: inline-block; margin: -2px 0 0 0; @@ -1569,6 +1570,7 @@ div.focused_table { box-shadow: none; } +#inline_topic_edit:focus, #message_edit_topic:focus { outline: none; } diff --git a/static/templates/topic_edit_form.handlebars b/static/templates/topic_edit_form.handlebars index ac84525c2a..6e0888ced8 100644 --- a/static/templates/topic_edit_form.handlebars +++ b/static/templates/topic_edit_form.handlebars @@ -2,7 +2,7 @@
{{!
}} - + {{!
}}