Skip to content

Commit

Permalink
Merge branch '2024.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlabci committed Dec 12, 2024
2 parents 2e8c88a + fb4c59d commit a19c050
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tine20/HumanResources/js/DailyWTReportGridPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Tine.HumanResources.DailyWTReportGridPanel = Ext.extend(Tine.widgets.grid.GridPa
quickFilterConfig: {
detailsToggleBtnConfig: {
initialState: {
detailsButtonPressed: true
filterPanelShow: true
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions tine20/Tinebase/js/widgets/MainScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ Tine.widgets.MainScreen = Ext.extend(Ext.Panel, {
const isSmall = width < 1024;
this.westRegionPanel.afterIsRendered().then((panel) => { panel[isSmall ? 'collapse' : 'expand']() });
this.northCardPanel.afterIsRendered().then((panel) => {panel.setVisible(!isSmall) });

const qfp = this.getCenterPanel()?.filterToolbar.quickFilterPlugin;

if (qfp != null) {
if (isSmall) {
qfp.setDetailsHidden(true);
} else {
//restore state before resize
qfp.setDetailsHidden(qfp.detailsToggleBtn.pressed);
}
}

this.westRegionPanel.on('click', () => { })

this.getTopToolbar().setVisible(isSmall);
Expand Down
28 changes: 20 additions & 8 deletions tine20/Tinebase/js/widgets/grid/FilterToolbarQuickFilterPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ Tine.widgets.grid.FilterToolbarQuickFilterPlugin.prototype = {
var stateId = this.ftb.recordClass.getMeta('appName') + '-' + this.ftb.recordClass.getMeta('recordName') + '-FilterToolbar-QuickfilterPlugin';
}

const ftqfp = this;

this.detailsToggleBtn = new Ext.Button(Ext.apply({
style: {'margin-top': '2px'},
enableToggle: true,
Expand All @@ -203,12 +205,12 @@ Tine.widgets.grid.FilterToolbarQuickFilterPlugin.prototype = {
stateful: stateful,
stateId : stateful ? stateId : null,
getState: function () {
return {detailsButtonPressed: this.pressed};
return {filterPanelShow: ftqfp.filterPanel.isVisible()};
},
applyState: function(state) {
if (state?.detailsButtonPressed) {
if (!state?.filterPanelShow) {
this.setText( i18n._('hide details'));
this.toggle(state.detailsButtonPressed);
this.toggle(true);
}
},
stateEvents: ['toggle'],
Expand Down Expand Up @@ -244,9 +246,19 @@ Tine.widgets.grid.FilterToolbarQuickFilterPlugin.prototype = {
* @param {Ext.Button} btn
*/
onDetailsToggle: function(btn) {
btn.setText(i18n._(`${!btn.pressed ? 'show' : 'hide'} details`));
this.setDetailsHidden(this.filterPanel.isVisible());
},
/**
* sets the visibility of the managed filterPanel
* does not trigger state update so responsive auto hide does not affect usage on bigger devices
* @param {boolean} hidden
*/
setDetailsHidden: function(hidden) {
const btn = this.detailsToggleBtn;

btn.setText(i18n._(`${hidden ? 'show' : 'hide'} details`));

const action = btn.pressed ? 'show' : 'hide';
const action = !hidden ? 'show' : 'hide';
this.ftb[action]();
if (this.filterPanel) this.filterPanel[action]();

Expand Down Expand Up @@ -337,16 +349,16 @@ Tine.widgets.grid.FilterToolbarQuickFilterPlugin.prototype = {

if (btn.stateful && btn.stateId) {
const state = Ext.state.Manager.get(btn.stateId);
if (typeof state?.detailsButtonPressed === 'undefined') {
if (typeof state?.filterPanelShow === 'undefined') {
const filterStore = this.ftb?.filterStore;
const queryFilter = filterStore.find('field', 'query');
const enabled = filterStore?.data?.length > 1 || queryFilter === -1;
Ext.state.Manager.set(btn.stateId, {detailsButtonPressed: enabled});
Ext.state.Manager.set(btn.stateId, {filterPanelShow: enabled});
btn.pressed = enabled;
}
}

this.onDetailsToggle(this.detailsToggleBtn);
this.setDetailsHidden(btn.pressed);
},

/**
Expand Down

0 comments on commit a19c050

Please sign in to comment.