Set drag handle on touch screen not miniscreen

This commit is contained in:
Repmovs 2022-08-12 17:21:45 +00:00
parent 61d2fd0308
commit d7bb0b4cc0
16 changed files with 214 additions and 223 deletions

View file

@ -193,7 +193,7 @@ BlazeComponent.extendComponent({
}); });
this.autorun(() => { this.autorun(() => {
if (Utils.isMiniScreenOrShowDesktopDragHandles()) { if (Utils.isTouchScreenOrShowDesktopDragHandles()) {
$swimlanesDom.sortable({ $swimlanesDom.sortable({
handle: '.js-swimlane-header-handle', handle: '.js-swimlane-header-handle',
}); });
@ -228,10 +228,10 @@ BlazeComponent.extendComponent({
} }
}, },
notDisplayThisBoard(){ notDisplayThisBoard() {
let allowPrivateVisibilityOnly = TableVisibilityModeSettings.findOne('tableVisibilityMode-allowPrivateOnly'); let allowPrivateVisibilityOnly = TableVisibilityModeSettings.findOne('tableVisibilityMode-allowPrivateOnly');
let currentBoard = Boards.findOne(Session.get('currentBoard')); let currentBoard = Boards.findOne(Session.get('currentBoard'));
if(allowPrivateVisibilityOnly !== undefined && allowPrivateVisibilityOnly.booleanValue && currentBoard.permission == 'public'){ if (allowPrivateVisibilityOnly !== undefined && allowPrivateVisibilityOnly.booleanValue && currentBoard.permission == 'public') {
return true; return true;
} }
@ -319,7 +319,7 @@ BlazeComponent.extendComponent({
BlazeComponent.extendComponent({ BlazeComponent.extendComponent({
onRendered() { onRendered() {
this.autorun(function() { this.autorun(function () {
$('#calendar-view').fullCalendar('refetchEvents'); $('#calendar-view').fullCalendar('refetchEvents');
}); });
}, },
@ -351,7 +351,7 @@ BlazeComponent.extendComponent({
events(start, end, timezone, callback) { events(start, end, timezone, callback) {
const currentBoard = Boards.findOne(Session.get('currentBoard')); const currentBoard = Boards.findOne(Session.get('currentBoard'));
const events = []; const events = [];
const pushEvent = function(card, title, start, end, extraCls) { const pushEvent = function (card, title, start, end, extraCls) {
start = start || card.startAt; start = start || card.startAt;
end = end || card.endAt; end = end || card.endAt;
title = title || card.title; title = title || card.title;
@ -375,12 +375,12 @@ BlazeComponent.extendComponent({
}; };
currentBoard currentBoard
.cardsInInterval(start.toDate(), end.toDate()) .cardsInInterval(start.toDate(), end.toDate())
.forEach(function(card) { .forEach(function (card) {
pushEvent(card); pushEvent(card);
}); });
currentBoard currentBoard
.cardsDueInBetween(start.toDate(), end.toDate()) .cardsDueInBetween(start.toDate(), end.toDate())
.forEach(function(card) { .forEach(function (card) {
pushEvent( pushEvent(
card, card,
`${card.title} ${TAPi18n.__('card-due')}`, `${card.title} ${TAPi18n.__('card-due')}`,
@ -388,7 +388,7 @@ BlazeComponent.extendComponent({
new Date(card.dueAt.getTime() + 36e5), new Date(card.dueAt.getTime() + 36e5),
); );
}); });
events.sort(function(first, second) { events.sort(function (first, second) {
return first.id > second.id ? 1 : -1; return first.id > second.id ? 1 : -1;
}); });
callback(events); callback(events);

View file

@ -62,7 +62,7 @@ template(name="boardList")
i.fa.js-has-spenttime-cards( i.fa.js-has-spenttime-cards(
class="fa-circle{{#if hasOvertimeCards}} has-overtime-card-active{{else}} no-overtime-card-active{{/if}}" class="fa-circle{{#if hasOvertimeCards}} has-overtime-card-active{{else}} no-overtime-card-active{{/if}}"
title="{{#if hasOvertimeCards}}{{_ 'has-overtime-cards'}}{{else}}{{_ 'has-spenttime-cards'}}{{/if}}") title="{{#if hasOvertimeCards}}{{_ 'has-overtime-cards'}}{{else}}{{_ 'has-spenttime-cards'}}{{/if}}")
if isMiniScreenOrShowDesktopDragHandles if isTouchScreenOrShowDesktopDragHandles
i.fa.board-handle( i.fa.board-handle(
class="fa-arrows" class="fa-arrows"
title="{{_ 'Drag board'}}") title="{{_ 'Drag board'}}")
@ -114,7 +114,7 @@ template(name="boardList")
i.fa.js-has-spenttime-cards( i.fa.js-has-spenttime-cards(
class="fa-circle{{#if hasOvertimeCards}} has-overtime-card-active{{else}} no-overtime-card-active{{/if}}" class="fa-circle{{#if hasOvertimeCards}} has-overtime-card-active{{else}} no-overtime-card-active{{/if}}"
title="{{#if hasOvertimeCards}}{{_ 'has-overtime-cards'}}{{else}}{{_ 'has-spenttime-cards'}}{{/if}}") title="{{#if hasOvertimeCards}}{{_ 'has-overtime-cards'}}{{else}}{{_ 'has-spenttime-cards'}}{{/if}}")
if isMiniScreenOrShowDesktopDragHandles if isTouchScreenOrShowDesktopDragHandles
i.fa.board-handle( i.fa.board-handle(
class="fa-arrows" class="fa-arrows"
title="{{_ 'Drag board'}}") title="{{_ 'Drag board'}}")

View file

@ -30,7 +30,7 @@ BlazeComponent.extendComponent({
Meteor.subscribe('tableVisibilityModeSettings'); Meteor.subscribe('tableVisibilityModeSettings');
let currUser = Meteor.user(); let currUser = Meteor.user();
let userLanguage; let userLanguage;
if(currUser && currUser.profile){ if (currUser && currUser.profile) {
userLanguage = currUser.profile.language userLanguage = currUser.profile.language
} }
if (userLanguage) { if (userLanguage) {
@ -79,54 +79,54 @@ BlazeComponent.extendComponent({
// Disable drag-dropping if the current user is not a board member or is comment only // Disable drag-dropping if the current user is not a board member or is comment only
this.autorun(() => { this.autorun(() => {
if (Utils.isMiniScreenOrShowDesktopDragHandles()) { if (Utils.isTouchScreenOrShowDesktopDragHandles()) {
$boards.sortable({ $boards.sortable({
handle: '.board-handle', handle: '.board-handle',
}); });
} }
}); });
}, },
userHasTeams(){ userHasTeams() {
if(Meteor.user() != null && Meteor.user().teams && Meteor.user().teams.length > 0) if (Meteor.user() != null && Meteor.user().teams && Meteor.user().teams.length > 0)
return true; return true;
else else
return false; return false;
}, },
teamsDatas() { teamsDatas() {
if(Meteor.user().teams) if (Meteor.user().teams)
return Meteor.user().teams.sort((a, b) => a.teamDisplayName.localeCompare(b.teamDisplayName)); return Meteor.user().teams.sort((a, b) => a.teamDisplayName.localeCompare(b.teamDisplayName));
else else
return []; return [];
}, },
userHasOrgs(){ userHasOrgs() {
if(Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0) if (Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
return true; return true;
else else
return false; return false;
}, },
/* /*
userHasTemplates(){ userHasTemplates(){
if(Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0) if(Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
return true; return true;
else else
return false; return false;
}, },
*/ */
orgsDatas() { orgsDatas() {
if(Meteor.user().orgs) if (Meteor.user().orgs)
return Meteor.user().orgs.sort((a, b) => a.orgDisplayName.localeCompare(b.orgDisplayName)); return Meteor.user().orgs.sort((a, b) => a.orgDisplayName.localeCompare(b.orgDisplayName));
else else
return []; return [];
}, },
userHasOrgsOrTeams(){ userHasOrgsOrTeams() {
let boolUserHasOrgs; let boolUserHasOrgs;
if(Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0) if (Meteor.user() != null && Meteor.user().orgs && Meteor.user().orgs.length > 0)
boolUserHasOrgs = true; boolUserHasOrgs = true;
else else
boolUserHasOrgs = false; boolUserHasOrgs = false;
let boolUserHasTeams; let boolUserHasTeams;
if(Meteor.user() != null && Meteor.user().teams && Meteor.user().teams.length > 0) if (Meteor.user() != null && Meteor.user().teams && Meteor.user().teams.length > 0)
boolUserHasTeams = true; boolUserHasTeams = true;
else else
boolUserHasTeams = false; boolUserHasTeams = false;
@ -139,18 +139,18 @@ BlazeComponent.extendComponent({
// { type: { $in: ['board','template-container'] } }, // { type: { $in: ['board','template-container'] } },
$and: [ $and: [
{ archived: false }, { archived: false },
{ type: { $in: ['board','template-container'] } }, { type: { $in: ['board', 'template-container'] } },
{ $or:[] } { $or: [] }
] ]
}; };
let allowPrivateVisibilityOnly = TableVisibilityModeSettings.findOne('tableVisibilityMode-allowPrivateOnly'); let allowPrivateVisibilityOnly = TableVisibilityModeSettings.findOne('tableVisibilityMode-allowPrivateOnly');
if (FlowRouter.getRouteName() === 'home'){ if (FlowRouter.getRouteName() === 'home') {
query.$and[2].$or.push({'members.userId': Meteor.userId()}); query.$and[2].$or.push({ 'members.userId': Meteor.userId() });
if(allowPrivateVisibilityOnly !== undefined && allowPrivateVisibilityOnly.booleanValue){ if (allowPrivateVisibilityOnly !== undefined && allowPrivateVisibilityOnly.booleanValue) {
query.$and.push({'permission': 'private'}); query.$and.push({ 'permission': 'private' });
} }
const currUser = Users.findOne(Meteor.userId()); const currUser = Users.findOne(Meteor.userId());
@ -162,27 +162,27 @@ BlazeComponent.extendComponent({
// }); // });
let orgIdsUserBelongs = currUser !== undefined && currUser.teams !== 'undefined' ? currUser.orgIdsUserBelongs() : ''; let orgIdsUserBelongs = currUser !== undefined && currUser.teams !== 'undefined' ? currUser.orgIdsUserBelongs() : '';
if(orgIdsUserBelongs && orgIdsUserBelongs != ''){ if (orgIdsUserBelongs && orgIdsUserBelongs != '') {
let orgsIds = orgIdsUserBelongs.split(','); let orgsIds = orgIdsUserBelongs.split(',');
// for(let i = 0; i < orgsIds.length; i++){ // for(let i = 0; i < orgsIds.length; i++){
// query.$and[2].$or.push({'orgs.orgId': orgsIds[i]}); // query.$and[2].$or.push({'orgs.orgId': orgsIds[i]});
// } // }
//query.$and[2].$or.push({'orgs': {$elemMatch : {orgId: orgsIds[0]}}}); //query.$and[2].$or.push({'orgs': {$elemMatch : {orgId: orgsIds[0]}}});
query.$and[2].$or.push({'orgs.orgId': {$in : orgsIds}}); query.$and[2].$or.push({ 'orgs.orgId': { $in: orgsIds } });
} }
let teamIdsUserBelongs = currUser !== undefined && currUser.teams !== 'undefined' ? currUser.teamIdsUserBelongs() : ''; let teamIdsUserBelongs = currUser !== undefined && currUser.teams !== 'undefined' ? currUser.teamIdsUserBelongs() : '';
if(teamIdsUserBelongs && teamIdsUserBelongs != ''){ if (teamIdsUserBelongs && teamIdsUserBelongs != '') {
let teamsIds = teamIdsUserBelongs.split(','); let teamsIds = teamIdsUserBelongs.split(',');
// for(let i = 0; i < teamsIds.length; i++){ // for(let i = 0; i < teamsIds.length; i++){
// query.$or[2].$or.push({'teams.teamId': teamsIds[i]}); // query.$or[2].$or.push({'teams.teamId': teamsIds[i]});
// } // }
//query.$and[2].$or.push({'teams': { $elemMatch : {teamId: teamsIds[0]}}}); //query.$and[2].$or.push({'teams': { $elemMatch : {teamId: teamsIds[0]}}});
query.$and[2].$or.push({'teams.teamId': {$in : teamsIds}}); query.$and[2].$or.push({ 'teams.teamId': { $in: teamsIds } });
} }
} }
else if(allowPrivateVisibilityOnly !== undefined && !allowPrivateVisibilityOnly.booleanValue){ else if (allowPrivateVisibilityOnly !== undefined && !allowPrivateVisibilityOnly.booleanValue) {
query = { query = {
archived: false, archived: false,
//type: { $in: ['board','template-container'] }, //type: { $in: ['board','template-container'] },
@ -197,9 +197,9 @@ BlazeComponent.extendComponent({
}, },
boardLists(boardId) { boardLists(boardId) {
let boardLists = []; let boardLists = [];
const lists = Lists.find({'boardId' : boardId, 'archived': false}) const lists = Lists.find({ 'boardId': boardId, 'archived': false })
lists.forEach(list => { lists.forEach(list => {
let cardCount = Cards.find({'boardId':boardId, 'listId':list._id}).count() let cardCount = Cards.find({ 'boardId': boardId, 'listId': list._id }).count()
boardLists.push(`${list.title}: ${cardCount}`); boardLists.push(`${list.title}: ${cardCount}`);
}); });
return boardLists return boardLists
@ -207,7 +207,7 @@ BlazeComponent.extendComponent({
boardMembers(boardId) { boardMembers(boardId) {
let boardMembers = []; let boardMembers = [];
const lists = Boards.findOne({'_id' : boardId}) const lists = Boards.findOne({ '_id': boardId })
let members = lists.members let members = lists.members
members.forEach(member => { members.forEach(member => {
boardMembers.push(member.userId); boardMembers.push(member.userId);
@ -291,10 +291,10 @@ BlazeComponent.extendComponent({
} }
}); });
}, },
'click #resetBtn'(event){ 'click #resetBtn'(event) {
let allBoards = document.getElementsByClassName("js-board"); let allBoards = document.getElementsByClassName("js-board");
let currBoard; let currBoard;
for(let i=0; i < allBoards.length; i++){ for (let i = 0; i < allBoards.length; i++) {
currBoard = allBoards[i]; currBoard = allBoards[i];
currBoard.style.display = "block"; currBoard.style.display = "block";
} }
@ -302,57 +302,55 @@ BlazeComponent.extendComponent({
'click #filterBtn'(event) { 'click #filterBtn'(event) {
event.preventDefault(); event.preventDefault();
let selectedTeams = document.querySelectorAll('#jsAllBoardTeams option:checked'); let selectedTeams = document.querySelectorAll('#jsAllBoardTeams option:checked');
let selectedTeamsValues = Array.from(selectedTeams).map(function(elt){return elt.value}); let selectedTeamsValues = Array.from(selectedTeams).map(function (elt) { return elt.value });
let index = selectedTeamsValues.indexOf("-1"); let index = selectedTeamsValues.indexOf("-1");
if (index > -1) { if (index > -1) {
selectedTeamsValues.splice(index, 1); selectedTeamsValues.splice(index, 1);
} }
let selectedOrgs = document.querySelectorAll('#jsAllBoardOrgs option:checked'); let selectedOrgs = document.querySelectorAll('#jsAllBoardOrgs option:checked');
let selectedOrgsValues = Array.from(selectedOrgs).map(function(elt){return elt.value}); let selectedOrgsValues = Array.from(selectedOrgs).map(function (elt) { return elt.value });
index = selectedOrgsValues.indexOf("-1"); index = selectedOrgsValues.indexOf("-1");
if (index > -1) { if (index > -1) {
selectedOrgsValues.splice(index, 1); selectedOrgsValues.splice(index, 1);
} }
if(selectedTeamsValues.length > 0 || selectedOrgsValues.length > 0){ if (selectedTeamsValues.length > 0 || selectedOrgsValues.length > 0) {
const query = { const query = {
$and: [ $and: [
{ archived: false }, { archived: false },
{ type: 'board' }, { type: 'board' },
{ $or:[] } { $or: [] }
] ]
}; };
if(selectedTeamsValues.length > 0) if (selectedTeamsValues.length > 0) {
{ query.$and[2].$or.push({ 'teams.teamId': { $in: selectedTeamsValues } });
query.$and[2].$or.push({'teams.teamId': {$in : selectedTeamsValues}});
} }
if(selectedOrgsValues.length > 0) if (selectedOrgsValues.length > 0) {
{ query.$and[2].$or.push({ 'orgs.orgId': { $in: selectedOrgsValues } });
query.$and[2].$or.push({'orgs.orgId': {$in : selectedOrgsValues}});
} }
let filteredBoards = Boards.find(query, {}).fetch(); let filteredBoards = Boards.find(query, {}).fetch();
let allBoards = document.getElementsByClassName("js-board"); let allBoards = document.getElementsByClassName("js-board");
let currBoard; let currBoard;
if(filteredBoards.length > 0){ if (filteredBoards.length > 0) {
let currBoardId; let currBoardId;
let found; let found;
for(let i=0; i < allBoards.length; i++){ for (let i = 0; i < allBoards.length; i++) {
currBoard = allBoards[i]; currBoard = allBoards[i];
currBoardId = currBoard.classList[0]; currBoardId = currBoard.classList[0];
found = filteredBoards.find(function(board){ found = filteredBoards.find(function (board) {
return board._id == currBoardId; return board._id == currBoardId;
}); });
if(found !== undefined) if (found !== undefined)
currBoard.style.display = "block"; currBoard.style.display = "block";
else else
currBoard.style.display = "none"; currBoard.style.display = "none";
} }
} }
else{ else {
for(let i=0; i < allBoards.length; i++){ for (let i = 0; i < allBoards.length; i++) {
currBoard = allBoards[i]; currBoard = allBoards[i];
currBoard.style.display = "none"; currBoard.style.display = "none";
} }

View file

@ -87,27 +87,27 @@ BlazeComponent.extendComponent({
const cardPanelWidth = 600; const cardPanelWidth = 600;
const parentComponent = this.parentComponent(); const parentComponent = this.parentComponent();
/* /*
// Incomplete fix about bug where opening card scrolls to wrong place // Incomplete fix about bug where opening card scrolls to wrong place
// https://github.com/wekan/wekan/issues/4572#issuecomment-1184149395 // https://github.com/wekan/wekan/issues/4572#issuecomment-1184149395
// TODO sometimes parentComponent is not available, maybe because it's not // TODO sometimes parentComponent is not available, maybe because it's not
// yet created?! // yet created?!
if (!parentComponent) return; if (!parentComponent) return;
const bodyBoardComponent = parentComponent.parentComponent(); const bodyBoardComponent = parentComponent.parentComponent();
*/ */
//On Mobile View Parent is Board, Not Board Body. I cant see how this funciton should work then. //On Mobile View Parent is Board, Not Board Body. I cant see how this funciton should work then.
if (bodyBoardComponent === null) return; if (bodyBoardComponent === null) return;
const $cardView = this.$(this.firstNode()); const $cardView = this.$(this.firstNode());
const $cardContainer = bodyBoardComponent.$('.js-swimlanes'); const $cardContainer = bodyBoardComponent.$('.js-swimlanes');
/* /*
// Incomplete fix about bug where opening card scrolls to wrong place // Incomplete fix about bug where opening card scrolls to wrong place
// https://github.com/wekan/wekan/issues/4572#issuecomment-1184149395 // https://github.com/wekan/wekan/issues/4572#issuecomment-1184149395
// TODO sometimes cardContainer is not available, maybe because it's not yet // TODO sometimes cardContainer is not available, maybe because it's not yet
// created?! // created?!
if (!$cardContainer) return; if (!$cardContainer) return;
*/ */
const cardContainerScroll = $cardContainer.scrollLeft(); const cardContainerScroll = $cardContainer.scrollLeft();
const cardContainerWidth = $cardContainer.width(); const cardContainerWidth = $cardContainer.width();
@ -306,7 +306,7 @@ BlazeComponent.extendComponent({
$checklistsDom.data('sortable') $checklistsDom.data('sortable')
) { ) {
$checklistsDom.sortable('option', 'disabled', disabled); $checklistsDom.sortable('option', 'disabled', disabled);
if (Utils.isMiniScreenOrShowDesktopDragHandles()) { if (Utils.isTouchScreenOrShowDesktopDragHandles()) {
$checklistsDom.sortable({ handle: '.checklist-handle' }); $checklistsDom.sortable({ handle: '.checklist-handle' });
} }
} }
@ -866,9 +866,9 @@ BlazeComponent.extendComponent({
*/ */
setMoveAndCopyDialogOption(boardId) { setMoveAndCopyDialogOption(boardId) {
this.moveAndCopyDialogOption = { this.moveAndCopyDialogOption = {
'boardId' : "", 'boardId': "",
'swimlaneId' : "", 'swimlaneId': "",
'listId' : "", 'listId': "",
} }
let currentOptions = Meteor.user().getMoveAndCopyDialogOptions(); let currentOptions = Meteor.user().getMoveAndCopyDialogOptions();
@ -945,9 +945,9 @@ BlazeComponent.extendComponent({
const swimlaneId = swimlaneSelect.options[swimlaneSelect.selectedIndex].value; const swimlaneId = swimlaneSelect.options[swimlaneSelect.selectedIndex].value;
const options = { const options = {
'boardId' : boardId, 'boardId': boardId,
'swimlaneId' : swimlaneId, 'swimlaneId': swimlaneId,
'listId' : listId, 'listId': listId,
} }
Meteor.user().setMoveAndCopyDialogOption(this.currentBoardId, options); Meteor.user().setMoveAndCopyDialogOption(this.currentBoardId, options);
}, },
@ -1728,16 +1728,14 @@ EscapeActions.register(
() => { () => {
// if card description diverges from database due to editing // if card description diverges from database due to editing
// ask user whether changes should be applied // ask user whether changes should be applied
if(currentUser.profile.rescueCardDescription== true) if (currentUser.profile.rescueCardDescription == true) {
{
currentDescription = document.getElementsByClassName("editor js-new-description-input").item(0) currentDescription = document.getElementsByClassName("editor js-new-description-input").item(0)
if (currentDescription?.value && !(currentDescription.value === Utils.getCurrentCard().getDescription())) if (currentDescription?.value && !(currentDescription.value === Utils.getCurrentCard().getDescription())) {
{
if (confirm(TAPi18n.__('rescue-card-description-dialogue'))) { if (confirm(TAPi18n.__('rescue-card-description-dialogue'))) {
Utils.getCurrentCard().setDescription(document.getElementsByClassName("editor js-new-description-input").item(0).value); Utils.getCurrentCard().setDescription(document.getElementsByClassName("editor js-new-description-input").item(0).value);
// Save it! // Save it!
console.log(document.getElementsByClassName("editor js-new-description-input").item(0).value); console.log(document.getElementsByClassName("editor js-new-description-input").item(0).value);
console.log("current description",Utils.getCurrentCard().getDescription()); console.log("current description", Utils.getCurrentCard().getDescription());
} else { } else {
// Do nothing! // Do nothing!
console.log('Description changes were not saved to the database.'); console.log('Description changes were not saved to the database.');
@ -1824,7 +1822,7 @@ Template.cardAssigneePopup.helpers({
return user && user.isBoardAdmin() ? 'admin' : 'normal'; return user && user.isBoardAdmin() ? 'admin' : 'normal';
}, },
/* /*
presenceStatusClassName() { presenceStatusClassName() {
const user = Users.findOne(this.userId); const user = Users.findOne(this.userId);
const userPresence = presences.findOne({ userId: this.userId }); const userPresence = presences.findOne({ userId: this.userId });
@ -1834,7 +1832,7 @@ Template.cardAssigneePopup.helpers({
return 'active'; return 'active';
else return 'idle'; else return 'idle';
}, },
*/ */
isCardAssignee() { isCardAssignee() {
const card = Template.parentData(); const card = Template.parentData();
const cardAssignees = card.getAssignees(); const cardAssignees = card.getAssignees();

View file

@ -35,7 +35,7 @@ template(name="checklistDetail")
if canModifyCard if canModifyCard
h2.title.js-open-inlined-form.is-editable h2.title.js-open-inlined-form.is-editable
if isMiniScreenOrShowDesktopDragHandles if isTouchScreenOrShowDesktopDragHandles
span.fa.checklist-handle(class="fa-arrows" title="{{_ 'dragChecklist'}}") span.fa.checklist-handle(class="fa-arrows" title="{{_ 'dragChecklist'}}")
+viewer +viewer
= checklist.title = checklist.title
@ -104,7 +104,7 @@ template(name='checklistItemDetail')
if canModifyCard if canModifyCard
.check-box-container .check-box-container
.check-box.materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}") .check-box.materialCheckBox(class="{{#if item.isFinished }}is-checked{{/if}}")
if isMiniScreenOrShowDesktopDragHandles if isTouchScreenOrShowDesktopDragHandles
span.fa.checklistitem-handle(class="fa-arrows" title="{{_ 'dragChecklistItem'}}") span.fa.checklistitem-handle(class="fa-arrows" title="{{_ 'dragChecklistItem'}}")
.item-title.js-open-inlined-form.is-editable(class="{{#if item.isFinished }}is-checked{{/if}}") .item-title.js-open-inlined-form.is-editable(class="{{#if item.isFinished }}is-checked{{/if}}")
+viewer +viewer

View file

@ -48,7 +48,7 @@ BlazeComponent.extendComponent({
const self = this; const self = this;
self.itemsDom = this.$('.js-checklist-items'); self.itemsDom = this.$('.js-checklist-items');
initSorting(self.itemsDom); initSorting(self.itemsDom);
self.itemsDom.mousedown(function(evt) { self.itemsDom.mousedown(function (evt) {
evt.stopPropagation(); evt.stopPropagation();
}); });
@ -61,7 +61,7 @@ BlazeComponent.extendComponent({
const $itemsDom = $(self.itemsDom); const $itemsDom = $(self.itemsDom);
if ($itemsDom.data('uiSortable') || $itemsDom.data('sortable')) { if ($itemsDom.data('uiSortable') || $itemsDom.data('sortable')) {
$(self.itemsDom).sortable('option', 'disabled', !userIsMember()); $(self.itemsDom).sortable('option', 'disabled', !userIsMember());
if (Utils.isMiniScreenOrShowDesktopDragHandles()) { if (Utils.isTouchScreenOrShowDesktopDragHandles()) {
$(self.itemsDom).sortable({ $(self.itemsDom).sortable({
handle: 'span.fa.checklistitem-handle', handle: 'span.fa.checklistitem-handle',
}); });
@ -306,15 +306,15 @@ BlazeComponent.extendComponent({
events() { events() {
return [ return [
{ {
'click .js-delete-checklist' : Popup.afterConfirm('checklistDelete', function () { 'click .js-delete-checklist': Popup.afterConfirm('checklistDelete', function () {
Popup.back(2); Popup.back(2);
const checklist = this.checklist; const checklist = this.checklist;
if (checklist && checklist._id) { if (checklist && checklist._id) {
Checklists.remove(checklist._id); Checklists.remove(checklist._id);
} }
}), }),
'click .js-move-checklist' : Popup.open('moveChecklist'), 'click .js-move-checklist': Popup.open('moveChecklist'),
'click .js-copy-checklist' : Popup.open('copyChecklist'), 'click .js-copy-checklist': Popup.open('copyChecklist'),
} }
] ]
} }
@ -407,9 +407,9 @@ class DialogWithBoardSwimlaneListAndCard extends BlazeComponent {
*/ */
setChecklistDialogOption(boardId) { setChecklistDialogOption(boardId) {
this.checklistDialogOption = { this.checklistDialogOption = {
'boardId' : "", 'boardId': "",
'swimlaneId' : "", 'swimlaneId': "",
'listId' : "", 'listId': "",
'cardId': "", 'cardId': "",
} }
@ -419,18 +419,17 @@ class DialogWithBoardSwimlaneListAndCard extends BlazeComponent {
if (this.checklistDialogOption.boardId && if (this.checklistDialogOption.boardId &&
this.checklistDialogOption.swimlaneId && this.checklistDialogOption.swimlaneId &&
this.checklistDialogOption.listId this.checklistDialogOption.listId
) ) {
{
this.selectedBoardId.set(this.checklistDialogOption.boardId) this.selectedBoardId.set(this.checklistDialogOption.boardId)
this.selectedSwimlaneId.set(this.checklistDialogOption.swimlaneId); this.selectedSwimlaneId.set(this.checklistDialogOption.swimlaneId);
this.selectedListId.set(this.checklistDialogOption.listId); this.selectedListId.set(this.checklistDialogOption.listId);
} }
} }
this.getBoardData(this.selectedBoardId.get()); this.getBoardData(this.selectedBoardId.get());
if (!this.selectedSwimlaneId.get() || !Swimlanes.findOne({_id: this.selectedSwimlaneId.get(), boardId: this.selectedBoardId.get()})) { if (!this.selectedSwimlaneId.get() || !Swimlanes.findOne({ _id: this.selectedSwimlaneId.get(), boardId: this.selectedBoardId.get() })) {
this.setFirstSwimlaneId(); this.setFirstSwimlaneId();
} }
if (!this.selectedListId.get() || !Lists.findOne({_id: this.selectedListId.get(), boardId: this.selectedBoardId.get()})) { if (!this.selectedListId.get() || !Lists.findOne({ _id: this.selectedListId.get(), boardId: this.selectedBoardId.get() })) {
this.setFirstListId(); this.setFirstListId();
} }
} }
@ -440,7 +439,7 @@ class DialogWithBoardSwimlaneListAndCard extends BlazeComponent {
const board = Boards.findOne(this.selectedBoardId.get()); const board = Boards.findOne(this.selectedBoardId.get());
const swimlaneId = board.swimlanes().fetch()[0]._id; const swimlaneId = board.swimlanes().fetch()[0]._id;
this.selectedSwimlaneId.set(swimlaneId); this.selectedSwimlaneId.set(swimlaneId);
} catch (e) {} } catch (e) { }
} }
/** sets the first list id */ /** sets the first list id */
setFirstListId() { setFirstListId() {
@ -448,7 +447,7 @@ class DialogWithBoardSwimlaneListAndCard extends BlazeComponent {
const board = Boards.findOne(this.selectedBoardId.get()); const board = Boards.findOne(this.selectedBoardId.get());
const listId = board.lists().fetch()[0]._id; const listId = board.lists().fetch()[0]._id;
this.selectedListId.set(listId); this.selectedListId.set(listId);
} catch (e) {} } catch (e) { }
} }
/** returns if the board id was the last confirmed one /** returns if the board id was the last confirmed one
@ -561,9 +560,9 @@ class DialogWithBoardSwimlaneListAndCard extends BlazeComponent {
const cardId = cardSelect.options[cardSelect.selectedIndex].value; const cardId = cardSelect.options[cardSelect.selectedIndex].value;
const options = { const options = {
'boardId' : boardId, 'boardId': boardId,
'swimlaneId' : swimlaneId, 'swimlaneId': swimlaneId,
'listId' : listId, 'listId': listId,
'cardId': cardId, 'cardId': cardId,
} }
this.setDone(cardId, options); this.setDone(cardId, options);

View file

@ -29,7 +29,7 @@ template(name="cardLabelsPopup")
each board.labels each board.labels
li.js-card-label-item li.js-card-label-item
a.card-label-edit-button.fa.fa-pencil.js-edit-label a.card-label-edit-button.fa.fa-pencil.js-edit-label
if isMiniScreenOrShowDesktopDragHandles if isTouchScreenOrShowDesktopDragHandles
span.fa.label-handle(class="fa-arrows" title="{{_ 'dragLabel'}}") span.fa.label-handle(class="fa-arrows" title="{{_ 'dragLabel'}}")
span.card-label.card-label-selectable.js-select-label.card-label-wrapper(class="card-label-{{color}}" span.card-label.card-label-selectable.js-select-label.card-label-wrapper(class="card-label-{{color}}"
class="{{# if isLabelSelected ../_id }}active{{/if}}") class="{{# if isLabelSelected ../_id }}active{{/if}}")

View file

@ -50,8 +50,7 @@ BlazeComponent.extendComponent({
appendTo: '.edit-labels-pop-over', appendTo: '.edit-labels-pop-over',
helper(element, currentItem) { helper(element, currentItem) {
let ret = currentItem.clone(); let ret = currentItem.clone();
if (currentItem.closest('.popup-container-depth-0').size() == 0) if (currentItem.closest('.popup-container-depth-0').size() == 0) { // only set css transform at every sub-popup, not at the main popup
{ // only set css transform at every sub-popup, not at the main popup
const content = currentItem.closest('.content')[0] const content = currentItem.closest('.content')[0]
const offsetLeft = content.offsetLeft; const offsetLeft = content.offsetLeft;
const offsetTop = $('.pop-over > .header').height() * -1; const offsetTop = $('.pop-over > .header').height() * -1;
@ -76,7 +75,7 @@ BlazeComponent.extendComponent({
// Disable drag-dropping if the current user is not a board member or is comment only // Disable drag-dropping if the current user is not a board member or is comment only
this.autorun(() => { this.autorun(() => {
if (Utils.isMiniScreenOrShowDesktopDragHandles()) { if (Utils.isTouchScreenOrShowDesktopDragHandles()) {
$labels.sortable({ $labels.sortable({
handle: '.label-handle', handle: '.label-handle',
}); });
@ -130,7 +129,7 @@ Template.createLabelPopup.events({
}); });
Template.editLabelPopup.events({ Template.editLabelPopup.events({
'click .js-delete-label': Popup.afterConfirm('deleteLabel', function() { 'click .js-delete-label': Popup.afterConfirm('deleteLabel', function () {
const board = Boards.findOne(Session.get('currentBoard')); const board = Boards.findOne(Session.get('currentBoard'));
board.removeLabel(this._id); board.removeLabel(this._id);
Popup.back(2); Popup.back(2);

View file

@ -3,7 +3,7 @@ template(name="minicard")
class="{{#if isLinkedCard}}linked-card{{/if}}" class="{{#if isLinkedCard}}linked-card{{/if}}"
class="{{#if isLinkedBoard}}linked-board{{/if}}" class="{{#if isLinkedBoard}}linked-board{{/if}}"
class="{{#if colorClass}}minicard-{{colorClass}}{{/if}}") class="{{#if colorClass}}minicard-{{colorClass}}{{/if}}")
if isMiniScreenOrShowDesktopDragHandles if isTouchScreenOrShowDesktopDragHandles
.handle .handle
.fa.fa-arrows .fa.fa-arrows
if cover if cover

View file

@ -96,7 +96,7 @@ BlazeComponent.extendComponent({
$cards.sortable('cancel'); $cards.sortable('cancel');
if (MultiSelection.isActive()) { if (MultiSelection.isActive()) {
Cards.find(MultiSelection.getMongoSelector(), {sort: ['sort']}).forEach((card, i) => { Cards.find(MultiSelection.getMongoSelector(), { sort: ['sort'] }).forEach((card, i) => {
const newSwimlaneId = targetSwimlaneId const newSwimlaneId = targetSwimlaneId
? targetSwimlaneId ? targetSwimlaneId
: card.swimlaneId || defaultSwimlaneId; : card.swimlaneId || defaultSwimlaneId;
@ -121,27 +121,23 @@ BlazeComponent.extendComponent({
const $boardCanvas = $('.board-canvas'); const $boardCanvas = $('.board-canvas');
const boardCanvas = $boardCanvas[0]; const boardCanvas = $boardCanvas[0];
if (event.pageX < 10) if (event.pageX < 10) { // scroll to the left
{ // scroll to the left
boardCanvas.scrollLeft -= 15; boardCanvas.scrollLeft -= 15;
ui.helper[0].offsetLeft -= 15; ui.helper[0].offsetLeft -= 15;
} }
if ( if (
event.pageX > boardCanvas.offsetWidth - 10 && event.pageX > boardCanvas.offsetWidth - 10 &&
boardCanvas.scrollLeft < $boardCanvas.data('scrollLeftMax') // don't scroll more than possible boardCanvas.scrollLeft < $boardCanvas.data('scrollLeftMax') // don't scroll more than possible
) ) { // scroll to the right
{ // scroll to the right
boardCanvas.scrollLeft += 15; boardCanvas.scrollLeft += 15;
} }
if ( if (
event.pageY > boardCanvas.offsetHeight - 10 && event.pageY > boardCanvas.offsetHeight - 10 &&
event.pageY + boardCanvas.scrollTop < $boardCanvas.data('scrollTopMax') // don't scroll more than possible event.pageY + boardCanvas.scrollTop < $boardCanvas.data('scrollTopMax') // don't scroll more than possible
) ) { // scroll to the bottom
{ // scroll to the bottom
boardCanvas.scrollTop += 15; boardCanvas.scrollTop += 15;
} }
if (event.pageY < 10) if (event.pageY < 10) { // scroll to the top
{ // scroll to the top
boardCanvas.scrollTop -= 15; boardCanvas.scrollTop -= 15;
} }
}, },
@ -157,7 +153,7 @@ BlazeComponent.extendComponent({
}); });
this.autorun(() => { this.autorun(() => {
if (Utils.isMiniScreenOrShowDesktopDragHandles()) { if (Utils.isTouchScreenOrShowDesktopDragHandles()) {
$cards.sortable({ $cards.sortable({
handle: '.handle', handle: '.handle',
}); });

View file

@ -44,7 +44,7 @@ template(name="listHeader")
a.js-add-card.fa.fa-plus.list-header-plus-top(title="{{_ 'add-card-to-top-of-list'}}") a.js-add-card.fa.fa-plus.list-header-plus-top(title="{{_ 'add-card-to-top-of-list'}}")
a.fa.fa-navicon.js-open-list-menu(title="{{_ 'listActionPopup-title'}}") a.fa.fa-navicon.js-open-list-menu(title="{{_ 'listActionPopup-title'}}")
if currentUser.isBoardAdmin if currentUser.isBoardAdmin
if isShowDesktopDragHandles if isTouchScreenOrShowDesktopDragHandles
a.list-header-handle.handle.fa.fa-arrows.js-list-handle a.list-header-handle.handle.fa.fa-arrows.js-list-handle
template(name="editListTitleForm") template(name="editListTitleForm")

View file

@ -25,10 +25,10 @@ template(name="swimlaneFixedHeader")
if currentUser.isBoardAdmin if currentUser.isBoardAdmin
a.fa.fa-plus.js-open-add-swimlane-menu.swimlane-header-plus-icon(title="{{_ 'add-swimlane'}}") a.fa.fa-plus.js-open-add-swimlane-menu.swimlane-header-plus-icon(title="{{_ 'add-swimlane'}}")
a.fa.fa-navicon.js-open-swimlane-menu(title="{{_ 'swimlaneActionPopup-title'}}") a.fa.fa-navicon.js-open-swimlane-menu(title="{{_ 'swimlaneActionPopup-title'}}")
unless isMiniScreen unless isTouchScreen
if isShowDesktopDragHandles if isShowDesktopDragHandles
a.swimlane-header-handle.handle.fa.fa-arrows.js-swimlane-header-handle a.swimlane-header-handle.handle.fa.fa-arrows.js-swimlane-header-handle
if isMiniScreen if isTouchScreen
a.swimlane-header-miniscreen-handle.handle.fa.fa-arrows.js-swimlane-header-handle a.swimlane-header-miniscreen-handle.handle.fa.fa-arrows.js-swimlane-header-handle
template(name="editSwimlaneTitleForm") template(name="editSwimlaneTitleForm")

View file

@ -85,14 +85,14 @@ function initSortable(boardComponent, $listsDom) {
const listDomElement = ui.item.get(0); const listDomElement = ui.item.get(0);
const list = Blaze.getData(listDomElement); const list = Blaze.getData(listDomElement);
/* /*
Reverted incomplete change list width, Reverted incomplete change list width,
removed from below Lists.update: removed from below Lists.update:
https://github.com/wekan/wekan/issues/4558 https://github.com/wekan/wekan/issues/4558
$set: { $set: {
width: list._id.width(), width: list._id.width(),
height: list._id.height(), height: list._id.height(),
*/ */
Lists.update(list._id, { Lists.update(list._id, {
$set: { $set: {
@ -114,7 +114,7 @@ function initSortable(boardComponent, $listsDom) {
//} //}
boardComponent.autorun(() => { boardComponent.autorun(() => {
if (Utils.isMiniScreenOrShowDesktopDragHandles()) { if (Utils.isTouchScreenOrShowDesktopDragHandles()) {
$listsDom.sortable({ $listsDom.sortable({
handle: '.js-list-handle', handle: '.js-list-handle',
}); });
@ -200,7 +200,7 @@ BlazeComponent.extendComponent({
// his mouse. // his mouse.
const noDragInside = ['a', 'input', 'textarea', 'p'].concat( const noDragInside = ['a', 'input', 'textarea', 'p'].concat(
Utils.isMiniScreenOrShowDesktopDragHandles() Utils.isTouchScreenOrShowDesktopDragHandles()
? ['.js-list-handle', '.js-swimlane-header-handle'] ? ['.js-list-handle', '.js-swimlane-header-handle']
: ['.js-list-header'], : ['.js-list-header'],
); );

View file

@ -27,12 +27,14 @@ Blaze.registerHelper('concat', (...args) => args.slice(0, -1).join(''));
Blaze.registerHelper('isMiniScreen', () => Utils.isMiniScreen()); Blaze.registerHelper('isMiniScreen', () => Utils.isMiniScreen());
Blaze.registerHelper('isTouchScreen', () => Utils.isTouchScreen());
Blaze.registerHelper('isShowDesktopDragHandles', () => Blaze.registerHelper('isShowDesktopDragHandles', () =>
Utils.isShowDesktopDragHandles(), Utils.isShowDesktopDragHandles(),
); );
Blaze.registerHelper('isMiniScreenOrShowDesktopDragHandles', () => Blaze.registerHelper('isTouchScreenOrShowDesktopDragHandles', () =>
Utils.isMiniScreenOrShowDesktopDragHandles(), Utils.isTouchScreenOrShowDesktopDragHandles(),
); );
Blaze.registerHelper('moment', (...args) => { Blaze.registerHelper('moment', (...args) => {

View file

@ -5,20 +5,20 @@ import { Random } from 'meteor/random';
import '../utils'; import '../utils';
describe('Utils', function() { describe('Utils', function () {
beforeEach(function() { beforeEach(function () {
sinon.stub(Utils, 'reload').callsFake(() => {}); sinon.stub(Utils, 'reload').callsFake(() => { });
}); });
afterEach(function() { afterEach(function () {
window.localStorage.removeItem(boardView); window.localStorage.removeItem(boardView);
sinon.restore(); sinon.restore();
}); });
const boardView = 'boardView'; const boardView = 'boardView';
describe(Utils.setBoardView.name, function() { describe(Utils.setBoardView.name, function () {
it('sets the board view if the user exists', function(done) { it('sets the board view if the user exists', function (done) {
const viewId = Random.id(); const viewId = Random.id();
const user = { const user = {
setBoardView: (view) => { setBoardView: (view) => {
@ -32,14 +32,14 @@ describe('Utils', function() {
expect(window.localStorage.getItem(boardView)).to.equal(viewId); expect(window.localStorage.getItem(boardView)).to.equal(viewId);
}); });
it('sets a specific view if no user exists but a view is defined', function() { it('sets a specific view if no user exists but a view is defined', function () {
const views = [ const views = [
'board-view-swimlanes', 'board-view-swimlanes',
'board-view-lists', 'board-view-lists',
'board-view-cal' 'board-view-cal'
]; ];
sinon.stub(Meteor, 'user').callsFake(() => {}); sinon.stub(Meteor, 'user').callsFake(() => { });
views.forEach(viewName => { views.forEach(viewName => {
Utils.setBoardView(viewName); Utils.setBoardView(viewName);
@ -47,15 +47,15 @@ describe('Utils', function() {
}); });
}); });
it('sets a default view if no user and no view are given', function() { it('sets a default view if no user and no view are given', function () {
sinon.stub(Meteor, 'user').callsFake(() => {}); sinon.stub(Meteor, 'user').callsFake(() => { });
Utils.setBoardView(); Utils.setBoardView();
expect(window.localStorage.getItem(boardView)).to.equal('board-view-swimlanes'); expect(window.localStorage.getItem(boardView)).to.equal('board-view-swimlanes');
}); });
}); });
describe(Utils.unsetBoardView.name, function() { describe(Utils.unsetBoardView.name, function () {
it('removes the boardview from localStoage', function() { it('removes the boardview from localStoage', function () {
window.localStorage.setItem(boardView, Random.id()); window.localStorage.setItem(boardView, Random.id());
window.localStorage.setItem('collapseSwimlane', Random.id()); window.localStorage.setItem('collapseSwimlane', Random.id());
@ -66,8 +66,8 @@ describe('Utils', function() {
}); });
}); });
describe(Utils.boardView.name, function() { describe(Utils.boardView.name, function () {
it('returns the user\'s board view if a user exists', function() { it('returns the user\'s board view if a user exists', function () {
const viewId = Random.id(); const viewId = Random.id();
const user = {}; const user = {};
sinon.stub(Meteor, 'user').callsFake(() => user); sinon.stub(Meteor, 'user').callsFake(() => user);
@ -78,108 +78,108 @@ describe('Utils', function() {
expect(Utils.boardView()).to.equal(boardView); expect(Utils.boardView()).to.equal(boardView);
}); });
it('returns the current defined view', function() { it('returns the current defined view', function () {
const views = [ const views = [
'board-view-swimlanes', 'board-view-swimlanes',
'board-view-lists', 'board-view-lists',
'board-view-cal' 'board-view-cal'
]; ];
sinon.stub(Meteor, 'user').callsFake(() => {}); sinon.stub(Meteor, 'user').callsFake(() => { });
views.forEach(viewName => { views.forEach(viewName => {
window.localStorage.setItem(boardView, viewName); window.localStorage.setItem(boardView, viewName);
expect(Utils.boardView()).to.equal(viewName); expect(Utils.boardView()).to.equal(viewName);
}); });
}); });
it('returns a default if nothing is set', function() { it('returns a default if nothing is set', function () {
sinon.stub(Meteor, 'user').callsFake(() => {}); sinon.stub(Meteor, 'user').callsFake(() => { });
expect(Utils.boardView()).to.equal('board-view-swimlanes'); expect(Utils.boardView()).to.equal('board-view-swimlanes');
expect(window.localStorage.getItem(boardView)).to.equal('board-view-swimlanes'); expect(window.localStorage.getItem(boardView)).to.equal('board-view-swimlanes');
}); });
}); });
describe(Utils.myCardsSort.name, function() { describe(Utils.myCardsSort.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.myCardsSortToggle.name, function() { describe(Utils.myCardsSortToggle.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.setMyCardsSort.name, function() { describe(Utils.setMyCardsSort.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.archivedBoardIds.name, function() { describe(Utils.archivedBoardIds.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.dueCardsView.name, function() { describe(Utils.dueCardsView.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.setDueCardsView.name, function() { describe(Utils.setDueCardsView.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.goBoardId.name, function() { describe(Utils.goBoardId.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.goCardId.name, function() { describe(Utils.goCardId.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.processUploadedAttachment.name, function() { describe(Utils.processUploadedAttachment.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.shrinkImage.name, function() { describe(Utils.shrinkImage.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.capitalize.name, function() { describe(Utils.capitalize.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.isMiniScreen.name, function() { describe(Utils.isMiniScreen.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.isShowDesktopDragHandles.name, function() { describe(Utils.isShowDesktopDragHandles.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.isMiniScreenOrShowDesktopDragHandles.name, function() { describe(Utils.isTouchScreenOrShowDesktopDragHandles.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.calculateIndexData.name, function() { describe(Utils.calculateIndexData.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.calculateIndex.name, function() { describe(Utils.calculateIndex.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.manageCustomUI.name, function() { describe(Utils.manageCustomUI.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.setCustomUI.name, function() { describe(Utils.setCustomUI.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.setMatomo.name, function() { describe(Utils.setMatomo.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.manageMatomo.name, function() { describe(Utils.manageMatomo.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
describe(Utils.getTriggerActionDesc.name, function() { describe(Utils.getTriggerActionDesc.name, function () {
it('has no tests yet'); it('has no tests yet');
}); });
}); });

View file

@ -40,7 +40,7 @@ Utils = {
const ret = Cards.findOne(cardId); const ret = Cards.findOne(cardId);
return ret; return ret;
}, },
reload () { reload() {
// we move all window.location.reload calls into this function // we move all window.location.reload calls into this function
// so we can disable it when running tests. // so we can disable it when running tests.
// This is because we are not allowed to override location.reload but // This is because we are not allowed to override location.reload but
@ -201,14 +201,14 @@ Utils = {
image = document.createElement('img'); image = document.createElement('img');
const maxSize = options.maxSize || 1024; const maxSize = options.maxSize || 1024;
const ratio = options.ratio || 1.0; const ratio = options.ratio || 1.0;
const next = function(result) { const next = function (result) {
image = null; image = null;
canvas = null; canvas = null;
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(result); callback(result);
} }
}; };
image.onload = function() { image.onload = function () {
let width = this.width, let width = this.width,
height = this.height; height = this.height;
let changed = false; let changed = false;
@ -237,7 +237,7 @@ Utils = {
next(changed); next(changed);
} }
}; };
image.onerror = function() { image.onerror = function () {
next(false); next(false);
}; };
image.src = dataurl; image.src = dataurl;
@ -256,11 +256,13 @@ Utils = {
// OLD WINDOW WIDTH DETECTION: // OLD WINDOW WIDTH DETECTION:
this.windowResizeDep.depend(); this.windowResizeDep.depend();
return $(window).width() <= 800; return $(window).width() <= 800;
},
isTouchScreen() {
// NEW TOUCH DEVICE DETECTION: // NEW TOUCH DEVICE DETECTION:
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
/*
var hasTouchScreen = false; var hasTouchScreen = false;
if ("maxTouchPoints" in navigator) { if ("maxTouchPoints" in navigator) {
hasTouchScreen = navigator.maxTouchPoints > 0; hasTouchScreen = navigator.maxTouchPoints > 0;
@ -281,10 +283,7 @@ Utils = {
); );
} }
} }
*/ return hasTouchScreen;
//if (hasTouchScreen)
// document.getElementById("exampleButton").style.padding="1em";
//return false;
}, },
// returns if desktop drag handles are enabled // returns if desktop drag handles are enabled
@ -300,8 +299,8 @@ Utils = {
}, },
// returns if mini screen or desktop drag handles // returns if mini screen or desktop drag handles
isMiniScreenOrShowDesktopDragHandles() { isTouchScreenOrShowDesktopDragHandles() {
return this.isMiniScreen() || this.isShowDesktopDragHandles(); return this.isTouchScreen() || this.isShowDesktopDragHandles();
}, },
calculateIndexData(prevData, nextData, nItems = 1) { calculateIndexData(prevData, nextData, nItems = 1) {
@ -396,7 +395,7 @@ Utils = {
window._paq.push(['trackPageView']); window._paq.push(['trackPageView']);
window._paq.push(['enableLinkTracking']); window._paq.push(['enableLinkTracking']);
(function() { (function () {
window._paq.push(['setTrackerUrl', `${data.address}piwik.php`]); window._paq.push(['setTrackerUrl', `${data.address}piwik.php`]);
window._paq.push(['setSiteId', data.siteId]); window._paq.push(['setSiteId', data.siteId]);
@ -500,8 +499,8 @@ Utils = {
copyTextToClipboard(text) { copyTextToClipboard(text) {
let ret; let ret;
if (navigator.clipboard) { if (navigator.clipboard) {
ret = navigator.clipboard.writeText(text).then(function() { ret = navigator.clipboard.writeText(text).then(function () {
}, function(err) { }, function (err) {
console.error('Async: Could not copy text: ', err); console.error('Async: Could not copy text: ', err);
}); });
} else { } else {