Commit 0988e560 authored by Iker Hurtado's avatar Iker Hurtado
Browse files

New Methodology details page full functionality implemented

parent 522086be
......@@ -53,8 +53,8 @@
let PubSub = __webpack_require__(5);
let Router = __webpack_require__(6);
let MaterialMod = __webpack_require__(7);
let SearchModule = __webpack_require__(31);
let UserGuidance = __webpack_require__(32);
let SearchModule = __webpack_require__(32);
let UserGuidance = __webpack_require__(33);
let DataStore = __webpack_require__(2);
let contentElement= document.getElementById("content");
......@@ -1421,8 +1421,8 @@
let StructureDetails = __webpack_require__(18);
let ElectronicStructDetails = __webpack_require__(23);
let MethodologyDetails = __webpack_require__(25);
let ThermalPropsDetails = __webpack_require__(27);
let ElasticConstDetails = __webpack_require__(30);
let ThermalPropsDetails = __webpack_require__(28);
let ElasticConstDetails = __webpack_require__(31);
let DataStore = __webpack_require__(2);
let LoadingPopup = __webpack_require__(3);
......@@ -5978,7 +5978,7 @@
let InfoSys = __webpack_require__(11);
let FilterInGroupsComponent = __webpack_require__(26);
let DataStore = __webpack_require__(2);
let SortingButton = __webpack_require__(36);
let SortingButton = __webpack_require__(27);
const REPOSITORY_LINK =
......@@ -6090,7 +6090,9 @@
this.sortingButtonWrappers =
this.dataTableWrapper.querySelectorAll('.sorting-button');
this.sortingButtonsMap = new Map([
this.sortingButtons = [];
let sortingButtonsMap = new Map([
[ 'id', undefined ],
[ 'type', undefined ],
[ 'functional', undefined ],
......@@ -6098,13 +6100,18 @@
[ 'potential', undefined ],
[ 'basisSet', undefined ] ]);
let keysIter = this.sortingButtonsMap.keys();
let keysIter = sortingButtonsMap.keys();
this.sortingButtonWrappers.forEach( e => {
let field = keysIter.next().value;
let component = new SortingButton(field);
e.appendChild(component.element);
this.sortingButtons.push(component);
component.setListener( (descendingOrder, field) => {
console.log('awful',descendingOrder, field);
this.sortingButtons.forEach( el => {
if (el !== component) el.init();
});
this.sortRowsCalcDataBy(descendingOrder, field);
this._render();
});
......@@ -6238,6 +6245,7 @@
return a.id - b.id;
});*/
this.sortRowsCalcDataBy(true, 'id');
//console.log('sortedCalcs:', this.sortedCalcs);
this._render();
......@@ -6480,6 +6488,57 @@
/***/ function(module, exports, __webpack_require__) {
let util = __webpack_require__(1);
class SortingButton {
constructor(id) {
this.id = id;
this.descending = true;
this.element = document.createElement('span');
this.element.innerHTML+=`
<img src="img/sorting_init.png" width="20px"
style="margin-bottom: -1px; cursor: pointer"/>
`;
this.image = this.element.querySelector('img');
if (id === 'id')
this.image.setAttribute('src','img/sorting_descending.png');
this.element.addEventListener('click', e => {
this.descending = !this.descending;
this.image.setAttribute('src',
'img/sorting_'+(this.descending ? 'descending' : 'ascending')+'.png');
this.listener(this.descending, this.id);
});
}
init(){
this.image.setAttribute('src','img/sorting_init.png');
}
setDescendingIcon(){
this.image.setAttribute('src','img/sorting_descending.png');
}
setListener(listener){
this.listener = listener;
}
}
// EXPORTS
module.exports = SortingButton;
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
let DetailsViewBase = __webpack_require__(19);
......@@ -6489,8 +6548,8 @@
let LoadingPopup = __webpack_require__(3);
let HeatCapPlotter = __webpack_require__(16);
let HelmholtzPlotter = __webpack_require__(28);
let PhononDispDOSPlotter = __webpack_require__(29);
let HelmholtzPlotter = __webpack_require__(29);
let PhononDispDOSPlotter = __webpack_require__(30);
class ThermalPropsDetails extends DetailsViewBase{
......@@ -6671,7 +6730,7 @@
/***/ },
/* 28 */
/* 29 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
......@@ -6726,7 +6785,7 @@
/***/ },
/* 29 */
/* 30 */
/***/ function(module, exports, __webpack_require__) {
......@@ -6886,7 +6945,7 @@
/***/ },
/* 30 */
/* 31 */
/***/ function(module, exports, __webpack_require__) {
......@@ -6991,17 +7050,17 @@
/***/ },
/* 31 */
/* 32 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
let util = __webpack_require__(1);
let UserGuidance = __webpack_require__(32);
let ElementTable = __webpack_require__(33);
let MaterialList = __webpack_require__(34);
let PropertiesBox = __webpack_require__(35);
let UserGuidance = __webpack_require__(33);
let ElementTable = __webpack_require__(34);
let MaterialList = __webpack_require__(35);
let PropertiesBox = __webpack_require__(36);
function getTagHtml(tag, isFormula){
......@@ -7454,7 +7513,7 @@
/***/ },
/* 32 */
/* 33 */
/***/ function(module, exports) {
"use strict";
......@@ -7625,7 +7684,7 @@
/***/ },
/* 33 */
/* 34 */
/***/ function(module, exports, __webpack_require__) {
......@@ -7994,7 +8053,7 @@
/***/ },
/* 34 */
/* 35 */
/***/ function(module, exports, __webpack_require__) {
......@@ -8254,7 +8313,7 @@
/***/ },
/* 35 */
/* 36 */
/***/ function(module, exports, __webpack_require__) {
......@@ -8749,44 +8808,5 @@
module.exports = PropertiesBox;
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
let util = __webpack_require__(1);
class SortingButton {
constructor(id) {
this.id = id;
this.off = true;
this.element = document.createElement('span');
this.element.innerHTML+=`
<img src="img/sorting_off.png" width="24px"
style="margin-bottom: -1px; cursor: pointer"/>
`;
this.image = this.element.querySelector('img');
this.element.addEventListener('click', e => {
this.off = !this.off;
let imagePath = (this.off ? 'img/sorting_off' : 'img/sorting');
this.image.setAttribute('src',imagePath+'.png');
this.listener(this.off, this.id);
});
}
setListener(listener){
this.listener = listener;
}
}
// EXPORTS
module.exports = SortingButton;
/***/ }
/******/ ]);
\ No newline at end of file
......@@ -118,7 +118,9 @@ class MethodologyDetails extends DetailsViewBase {
this.sortingButtonWrappers =
this.dataTableWrapper.querySelectorAll('.sorting-button');
this.sortingButtonsMap = new Map([
this.sortingButtons = [];
let sortingButtonsMap = new Map([
[ 'id', undefined ],
[ 'type', undefined ],
[ 'functional', undefined ],
......@@ -126,13 +128,18 @@ class MethodologyDetails extends DetailsViewBase {
[ 'potential', undefined ],
[ 'basisSet', undefined ] ]);
let keysIter = this.sortingButtonsMap.keys();
let keysIter = sortingButtonsMap.keys();
this.sortingButtonWrappers.forEach( e => {
let field = keysIter.next().value;
let component = new SortingButton(field);
e.appendChild(component.element);
this.sortingButtons.push(component);
component.setListener( (descendingOrder, field) => {
console.log('awful',descendingOrder, field);
this.sortingButtons.forEach( el => {
if (el !== component) el.init();
});
this.sortRowsCalcDataBy(descendingOrder, field);
this._render();
});
......@@ -266,6 +273,7 @@ class MethodologyDetails extends DetailsViewBase {
return a.id - b.id;
});*/
this.sortRowsCalcDataBy(true, 'id');
//console.log('sortedCalcs:', this.sortedCalcs);
this._render();
......
......@@ -6,24 +6,36 @@ class SortingButton {
constructor(id) {
this.id = id;
this.off = true;
this.descending = true;
this.element = document.createElement('span');
this.element.innerHTML+=`
<img src="img/sorting_off.png" width="24px"
<img src="img/sorting_init.png" width="20px"
style="margin-bottom: -1px; cursor: pointer"/>
`;
this.image = this.element.querySelector('img');
if (id === 'id')
this.image.setAttribute('src','img/sorting_descending.png');
this.element.addEventListener('click', e => {
this.off = !this.off;
let imagePath = (this.off ? 'img/sorting_off' : 'img/sorting');
this.image.setAttribute('src',imagePath+'.png');
this.listener(this.off, this.id);
this.descending = !this.descending;
this.image.setAttribute('src',
'img/sorting_'+(this.descending ? 'descending' : 'ascending')+'.png');
this.listener(this.descending, this.id);
});
}
init(){
this.image.setAttribute('src','img/sorting_init.png');
}
setDescendingIcon(){
this.image.setAttribute('src','img/sorting_descending.png');
}
setListener(listener){
this.listener = listener;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment