mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
File uploads using Dropbox.
(imported from commit c552133fc7025eca526fbfef24fd544260d7111b)
This commit is contained in:
@@ -7,6 +7,7 @@ exports.mark_read_at_bottom = page_params.staging;
|
||||
exports.summarize_read_while_narrowed = page_params.staging;
|
||||
exports.twenty_four_hour_time = _.contains([],
|
||||
page_params.email);
|
||||
exports.dropbox_integration = page_params.staging || _.contains(['dropbox.com'], page_params.domain);
|
||||
return exports;
|
||||
|
||||
}());
|
||||
|
||||
@@ -1096,6 +1096,10 @@ $(function () {
|
||||
if (window.XMLHttpRequest && (new XMLHttpRequest()).upload) {
|
||||
$("#compose #attach_files").removeClass("notdisplayed");
|
||||
}
|
||||
if (feature_flags.dropbox_integration && Dropbox.isBrowserSupported()) {
|
||||
$("#compose #attach_dropbox_files").removeClass("notdisplayed");
|
||||
}
|
||||
|
||||
|
||||
// Event bindings for "Compose" pane
|
||||
|
||||
@@ -1107,6 +1111,24 @@ $(function () {
|
||||
$("#compose #file_input").trigger("click");
|
||||
} );
|
||||
|
||||
$("#compose").on("click", "#attach_dropbox_files", function (e) {
|
||||
e.preventDefault();
|
||||
var options = {
|
||||
// Required. Called when a user selects an item in the Chooser.
|
||||
success: function (files) {
|
||||
var textbox = $("#new_message_content");
|
||||
var links = _.map(files, function (file) { return '[' + file.name + '](' + file.link +')'; })
|
||||
.join(' ') + ' ';
|
||||
textbox.val(textbox.val() + links);
|
||||
|
||||
},
|
||||
// Optional. A value of false (default) limits selection to a single file, while
|
||||
// true enables multiple file selection.
|
||||
multiselect: true
|
||||
};
|
||||
Dropbox.choose(options);
|
||||
});
|
||||
|
||||
$("#subscriptions_table").on("mouseover", ".subscription_header", function (e) {
|
||||
$(this).addClass("active");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user