Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2018-08-25 01:12:46 +0300
committerGitHub <noreply@github.com>2018-08-25 01:12:46 +0300
commit4e8debcb0a6a2441a7f5d3d180a14933931da6d2 (patch)
treed9c2189735d3150cd0cb0262ade772e756ad1985
parent71bb925c0148f5748ae1928a0846c6a8d1f3506c (diff)
parent4671c0d6636e73d3c3f437f012d70b787bee008b (diff)
Merge pull request #1151 from nextcloud/add-button-to-share-files-from-talk-ui
Add button to share files from Talk UI
-rw-r--r--css/comments.scss24
-rw-r--r--js/views/chatview.js40
2 files changed, 59 insertions, 5 deletions
diff --git a/css/comments.scss b/css/comments.scss
index 75864dddb..8b6c511f4 100644
--- a/css/comments.scss
+++ b/css/comments.scss
@@ -22,31 +22,45 @@
}
#commentsTabView .newCommentForm .message {
- width: calc(100% - 32px);
+ width: calc(100% - 36px);
margin-left: 36px;
padding-right: 30px;
display: block;
}
#commentsTabView .newCommentForm .submit,
-#commentsTabView .newCommentForm .submitLoading {
+#commentsTabView .newCommentForm .submitLoading,
+#commentsTabView .newCommentForm .share,
+#commentsTabView .newCommentForm .shareLoading {
position: absolute;
width: 44px;
height: 44px;
bottom: -4px;
- right: -8px;
margin: 0;
}
-#commentsTabView .newCommentForm .submit {
+#commentsTabView .newCommentForm .submit,
+#commentsTabView .newCommentForm .submitLoading {
+ right: 0;
+}
+
+#commentsTabView .newCommentForm .share,
+#commentsTabView .newCommentForm .shareLoading {
+ right: -44px;
+}
+
+#commentsTabView .newCommentForm .submit,
+#commentsTabView .newCommentForm .share {
background-color: transparent;
border: none;
opacity: .3;
}
#commentsTabView .newCommentForm .submit:hover,
-#commentsTabView .newCommentForm .submit:focus {
+#commentsTabView .newCommentForm .submit:focus,
+#commentsTabView .newCommentForm .share:hover,
+#commentsTabView .newCommentForm .share:focus {
opacity: 1;
}
diff --git a/js/views/chatview.js b/js/views/chatview.js
index a80c6a8a1..9fd82ff23 100644
--- a/js/views/chatview.js
+++ b/js/views/chatview.js
@@ -48,6 +48,10 @@
' <div contentEditable="true" class="message" data-placeholder="{{newMessagePlaceholder}}">{{message}}</div>' +
' <input class="submit icon-confirm" type="submit" value="" />' +
' <div class="submitLoading icon-loading-small hidden"></div>'+
+ ' {{#if actorId}}' +
+ ' <button class="share icon-add"></button>' +
+ ' <div class="shareLoading icon-loading-small hidden"></div>'+
+ ' {{/if}}' +
' </form>' +
'</div>';
@@ -78,6 +82,7 @@
},
events: {
+ 'click .newCommentForm .share': '_onAddShare',
'submit .newCommentForm': '_onSubmitComment',
'paste div.message': '_onPaste'
},
@@ -642,6 +647,41 @@
OC.Notification.show(t('spreed', 'Error occurred while sending message'), {type: 'error'});
},
+ _onAddShare: function() {
+ var self = this;
+ var $form = this.$el.find('.newCommentForm');
+ var $shareButton = $form.find('.share');
+ var $shareLoadingIcon = $form.find('.shareLoading');
+
+ OC.dialogs.filepicker(t('spreed', 'File to share'), function(targetPath) {
+ $shareButton.addClass('hidden');
+ $shareLoadingIcon.removeClass('hidden');
+
+ $.ajax({
+ type: 'POST',
+ url: OC.linkToOCS('apps/files_sharing/api/v1', 2) + 'shares',
+ dataType: 'json',
+ data: {
+ shareType: OC.Share.SHARE_TYPE_ROOM,
+ path: targetPath,
+ shareWith: self.collection.token
+ }
+ }).always(function() {
+ $shareLoadingIcon.addClass('hidden');
+ $shareButton.removeClass('hidden');
+ }).fail(function(xhr) {
+ var message = t('spreed', 'Error while sharing');
+
+ var result = xhr.responseJSON;
+ if (result && result.ocs && result.ocs.meta) {
+ message = result.ocs.meta.message;
+ }
+
+ OC.Notification.showTemporary(message);
+ });
+ }, false, null, true, OC.dialogs.FILEPICKER_TYPE_CHOOSE);
+ },
+
});
OCA.SpreedMe.Views.ChatView = ChatView;