summaryrefslogtreecommitdiffstats
path: root/client/components/cards
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/cards')
-rw-r--r--client/components/cards/attachments.js82
-rw-r--r--client/components/cards/cardDetails.js31
-rw-r--r--client/components/cards/cardDetails.styl4
-rw-r--r--client/components/cards/checklists.styl3
-rw-r--r--client/components/cards/labels.styl3
-rw-r--r--client/components/cards/minicard.styl12
6 files changed, 58 insertions, 77 deletions
diff --git a/client/components/cards/attachments.js b/client/components/cards/attachments.js
index f536a655..843f1eb7 100644
--- a/client/components/cards/attachments.js
+++ b/client/components/cards/attachments.js
@@ -55,24 +55,12 @@ Template.cardAttachmentsPopup.events({
'change .js-attach-file'(event) {
const card = this;
const processFile = f => {
- const file = new FS.File(f);
- if (card.isLinkedCard()) {
- file.boardId = Cards.findOne(card.linkedId).boardId;
- file.cardId = card.linkedId;
- } else {
- file.boardId = card.boardId;
- file.swimlaneId = card.swimlaneId;
- file.listId = card.listId;
- file.cardId = card._id;
- }
- file.userId = Meteor.userId();
- const attachment = Attachments.insert(file);
-
- if (attachment && attachment._id && attachment.isImage()) {
- card.setCover(attachment._id);
- }
-
- Popup.close();
+ Utils.processUploadedAttachment(card, f, attachment => {
+ if (attachment && attachment._id && attachment.isImage()) {
+ card.setCover(attachment._id);
+ }
+ Popup.close();
+ });
};
FS.Utility.eachFile(event, f => {
@@ -86,7 +74,7 @@ Template.cardAttachmentsPopup.events({
reader.onload = function(e) {
const dataurl = e && e.target && e.target.result;
if (dataurl !== undefined) {
- shrinkImage({
+ Utils.shrinkImage({
dataurl,
maxSize: MAX_IMAGE_PIXEL,
ratio: COMPRESS_RATIO,
@@ -118,59 +106,9 @@ Template.cardAttachmentsPopup.events({
'click .js-upload-clipboard-image': Popup.open('previewClipboardImage'),
});
-const MAX_IMAGE_PIXEL = Meteor.settings.public.MAX_IMAGE_PIXEL;
-const COMPRESS_RATIO = Meteor.settings.public.IMAGE_COMPRESS_RATIO;
+const MAX_IMAGE_PIXEL = Utils.MAX_IMAGE_PIXEL;
+const COMPRESS_RATIO = Utils.IMAGE_COMPRESS_RATIO;
let pastedResults = null;
-const shrinkImage = function(options) {
- // shrink image to certain size
- const dataurl = options.dataurl,
- callback = options.callback,
- toBlob = options.toBlob;
- let canvas = document.createElement('canvas'),
- image = document.createElement('img');
- const maxSize = options.maxSize || 1024;
- const ratio = options.ratio || 1.0;
- const next = function(result) {
- image = null;
- canvas = null;
- if (typeof callback === 'function') {
- callback(result);
- }
- };
- image.onload = function() {
- let width = this.width,
- height = this.height;
- let changed = false;
- if (width > height) {
- if (width > maxSize) {
- height *= maxSize / width;
- width = maxSize;
- changed = true;
- }
- } else if (height > maxSize) {
- width *= maxSize / height;
- height = maxSize;
- changed = true;
- }
- canvas.width = width;
- canvas.height = height;
- canvas.getContext('2d').drawImage(this, 0, 0, width, height);
- if (changed === true) {
- const type = 'image/jpeg';
- if (toBlob) {
- canvas.toBlob(next, type, ratio);
- } else {
- next(canvas.toDataURL(type, ratio));
- }
- } else {
- next(changed);
- }
- };
- image.onerror = function() {
- next(false);
- };
- image.src = dataurl;
-};
Template.previewClipboardImagePopup.onRendered(() => {
// we can paste image from clipboard
@@ -182,7 +120,7 @@ Template.previewClipboardImagePopup.onRendered(() => {
};
if (MAX_IMAGE_PIXEL) {
// if has size limitation on image we shrink it before uploading
- shrinkImage({
+ Utils.shrinkImage({
dataurl: results.dataURL,
maxSize: MAX_IMAGE_PIXEL,
ratio: COMPRESS_RATIO,
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index 781967ae..cd8813f5 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -117,6 +117,37 @@ BlazeComponent.extendComponent({
},
onRendered() {
+ if (Meteor.settings.public.CARD_OPENED_WEBHOOK_ENABLED) {
+ // Send Webhook but not create Activities records ---
+ const card = this.currentData();
+ const userId = Meteor.userId();
+ //console.log(`userId: ${userId}`);
+ //console.log(`cardId: ${card._id}`);
+ //console.log(`boardId: ${card.boardId}`);
+ //console.log(`listId: ${card.listId}`);
+ //console.log(`swimlaneId: ${card.swimlaneId}`);
+ const params = {
+ userId,
+ cardId: card._id,
+ boardId: card.boardId,
+ listId: card.listId,
+ user: Meteor.user().username,
+ url: '',
+ };
+ //console.log('looking for integrations...');
+ const integrations = Integrations.find({
+ boardId: card.boardId,
+ type: 'outgoing-webhooks',
+ enabled: true,
+ activities: { $in: ['CardDetailsRendered', 'all'] },
+ }).fetch();
+ //console.log(`Investigation length: ${integrations.length}`);
+ if (integrations.length > 0) {
+ Meteor.call('outgoingWebhooks', integrations, 'CardSelected', params);
+ }
+ //-------------
+ }
+
if (!Utils.isMiniScreen()) {
Meteor.setTimeout(() => {
$('.card-details').mCustomScrollbar({
diff --git a/client/components/cards/cardDetails.styl b/client/components/cards/cardDetails.styl
index 4bba2d4d..cd475072 100644
--- a/client/components/cards/cardDetails.styl
+++ b/client/components/cards/cardDetails.styl
@@ -99,7 +99,9 @@
&.card-details-item-end,
&.card-details-item-customfield,
&.card-details-item-name
- max-width: 50%
+ display: block
+ word-wrap: break-word
+ max-width: 48%
flex-grow: 1
.card-details-item-title
diff --git a/client/components/cards/checklists.styl b/client/components/cards/checklists.styl
index d48c1851..8ac37a15 100644
--- a/client/components/cards/checklists.styl
+++ b/client/components/cards/checklists.styl
@@ -128,6 +128,9 @@ textarea.js-add-checklist-item, textarea.js-edit-checklist-item
& .viewer
p
margin-bottom: 2px
+ display: block
+ word-wrap: break-word
+ max-width: 420px
.js-delete-checklist-item
margin: 0 0 0.5em 1.33em
diff --git a/client/components/cards/labels.styl b/client/components/cards/labels.styl
index 3b481d93..9d7c7553 100644
--- a/client/components/cards/labels.styl
+++ b/client/components/cards/labels.styl
@@ -10,9 +10,10 @@
margin-right: 4px
margin-bottom: 5px
padding: 3px 8px
- max-width: 100%
+ max-width: 210px
min-width: 8px
overflow: ellipsis
+ word-wrap: break-word
height: 18px
vertical-align: bottom
diff --git a/client/components/cards/minicard.styl b/client/components/cards/minicard.styl
index 242367b4..c4172572 100644
--- a/client/components/cards/minicard.styl
+++ b/client/components/cards/minicard.styl
@@ -81,6 +81,7 @@
.minicard-labels
float: right
display: flex
+ flex-wrap: wrap
.minicard-label
width: 11px
@@ -92,8 +93,11 @@
.minicard-custom-field
display:flex;
.minicard-custom-field-item
- max-width:50%;
- flex-grow:1;
+ flex-grow: 1
+ display: block
+ word-wrap: break-word
+ max-width: 100px
+ margin-right: 4px
.handle
width: 20px;
height: 20px;
@@ -111,7 +115,9 @@
p:last-child
margin-bottom: 0
.viewer
- display: inline-block
+ display: block
+ word-wrap: break-word
+ max-width: 230px
.dates
display: flex;
flex-direction: row;