Skip to content

Commit

Permalink
Fixed issue: Panel integration fully working
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Oct 10, 2017
1 parent 706b56d commit feb39dc
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 88 deletions.
Expand Up @@ -67,9 +67,9 @@

console.log({result: result});
if(result.redirecturl != undefined ){
//window.location.href=result.redirecturl;
window.location.href=result.redirecturl;
} else {
//window.location.reload();
window.location.reload();
}
},
error: function(result){
Expand Down
@@ -1,15 +1,16 @@
<?php
/**
* Right accordion, integration panel
* Use datatables, needs surveysettings.js
*/
$yii = Yii::app();
$controller = $yii->getController();
* Right accordion, integration panel
* Use datatables, needs surveysettings.js
*/
$yii = Yii::app();
$controller = $yii->getController();
?>
<!-- Datatable translation-data -->
<script type="text/javascript">
<!-- Datatable translation-data -->
<script type="text/javascript">
var jsonUrl = "<?php echo App()->createUrl('admin/survey/sa/getUrlParamsJson', array('surveyid' => $surveyid))?>";
var imageUrl = "<?php echo $yii->getConfig("adminimageurl");?>";
var imageUrl = "<?php echo $yii->getConfig("
adminimageurl ");?>";
var sProgress = "<?php eT('Showing _START_ to _END_ of _TOTAL_ entries','js');?>";
var sAction = "<?php eT('Action','js');?>";
var sParameter = "<?php eT('Parameter','js');?>";
Expand All @@ -22,10 +23,10 @@
var sAddParam = "<?php eT('Add URL parameter','js');?>";
var sEditParam = "<?php eT('Edit URL parameter','js');?>";
var iSurveyId = "<?php echo $surveyid; ?>";
var questionArray =JSON.parse('<?php echo json_encode($questions); ?>');
</script>
<!-- Container -->
<lspanelparametertable :sid="<?php echo $surveyid; ?>" json-url="<?php echo App()->createUrl('admin/survey/sa/getUrlParamsJson', array('surveyid' => $surveyid))?>" :translate="{
var questionArray = JSON.parse('<?php echo json_encode($questions); ?>');
</script>
<!-- Container -->
<lspanelparametertable :sid="<?php echo $surveyid; ?>" json-url="<?php echo App()->createUrl('admin/survey/sa/getUrlParamsJson', array('surveyid' => $surveyid))?>" :translate="{
table: {
idColumn : '<?php eT('ID');?>',
actionColumn : '<?php eT('Action');?>',
Expand All @@ -42,28 +43,41 @@
paramName : '<?php eT('Parameter');?>',
targetQuestion : '<?php eT('Target question');?>',
noTargetQuestion : '<?php eT('(No target question)');?>',
sureToDelete : '<?php eT('Are you sure you want to delete this URL parameter?'); ?>',
deleteCancel : '<?php eT('No, cancel'); ?>',
deleteConfirm : '<?php eT('Yes, delete'); ?>',
save : '<?php eT('Save');?>',
cancel : '<?php eT('Cancel');?>'
}
}"></lspanelparametertable>

<?php /*
<?php /*
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<table id="urlparams" class='table dataTable table-striped table-borders' >
<thead>
<tr>
<th></th><th><?php eT('Action');?></th><th><?php eT('Parameter');?></th><th><?php eT('Target question');?></th><th></th><th></th><th></th>
</tr>
</thead>
</table>
<input type='hidden' id='allurlparams' name='allurlparams' value='' />
</div>
<div class="row">
<div class="col-sm-12">
<table id="urlparams" class='table dataTable table-striped table-borders' >
<thead>
<tr>
<th></th><th><?php eT('Action');?>
</th>
<th>
<?php eT('Parameter');?>
</th>
<th>
<?php eT('Target question');?>
</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
</table>
<input type='hidden' id='allurlparams' name='allurlparams' value='' />
</div>
</div>
</div>
</div>
<!-- Modal box to add a parameter -->
<div data-copy="submitsurveybutton"></div>
<?php $this->renderPartial('survey/subview/addPanelIntegrationParameter_view', array('questions' => $questions)); ?>
*/?>
<!-- Modal box to add a parameter -->
<div data-copy="submitsurveybutton"></div>
<?php $this->renderPartial('survey/subview/addPanelIntegrationParameter_view', array('questions' => $questions)); ?>
*/?>
131 changes: 95 additions & 36 deletions assets/packages/adminpanel/build/lsadminpanel.js
Expand Up @@ -30574,7 +30574,8 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
parameterRows: [],
currentParameter: {},
modalShown: false,
isNew: false
isNew: false,
toDeleteRow: null
};
},
computed: {
Expand Down Expand Up @@ -30638,7 +30639,22 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
};
this.toggleModal();
},
deleteRow(parameterRow) {},
deleteRow(parameterRow) {
this.toDeleteRow = parameterRow;
$('#lspanelintegration-deletePopup').modal('toggle');
},
cancelDelete() {
this.toDeleteRow = null;
},
confirmDelete() {
if (this.toDeleteRow !== null) {
let paramIdx = __WEBPACK_IMPORTED_MODULE_1_lodash___default.a.findIndex(this.parameterRows, item => {
return item.id === this.toDeleteRow.id;
});
if (paramIdx != -1) this.parameterRows.splice(paramIdx, 1);
}
$('#lspanelintegration-deletePopup').modal('toggle');
},
toggleModal() {
this.modalShown = !this.modalShown;
$('#lspanelintegration-parameterPopup').modal('toggle');
Expand All @@ -30651,7 +30667,9 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
}
},
created() {},
mounted() {}
mounted() {
this.getParameterRows();
}
});
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(6)))

Expand Down Expand Up @@ -30701,6 +30719,9 @@ module.exports = Component.exports

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_lodash__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_lodash___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_lodash__);


