Skip to content

Commit

Permalink
Fixed issue #13811: reordering questions by drag-and-drop
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Jun 27, 2018
1 parent bdfd636 commit 9c22a06
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 44 deletions.
18 changes: 14 additions & 4 deletions assets/packages/adminpanel/build/lsadminpanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,18 @@
height: 100%; }
#sidebar .dragPointer {
cursor: move; }
#sidebar .question-question-list .question-question-list-item .question-question-list-item-link {
display: inline-flex;
flex-wrap: wrap; }
#sidebar .question-question-list .question-question-list-item {
padding: 0; }
#sidebar .question-question-list .question-question-list-item .question-question-list-item-drag {
margin: 10px 15px; }
#sidebar .question-question-list .question-question-list-item.selected {
padding-left: 20px; }
#sidebar .question-question-list .question-question-list-item.selected .question-question-list-item-drag {
margin: 10px 10px 10px 5px; }
#sidebar .question-question-list .question-question-list-item .question-question-list-item-link {
padding: 10px 25px 10px 10px;
display: inline-flex;
flex-wrap: wrap; }
#sidebar .question_text_ellipsize {
display: inline-block;
text-overflow: ellipsis;
Expand All @@ -122,7 +131,8 @@

.bigIcons {
font-size: 18px;
line-height: 21px; }
line-height: 21px;
height: 24px; }

.quickmenuIcon {
font-size: "28px"; }
Expand Down
6 changes: 3 additions & 3 deletions assets/packages/adminpanel/build/lsadminpanel.debug.js

Large diffs are not rendered by default.

46 changes: 34 additions & 12 deletions assets/packages/adminpanel/build/lsadminpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -37062,7 +37062,7 @@ exports = module.exports = __webpack_require__(44)(true);


// module
exports.push([module.i, "\n#questionexplorer {\n overflow: auto;\n}\n", "", {"version":3,"sources":["/opt/web/LimeSurvey/assets/packages/adminpanel/src/components/subcomponents/_questionsgroups.vue"],"names":[],"mappings":";AAAA;EACE,eAAe;CAAE","file":"_questionsgroups.vue","sourcesContent":["#questionexplorer {\n overflow: auto; }\n"],"sourceRoot":""}]);
exports.push([module.i, "\n.display-as-container {\n display: block;\n}\n#questionexplorer {\n overflow: auto;\n}\n", "", {"version":3,"sources":["/opt/web/LimeSurvey/assets/packages/adminpanel/src/components/subcomponents/_questionsgroups.vue"],"names":[],"mappings":";AAAA;EACE,eAAe;CAAE;AAEnB;EACE,eAAe;CAAE","file":"_questionsgroups.vue","sourcesContent":[".display-as-container {\n display: block; }\n\n#questionexplorer {\n overflow: auto; }\n"],"sourceRoot":""}]);

// exports

Expand Down Expand Up @@ -37192,6 +37192,15 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
}
},
dragoverQuestiongroup($event, questiongroupObject) {
if (this.draggedQuestion == undefined || this.draggedQuestion == null) {
this.$log.error({
this: this,
event: $event,
questiongroupObject: questiongroupObject,
draggedQuestion: this.draggedQuestion
});
}

if (this.questiongroupDragging) {
const orderSwap = questiongroupObject.group_order;
questiongroupObject.group_order = this.draggedQuestionGroup.group_order;
Expand Down Expand Up @@ -37224,7 +37233,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
//dragevents questions
startDraggingQuestion($event, questionObject, questionGroupObject) {
this.$log.log("Dragging started", questionObject);
$event.dataTransfer.setData("text/plain", "node");
$event.dataTransfer.setData('application/node', this);
this.questionDragging = true;
this.draggedQuestion = questionObject;
this.draggedQuestionsGroup = questionGroupObject;
Expand Down Expand Up @@ -37304,7 +37313,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
}, [_c('div', {
staticClass: "col-12 ls-flex-row nowrap ls-space padding left-5 bottom-5"
}, [(!_vm.$store.state.surveyActiveState) ? [_c('i', {
}, [(!_vm.$store.state.surveyActiveState) ? _c('i', {
staticClass: "fa fa-bars bigIcons dragPointer",
attrs: {
"draggable": "true"
Expand All @@ -37315,9 +37324,14 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
},
"dragstart": function($event) {
_vm.startDraggingGroup($event, questiongroup)
},
"click": function($event) {
$event.stopPropagation();
$event.preventDefault();
(function () { return false; })($event)
}
}
}, [_vm._v("\n  \n ")])] : _vm._e(), _vm._v(" "), _c('a', {
}, [_vm._v("\n  \n ")]) : _vm._e(), _vm._v(" "), _c('a', {
staticClass: "col-12 pjax",
attrs: {
"href": questiongroup.link
Expand All @@ -37344,7 +37358,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
_vm.toggleActivation(questiongroup.gid)
}
}
}, [_vm._v(" ")])], 2), _vm._v(" "), _c('transition', {
}, [_vm._v(" ")])]), _vm._v(" "), _c('transition', {
attrs: {
"name": "slide-fade-down"
}
Expand All @@ -37356,22 +37370,21 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
}
}, _vm._l((_vm.orderQuestions(questiongroup.questions)), function(question) {
return _c('a', {
return _c('div', {
key: question.qid,
staticClass: "list-group-item question-question-list-item ls-flex-row align-itmes-flex-between",
class: _vm.questionItemClasses(question),
attrs: {
"data-toggle": "tootltip",
"href": question.link,
"title": question.question_flat
},
on: {
"dragenter": function($event) {
_vm.dragoverQuestion($event, question, questiongroup)
}
}
}, [(!_vm.$store.state.surveyActiveState) ? [_c('i', {
staticClass: "fa fa-bars margin-right bigIcons dragPointer",
}, [(!_vm.$store.state.surveyActiveState) ? _c('i', {
staticClass: "fa fa-bars margin-right bigIcons dragPointer question-question-list-item-drag",
attrs: {
"draggable": "true"
},
Expand All @@ -37381,12 +37394,21 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
},
"dragstart": function($event) {
_vm.startDraggingQuestion($event, question, questiongroup)
},
"click": function($event) {
$event.stopPropagation();
$event.preventDefault();
(function () { return false; })($event)
}
}
}, [_vm._v("\n  \n ")])] : _vm._e(), _vm._v(" "), _c('span', {
staticClass: "col-12 pjax question-question-list-item-link",
}, [_vm._v("\n  \n ")]) : _vm._e(), _vm._v(" "), _c('a', {
staticClass: "col-12 pjax question-question-list-item-link display-as-container",
attrs: {
"href": question.link
},
on: {
"click": function($event) {
$event.stopPropagation();
$event.preventDefault();
_vm.openQuestion(question)
}
Expand All @@ -37396,7 +37418,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
style: ({
width: _vm.itemWidth
})
}, [_vm._v("\n [" + _vm._s(question.title) + "] › " + _vm._s(question.question_flat) + " \n ")])])], 2)
}, [_vm._v("\n [" + _vm._s(question.title) + "] › " + _vm._s(question.question_flat) + " \n ")])])])
})) : _vm._e()])], 1)
}))])])
},staticRenderFns: []}
Expand Down
Loading

0 comments on commit 9c22a06

Please sign in to comment.