mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
Use the new_zephyr form for personal zephyrs, rather than a duplicate.
(imported from commit 741a785efba9ea40b5c1022d710360f086a2d859)
This commit is contained in:
@@ -33,10 +33,10 @@
|
||||
<li><a href="#personal-message" data-toggle="pill">Huddle</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-pane active" id="class-message">
|
||||
<div class="tab-pane active">
|
||||
<div class="zephyr_comp">
|
||||
<form action="/send_message/" method="post" class="zephyr">
|
||||
<input type="hidden" name="type" value="class" />
|
||||
<input type="hidden" name="type" value="class" id="new_message_type"/>
|
||||
{% csrf_token %}
|
||||
<table class="zephyr_compose_table">
|
||||
<tbody>
|
||||
@@ -45,7 +45,7 @@
|
||||
<td class="ztable_col2" />
|
||||
<td class="ztable_col3" />
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="class-message">
|
||||
<td colspan="2" class="zephyr_newstyle_class">
|
||||
<input type="text" class="zephyr_recipient_box" name="class" id="class" value="" placeholder="Stream" autocomplete="off"/>
|
||||
</td>
|
||||
@@ -53,6 +53,11 @@
|
||||
<input type="text" class="zephyr_recipient_box" name="instance" id="instance" value="" placeholder="Topic" autocomplete="off"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="personal-message">
|
||||
<td colspan="3" class="zephyr_newstyle_pm">
|
||||
Huddle with <input type="text" class="zephyr_recipient_box" name="recipient" id="recipient" value="" placeholder="one or more of your friends..." autocomplete="off"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="zephyr_picture"></td>
|
||||
<td class="pointer"></td>
|
||||
@@ -68,38 +73,6 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="personal-message">
|
||||
<div class="zephyr_comp">
|
||||
<form action="/send_message/" method="post" class="zephyr">
|
||||
<input type="hidden" name="type" value="personal" />
|
||||
{% csrf_token %}
|
||||
<table class="zephyr_compose_table">
|
||||
<tbody>
|
||||
<tr style="visibility: collapse;">
|
||||
<td class="ztable_col1" />
|
||||
<td class="ztable_col2" />
|
||||
<td class="ztable_col3" />
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="zephyr_newstyle_pm">
|
||||
Huddle with <input type="text" class="zephyr_recipient_box" name="recipient" id="recipient" value="" placeholder="one or more of your friends..." autocomplete="off"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="zephyr_picture"></td>
|
||||
<td class="pointer"></td>
|
||||
<td class="messagebox personal-message">
|
||||
<div class="zephyr_content">
|
||||
<textarea class="zephyr_message" name="content" id="new_personal_zephyr" value="" placeholder="Compose your message here..."></textarea>
|
||||
<input type="submit" name="personal_zephyr" value="Send" class="btn send_zephyr"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -56,7 +56,7 @@ function compose_recipient() {
|
||||
}
|
||||
|
||||
function compose_huddle_message() {
|
||||
return $.trim($("#new_personal_zephyr").val());
|
||||
return $.trim($("#new_zephyr").val());
|
||||
}
|
||||
|
||||
function compose_error(error_text, bad_input) {
|
||||
@@ -64,12 +64,12 @@ function compose_error(error_text, bad_input) {
|
||||
.addClass('alert-error')
|
||||
.text(error_text)
|
||||
.stop(true).fadeTo(0, 1);
|
||||
$('#class-message, #personal-message').find('input[type="submit"]').removeAttr('disabled');
|
||||
$('#zephyr_compose').find('input[type="submit"]').removeAttr('disabled');
|
||||
bad_input.focus().select();
|
||||
}
|
||||
|
||||
function submit_buttons() {
|
||||
return $('#class-message, #personal-message').find('input[type="submit"]');
|
||||
return $('#zephyr_compose').find('input[type="submit"]');
|
||||
}
|
||||
|
||||
// *Synchronously* check if a class exists.
|
||||
@@ -143,7 +143,7 @@ function validate_huddle_message() {
|
||||
}
|
||||
|
||||
if (compose_huddle_message() === "") {
|
||||
compose_error("You have nothing to send!", $("#new_personal_zephyr"));
|
||||
compose_error("You have nothing to send!", $("#new_zephyr"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ function sub_from_home(zephyr_class, prompt_button) {
|
||||
dataType: 'json',
|
||||
timeout: 10*60*1000, // 10 minutes in ms
|
||||
success: function (data) {
|
||||
$("#class-message form").ajaxSubmit();
|
||||
$("#zephyr_compose form").ajaxSubmit();
|
||||
prompt_button.stop(true).fadeOut(500);
|
||||
$("#subscriptions-status").fadeOut(0);
|
||||
},
|
||||
|
||||
@@ -108,10 +108,14 @@ $(function () {
|
||||
});
|
||||
|
||||
$('#zephyr-type-tabs a[href="#class-message"]').on('shown', function (e) {
|
||||
$('#class-message input:not(:hidden):first').focus().select();
|
||||
$('#personal-message').hide();
|
||||
$('#class-message').show();
|
||||
$('#new_message_type').val('class');
|
||||
});
|
||||
$('#zephyr-type-tabs a[href="#personal-message"]').on('shown', function (e) {
|
||||
$('#personal-message input:not(:hidden):first').focus().select();
|
||||
$('#personal-message').show();
|
||||
$('#class-message').hide();
|
||||
$('#new_message_type').val('personal');
|
||||
});
|
||||
|
||||
// Prepare the click handler for subbing to a new class to which
|
||||
|
||||
@@ -4,7 +4,7 @@ var instance_list = [];
|
||||
|
||||
$(function () {
|
||||
var send_status = $('#send-status');
|
||||
var buttons = $('#class-message, #personal-message').find('input[type="submit"]');
|
||||
var buttons = $('#zephyr_compose').find('input[type="submit"]');
|
||||
|
||||
var options = {
|
||||
dataType: 'json', // This seems to be ignored. We still get back an xhr.
|
||||
@@ -35,8 +35,7 @@ $(function () {
|
||||
};
|
||||
|
||||
send_status.hide();
|
||||
$("#class-message form").ajaxForm(options);
|
||||
$("#personal-message form").ajaxForm(options);
|
||||
$("#zephyr_compose form").ajaxForm(options);
|
||||
});
|
||||
|
||||
var selected_zephyr_id = -1; /* to be filled in on document.ready */
|
||||
@@ -195,7 +194,7 @@ function select_zephyr(next_zephyr, scroll_to) {
|
||||
|
||||
function prepare_huddle(recipients) {
|
||||
// Used for both personals and huddles.
|
||||
show_compose('personal', $("#new_personal_zephyr"));
|
||||
show_compose('personal', $("#new_zephyr"));
|
||||
$("#recipient").val(recipients);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user