/* harmony default export */ __webpack_exports__["default"] = ({
name: 'lspanel-parameter-popup',
Expand All @@ -30716,6 +30737,11 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
return {};
},
computed: {
selectedQuestion() {
return __WEBPACK_IMPORTED_MODULE_0_lodash___default.a.find(this.questions, (item, i) => {
return this.parameterRow.qid == item.qid && (!item.sqid || item.sqid == this.parameterRow.sqid);
});
},
popupTitle() {
return this.isNew ? this.translate.popup.newParam : this.translate.popup.editParam;
},
Expand All @@ -30733,18 +30759,21 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
_ellipsize(text, iMaxLength, fPosition, sEllipsis) {
text = text || '';
fPosition = fPosition || 1;
sEllipsis = sEllipsis || '&hellip;';
sEllipsis = sEllipsis || '...';

const cleanString = text;
const iStrLen = cleanString.length;
const sBegin = cleanString.substring(0, Math.floor(iMaxLength * fPosition));
const sEnd = cleanString.substring(iStrLen - (iMaxLength - sBegin.length), iStrLen);
return sBegin + sEllipsis + sEnd;
if (iStrLen > iMaxLength) {
const sBegin = cleanString.substring(0, Math.floor(iMaxLength * fPosition));
const sEnd = cleanString.substring(iStrLen - (iMaxLength - sBegin.length), iStrLen);
return sBegin + sEllipsis + sEnd;
}
return text;
},
printQuestion(question) {
const questionText = this._ellipsize(question.question, 43, 0.75);
const subquestionText = ` - ${this._ellipsize(question.squestion, 30, .75)}`;
const returnstring = `${question.title}: ${questionText}${subquestionText}`;
const subquestionText = ` - ${this._ellipsize(question.sqquestion, 30, .75)}`;
const returnstring = `${question.title}: ${questionText}${subquestionText.length > 3 ? subquestionText : ''}`;
return returnstring;
},
saveChangedParameter() {
Expand All @@ -30754,9 +30783,9 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
this.$emit('canceledit');
},
updateValues() {
let qidSqid = this.parameterRow.targetQuestionText.split('-');
this.parameterRow.qid = qidSqid[0];
this.parameterRow.sqid = qidSqid[1] || '';
this.parameterRow.qid = this.selectedQuestion.qid;
this.parameterRow.sqid = this.selectedQuestion.sqid || '';
this.parameterRow.targetQuestionText = this.printQuestion(this.selectedQuestion);
}
},
created() {},
Expand All @@ -30772,22 +30801,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "modal-content"
}, [_c('div', {
staticClass: "modal-header"
}, [_c('button', {
attrs: {
"type": "button",
"aria-label": "Close"
},
on: {
"click": function($event) {
$event.preventDefault();
_vm.cancelEditParameter()
}
}
}, [_c('span', {
attrs: {
"aria-hidden": "true"
}
}, [_vm._v("×")])]), _vm._v(" "), _c('h4', {
}, [_c('h4', {
staticClass: "modal-title",
attrs: {
"id": "exampleModalLabel"
Expand All @@ -30799,7 +30813,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}, [_c('div', {
staticClass: "form-group"
}, [_c('label', {
staticClass: "control-label ",
staticClass: "control-label",
attrs: {
"for": "paramname"
}
Expand Down Expand Up @@ -30836,8 +30850,8 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.parameterRow.targetQuestionText),
expression: "parameterRow.targetQuestionText"
value: (_vm.selectedQuestion),
expression: "selectedQuestion"
}],
staticClass: "form-control",
attrs: {
Expand All @@ -30852,7 +30866,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
var val = "_value" in o ? o._value : o.value;
return val
});
_vm.parameterRow.targetQuestionText = $event.target.multiple ? $$selectedVal : $$selectedVal[0]
_vm.selectedQuestion = $event.target.multiple ? $$selectedVal : $$selectedVal[0]
}, function($event) {
_vm.updateValues()
}]
Expand All @@ -30865,7 +30879,8 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
return _c('option', {
key: question.qid,
domProps: {
"value": question.qid + (question.sqid ? '-' + question.sqid : '')
"value": question,
"selected": question.qid == _vm.parameterRow.qid
}
}, [_vm._v("\n " + _vm._s(_vm.printQuestion(question)) + " \n ")])
})], 2)])]), _vm._v(" "), _c('div', [_c('input', {
Expand Down Expand Up @@ -31030,6 +31045,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
expression: "true"
}]
}, [_c('div', [_c('button', {
staticClass: "btn btn-sm btn-default",
on: {
"click": function($event) {
$event.preventDefault();
Expand All @@ -31039,6 +31055,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}, [_c('i', {
staticClass: "fa fa-edit"
})]), _vm._v(" "), _c('button', {
staticClass: "btn btn-sm btn-danger",
on: {
"click": function($event) {
$event.preventDefault();
Expand All @@ -31060,8 +31077,11 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
rawName: "v-show",
value: (true),
expression: "true"
}]
}, [_vm._v(" " + _vm._s(parameterRow.targetQuestionText) + " ")]), _vm._v(" "), _c('td', {
}],
domProps: {
"innerHTML": _vm._s(parameterRow.targetQuestionText)
}
}), _vm._v(" "), _c('td', {
directives: [{
name: "show",
rawName: "v-show",
Expand Down Expand Up @@ -31128,7 +31148,46 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"updateparam": _vm.paramUpdated,
"canceledit": _vm.toggleModal
}
})], 1)])])
})], 1)]), _vm._v(" "), _c('div', {
staticClass: "modal fade",
attrs: {
"id": "lspanelintegration-deletePopup",
"role": "dialog"
}
}, [_c('div', {
staticClass: "modal-dialog",
attrs: {
"role": "document"
}
}, [_c('div', {
staticClass: "modal-content"
}, [_c('div', {
staticClass: "modal-body"
}, [_vm._v("\n " + _vm._s(_vm.translate.popup.sureToDelete) + "\n ")]), _vm._v(" "), _c('div', {
staticClass: "modal-footer"
}, [_c('button', {
staticClass: "btn btn-default",
attrs: {
"type": "button"
},
on: {
"click": function($event) {
$event.preventDefault();
_vm.cancelDelete($event)
}
}
}, [_vm._v(_vm._s(_vm.translate.popup.deleteCancel))]), _vm._v(" "), _c('button', {
staticClass: "btn btn-primary",
attrs: {
"type": "button"
},
on: {
"click": function($event) {
$event.preventDefault();
_vm.confirmDelete($event)
}
}
}, [_vm._v(_vm._s(_vm.translate.popup.deleteConfirm))])])])])])])
},staticRenderFns: []}
module.exports.render._withStripped = true
if (false) {
Expand Down
2 changes: 1 addition & 1 deletion assets/packages/adminpanel/build/lsadminpanel.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/packages/adminpanel/build/lsadminpanel.min.js

Large diffs are not rendered by default.

0 comments on commit feb39dc

Please sign in to comment.