-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'integrate-webdav' of github.com:karakayasemi/Rocket.Cha…
…t into HEAD
- Loading branch information
Showing
32 changed files
with
897 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/rocketchat-ui-account/client/accountIntegrations.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template name="accountIntegrations"> | ||
<section class="page-container page-home page-static"> | ||
{{> header sectionName="Integrations"}} | ||
|
||
<div class="content"> | ||
<form id="integrations" autocomplete="off"> | ||
<fieldset class="rc-form-legend"> | ||
<div class="section"> | ||
<h1>{{_ "WebDAV"}}</h1> | ||
<div class="section-content border-component-color"> | ||
<div class="input-line double-col"> | ||
<label for="webdav-accounts">{{_ "WebDAV_Accounts"}}</label> | ||
<div class="rc-select"> | ||
<select id="webdav-accounts" class="rc-select__element" style="text-transform: none" multiple> | ||
{{#each webdavAccounts}} | ||
<option value="{{this._id}}">{{getOptionValue this}}</option> | ||
{{/each}} | ||
</select> | ||
</div> | ||
<button class="rc-button rc-button--cancel webdav-account-remove"><span>{{_ "Remove"}}</span></button> | ||
</div> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</form> | ||
</div> | ||
</section> | ||
</template> |
33 changes: 33 additions & 0 deletions
33
packages/rocketchat-ui-account/client/accountIntegrations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* global */ | ||
|
||
import toastr from 'toastr'; | ||
|
||
Template.accountIntegrations.helpers({ | ||
webdavAccounts() { | ||
return RocketChat.models.WebdavAccounts.find().fetch(); | ||
}, | ||
getOptionValue(account) { | ||
return account.name || `${ account.username }@${ account.server_url.replace(/^https?\:\/\//i, '') }`; | ||
}, | ||
}); | ||
|
||
Template.accountIntegrations.events({ | ||
'click .webdav-account-remove'(e) { | ||
e.preventDefault(); | ||
const selectEl = document.getElementById('webdav-accounts'); | ||
const { options } = selectEl; | ||
const selectedOption = selectEl.value; | ||
const optionIndex = Array.from(options).findIndex((option) => option.value === selectedOption); | ||
|
||
Meteor.call('removeWebdavAccount', selectedOption, function(error) { | ||
if (error) { | ||
return toastr.error(t(error.error)); | ||
} | ||
|
||
toastr.success(t('webdav-account-removed')); | ||
modal.close(); | ||
}); | ||
|
||
selectEl.remove(optionIndex); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# RocketChat WebDAV | ||
|
||
Package for RocketChat users to interact with WebDAV servers (Tested with ownCloud and Nextcloud). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* globals modal, RocketChat*/ | ||
|
||
Meteor.startup(function() { | ||
|
||
RocketChat.MessageAction.addButton({ | ||
id: 'webdav-upload', | ||
icon: 'upload', | ||
label: t('Save_To_Webdav'), | ||
condition: (message) => { | ||
if (RocketChat.models.Subscriptions.findOne({ rid: message.rid }) == null) { | ||
return false; | ||
} | ||
if (RocketChat.models.WebdavAccounts.findOne() == null) { | ||
return false; | ||
} | ||
if (!message.file) { | ||
return false; | ||
} | ||
|
||
return RocketChat.settings.get('Webdav_Integration_Enabled'); | ||
}, | ||
action() { | ||
const [, message] = this._arguments; | ||
const [attachment] = message.attachments; | ||
const { file } = message; | ||
const url = Meteor.absoluteUrl().concat(attachment.title_link.substring(1)); | ||
modal.open({ | ||
data: { | ||
message, | ||
attachment, | ||
file, | ||
url, | ||
}, | ||
title: t('Save_To_Webdav'), | ||
content: 'selectWebdavAccount', | ||
showCancelButton: true, | ||
showConfirmButton: false, | ||
closeOnCancel: true, | ||
html: true, | ||
}); | ||
}, | ||
order: 100, | ||
group: 'menu', | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template name="addWebdavAccount"> | ||
<form id="add-webdav" class="content-background-color color-primary-font-color"> | ||
<div class="fields"> | ||
<div class="rc-input"> | ||
<label class="rc-input__label" for="serverURL"> | ||
<div class="rc-input__wrapper"> | ||
<input name="name" id="serverName" type="text" class="rc-input__element" autocapitalize="off" autocorrect="off" placeholder="{{_ 'Name_optional' }}" | ||
autofocus> | ||
<div class="input-error"></div> | ||
</div> | ||
</label> | ||
</div> | ||
<div class="rc-input"> | ||
<label class="rc-input__label" for="serverURL"> | ||
<div class="rc-input__wrapper"> | ||
<input name="serverURL" id="serverURL" type="text" class="rc-input__element" autocapitalize="off" autocorrect="off" placeholder="{{_ 'Webdav_Server_URL' }}" | ||
autofocus> | ||
<div class="input-error"></div> | ||
</div> | ||
</label> | ||
</div> | ||
<div class="rc-input"> | ||
<label class="rc-input__label" for="username"> | ||
<div class="rc-input__wrapper"> | ||
<input name="username" id="username" type="text" class="rc-input__element" autocapitalize="off" autocorrect="off" placeholder="{{_ 'Username' }}" autofocus> | ||
<div class="input-error"></div> | ||
</div> | ||
</label> | ||
</div> | ||
<div class="rc-input"> | ||
<label class="rc-input__label" for="pass"> | ||
<div class="rc-input__wrapper"> | ||
<input name="pass" id="pass" type="password" class="rc-input__element" autocapitalize="off" autocorrect="off" placeholder="{{_ 'Password' }}" autofocus> | ||
<div class="input-error"></div> | ||
</div> | ||
</label> | ||
</div> | ||
</div> | ||
<div class="submit"> | ||
<button class="rc-button rc-button--primary"><span>{{btnAddNewServer}}</span></button> | ||
</div> | ||
</form> | ||
</template> |
Oops, something went wrong.