Drag handles continue. In progress.

Thanks to xet7 !
This commit is contained in:
Lauri Ojansivu 2019-10-01 00:48:36 +03:00
parent 44378fe9d1
commit 98c38fe58f
12 changed files with 88 additions and 32 deletions

View file

@ -165,7 +165,8 @@ BlazeComponent.extendComponent({
$checklistsDom.sortable({ $checklistsDom.sortable({
tolerance: 'pointer', tolerance: 'pointer',
helper: 'clone', helper: 'clone',
handle: '.checklist-title', //handle: '.checklist-title',
handle: '.checklist-item-handle',
items: '.js-checklist', items: '.js-checklist',
placeholder: 'checklist placeholder', placeholder: 'checklist placeholder',
distance: 7, distance: 7,

View file

@ -31,10 +31,12 @@ template(name="checklistDetail")
h2.title.js-open-inlined-form.is-editable h2.title.js-open-inlined-form.is-editable
+viewer +viewer
= checklist.title = checklist.title
a.checklist-handle.handle.fa.fa-arrows.js-checklist-handle
else else
h2.title h2.title
+viewer +viewer
= checklist.title = checklist.title
a.checklist-handle.handle.fa.fa-arrows.js-checklist-handle
+checklistItems(checklist = checklist) +checklistItems(checklist = checklist)
template(name="checklistDeleteDialog") template(name="checklistDeleteDialog")
@ -75,6 +77,11 @@ template(name="checklistItems")
+editChecklistItemForm(type = 'item' item = item checklist = checklist) +editChecklistItemForm(type = 'item' item = item checklist = checklist)
else else
+checklistItemDetail(item = item checklist = checklist) +checklistItemDetail(item = item checklist = checklist)
if isMiniScreen
a.checklist-item-handle.handle.fa.fa-arrows.js-checklist-item-handle
unless isMiniScreen
if showDesktopDragHandles
a.checklist-item-handle.handle.fa.fa-arrows.js-checklist-item-handle
if canModifyCard if canModifyCard
+inlinedForm(autoclose=false classNames="js-add-checklist-item" checklist = checklist) +inlinedForm(autoclose=false classNames="js-add-checklist-item" checklist = checklist)
+addChecklistItemForm +addChecklistItemForm

View file

@ -4,11 +4,11 @@ function initSorting(items) {
items.sortable({ items.sortable({
tolerance: 'pointer', tolerance: 'pointer',
helper: 'clone', helper: 'clone',
items: '.js-checklist-item:not(.placeholder)', items: '.js-checklist-item-handle:not(.placeholder)',
connectWith: '.js-checklist-items', connectWith: '.js-checklist-items',
appendTo: '.board-canvas', appendTo: '.board-canvas',
distance: 7, distance: 7,
placeholder: 'checklist-item placeholder', placeholder: 'checklist-item-handle placeholder',
scroll: false, scroll: false,
start(evt, ui) { start(evt, ui) {
ui.placeholder.height(ui.helper.height()); ui.placeholder.height(ui.helper.height());
@ -17,11 +17,11 @@ function initSorting(items) {
stop(evt, ui) { stop(evt, ui) {
const parent = ui.item.parents('.js-checklist-items'); const parent = ui.item.parents('.js-checklist-items');
const checklistId = Blaze.getData(parent.get(0)).checklist._id; const checklistId = Blaze.getData(parent.get(0)).checklist._id;
let prevItem = ui.item.prev('.js-checklist-item').get(0); let prevItem = ui.item.prev('.js-checklist-item-handle').get(0);
if (prevItem) { if (prevItem) {
prevItem = Blaze.getData(prevItem).item; prevItem = Blaze.getData(prevItem).item;
} }
let nextItem = ui.item.next('.js-checklist-item').get(0); let nextItem = ui.item.next('.js-checklist-item-handle').get(0);
if (nextItem) { if (nextItem) {
nextItem = Blaze.getData(nextItem).item; nextItem = Blaze.getData(nextItem).item;
} }
@ -38,7 +38,7 @@ function initSorting(items) {
}); });
// ugly touch event hotfix // ugly touch event hotfix
enableClickOnTouch('.js-checklist-item:not(.placeholder)'); enableClickOnTouch('.js-checklist-item-handle:not(.placeholder)');
} }
BlazeComponent.extendComponent({ BlazeComponent.extendComponent({
@ -197,6 +197,12 @@ BlazeComponent.extendComponent({
}, },
}).register('checklists'); }).register('checklists');
Template.checklists.helpers({
showDesktopDragHandles() {
return Meteor.user().hasShowDesktopDragHandles();
},
});
Template.checklistDeleteDialog.onCreated(() => { Template.checklistDeleteDialog.onCreated(() => {
const $cardDetails = this.$('.card-details'); const $cardDetails = this.$('.card-details');
this.scrollState = { this.scrollState = {
@ -231,6 +237,9 @@ Template.checklistItemDetail.helpers({
!Meteor.user().isCommentOnly() !Meteor.user().isCommentOnly()
); );
}, },
showDesktopDragHandles() {
return Meteor.user().hasShowDesktopDragHandles();
},
}); });
BlazeComponent.extendComponent({ BlazeComponent.extendComponent({

View file

@ -35,6 +35,14 @@ textarea.js-add-checklist-item, textarea.js-edit-checklist-item
&.is-finished &.is-finished
color: #3cb500 color: #3cb500
.checklist-handle
position: absolute
padding: 7px
top: 50%
transform: translateY(-50%)
left: 100px
font-size: 18px
.js-delete-checklist .js-delete-checklist
@extends .delete-text @extends .delete-text
@ -70,7 +78,7 @@ textarea.js-add-checklist-item, textarea.js-edit-checklist-item
margin-left: 12% margin-left: 12%
float: left float: left
.toggle-delete-checklist-dialog .toggle-delete-checklist-dialog
margin-right: 12% margin-right: 20%
float: right float: right
#card-details-overlay #card-details-overlay
@ -131,6 +139,13 @@ textarea.js-add-checklist-item, textarea.js-edit-checklist-item
display: block display: block
word-wrap: break-word word-wrap: break-word
max-width: 420px max-width: 420px
.checklist-item-handle
position: absolute
padding: 7px
top: 50%
transform: translateY(-50%)
left: 200px
font-size: 18px
.js-delete-checklist-item .js-delete-checklist-item
margin: 0 0 0.5em 1.33em margin: 0 0 0.5em 1.33em

View file

@ -52,6 +52,7 @@ BlazeComponent.extendComponent({
$cards.sortable({ $cards.sortable({
connectWith: '.js-minicards:not(.js-list-full)', connectWith: '.js-minicards:not(.js-list-full)',
tolerance: 'pointer', tolerance: 'pointer',
handle: 'list-header',
appendTo: '.board-canvas', appendTo: '.board-canvas',
helper(evt, item) { helper(evt, item) {
const helper = item.clone(); const helper = item.clone();

View file

@ -225,7 +225,7 @@
padding: 7px padding: 7px
top: 50% top: 50%
transform: translateY(-50%) transform: translateY(-50%)
margin-right: 27px right: 47px
font-size: 20px font-size: 20px
.list-header-menu-handle .list-header-menu-handle
@ -236,6 +236,14 @@
right: 10px right: 10px
font-size: 24px font-size: 24px
.list-header-menu-handle-miniscreen-angle-left
position: absolute
padding: 7px
top: 50%
transform: translateY(-50%)
right: 25px
font-size: 24px
.link-board-wrapper .link-board-wrapper
display: flex display: flex
align-items: baseline align-items: baseline

View file

@ -29,9 +29,10 @@ template(name="listHeader")
if canSeeAddCard if canSeeAddCard
a.js-add-card.fa.fa-plus.list-header-plus-icon a.js-add-card.fa.fa-plus.list-header-plus-icon
a.fa.fa-navicon.js-open-list-menu a.fa.fa-navicon.js-open-list-menu
a.list-header-menu-handle.handle.fa.fa-arrows.js-list-handle a.list-header-menu-handle-miniscreen-angle-left.handle.fa.fa-arrows.js-list-handle
else else
a.list-header-menu-icon.fa.fa-angle-right.js-select-list a.list-header-menu-icon.fa.fa-angle-right.js-select-list
|    
a.list-header-menu-handle.handle.fa.fa-arrows.js-list-handle a.list-header-menu-handle.handle.fa.fa-arrows.js-list-handle
else if currentUser.isBoardMember else if currentUser.isBoardMember
if isWatching if isWatching

View file

@ -16,6 +16,9 @@ template(name="swimlaneFixedHeader")
unless currentUser.isCommentOnly unless currentUser.isCommentOnly
a.fa.fa-plus.js-open-add-swimlane-menu.swimlane-header-plus-icon a.fa.fa-plus.js-open-add-swimlane-menu.swimlane-header-plus-icon
a.fa.fa-navicon.js-open-swimlane-menu a.fa.fa-navicon.js-open-swimlane-menu
if isMiniScreen
a.swimlane-header-menu-miniscreen-handle.handle.fa.fa-arrows.js-swimlane-header-handle
unless isMiniScreen
if showDesktopDragHandles if showDesktopDragHandles
a.swimlane-header-menu-handle.handle.fa.fa-arrows.js-swimlane-header-handle a.swimlane-header-menu-handle.handle.fa.fa-arrows.js-swimlane-header-handle

View file

@ -53,22 +53,9 @@ function initSortable(boardComponent, $listsDom) {
}, },
}; };
if (Utils.isMiniScreen) {
$listsDom.sortable({
handle: '.js-list-handle',
});
}
if (!Utils.isMiniScreen && showDesktopDragHandles) {
$listsDom.sortable({
handle: '.js-list-header',
});
}
$listsDom.sortable({ $listsDom.sortable({
tolerance: 'pointer', tolerance: 'pointer',
helper: 'clone', helper: 'clone',
handle: '.js-list-header',
items: '.js-list:not(.js-list-composer)', items: '.js-list:not(.js-list-composer)',
placeholder: 'list placeholder', placeholder: 'list placeholder',
distance: 7, distance: 7,
@ -113,6 +100,22 @@ function initSortable(boardComponent, $listsDom) {
// is not a board member // is not a board member
boardComponent.autorun(() => { boardComponent.autorun(() => {
const $listDom = $listsDom; const $listDom = $listsDom;
if (Utils.isMiniScreen) {
$listsDom.sortable({
handle: '.js-list-handle',
});
}
if (!Utils.isMiniScreen && showDesktopDragHandles) {
$listsDom.sortable({
handle: '.js-list-header',
});
}
if ($listDom.data('sortable')) { if ($listDom.data('sortable')) {
$listsDom.sortable( $listsDom.sortable(
'option', 'option',
@ -165,7 +168,7 @@ BlazeComponent.extendComponent({
// his mouse. // his mouse.
if (Utils.isMiniScreen) { if (Utils.isMiniScreen) {
const noDragInside = [ noDragInside = [
'a', 'a',
'input', 'input',
'textarea', 'textarea',
@ -176,7 +179,7 @@ BlazeComponent.extendComponent({
} }
if (!Utils.isMiniScreen && !showDesktopDragHandles) { if (!Utils.isMiniScreen && !showDesktopDragHandles) {
const noDragInside = [ noDragInside = [
'a', 'a',
'input', 'input',
'textarea', 'textarea',
@ -186,7 +189,7 @@ BlazeComponent.extendComponent({
} }
if (!Utils.isMiniScreen && showDesktopDragHandles) { if (!Utils.isMiniScreen && showDesktopDragHandles) {
const noDragInside = [ noDragInside = [
'a', 'a',
'input', 'input',
'textarea', 'textarea',

View file

@ -58,6 +58,14 @@
left: 300px left: 300px
font-size: 18px font-size: 18px
.swimlane-header-menu-miniscreen-handle
position: absolute
padding: 7px
top: 50%
transform: translateY(-50%)
left: 487px
font-size: 18px
.list-group .list-group
height: 100% height: 100%

6
package-lock.json generated
View file

@ -25,9 +25,9 @@
} }
}, },
"@babel/runtime": { "@babel/runtime": {
"version": "7.5.5", "version": "7.6.2",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.5.5.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.2.tgz",
"integrity": "sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ==", "integrity": "sha512-EXxN64agfUqqIGeEjI5dL5z0Sw0ZwWo1mLTi4mQowCZ42O59b7DRpZAnTC6OqdF28wMBMFKNb/4uFGrVaigSpg==",
"requires": { "requires": {
"regenerator-runtime": "^0.13.2" "regenerator-runtime": "^0.13.2"
} }

View file

@ -53,7 +53,7 @@
"prettier-eslint": "^8.8.2" "prettier-eslint": "^8.8.2"
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "^7.5.5", "@babel/runtime": "^7.6.2",
"ajv": "^5.0.0", "ajv": "^5.0.0",
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
"bcrypt": "^3.0.2", "bcrypt": "^3.0.2",