Skip to content

Commit

Permalink
feature(Felamimail/js): custom message actions in small layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ccheng-dev committed Feb 19, 2024
1 parent 7c44ca9 commit 4e8cc4d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
8 changes: 8 additions & 0 deletions tine20/Felamimail/js/GridDetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Ext.ns('Tine.Felamimail');
// this.initTopToolbar();

Tine.Felamimail.GridDetailsPanel.superclass.initComponent.call(this);

this.editRecordAction.setText('');
this.editRecordAction.setIconClass('action_menu');
},

/**
Expand Down Expand Up @@ -86,6 +89,11 @@ Ext.ns('Tine.Felamimail');
}
return this.singleRecordPanel;
},

onEdit(e) {
if (!this.gridpanel) return;
this.gridpanel.contextMenu.showAt(e.el.getXY());
},

/**
* (on) update details
Expand Down
15 changes: 15 additions & 0 deletions tine20/Felamimail/js/GridPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,19 @@ Tine.Felamimail.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
scope: this,
iconCls: 'action_editcopy'
});

this.action_editRecord = new Ext.Action({
requiredGrant: 'editGrant',
allowMultiple: false,
text: this.app.i18n._('Edit'),
actionType: 'edit',
handler: this.onRowDblClick,
scope: this,
iconCls: 'action_edit',
actionUpdater: function(action, grants, records, isFilterSelect, filteredContainers) {
action.setHidden(! this.sentFolderSelected);
}.createDelegate(this)
});

this.action_fileRecord = new Tine.Felamimail.MessageFileAction({});

Expand Down Expand Up @@ -420,6 +433,7 @@ Tine.Felamimail.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
this.action_deleteRecord.initialConfig.translationObject = null;

this.actionUpdater.addActions([
this.action_editRecord,
this.action_deleteRecord,
this.action_reply,
this.action_replyAll,
Expand Down Expand Up @@ -449,6 +463,7 @@ Tine.Felamimail.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
this.action_reply,
this.action_replyAll,
this.action_forward,
this.action_editRecord,
this.action_flag,
this.action_markUnread,
this.action_copyRecord,
Expand Down
13 changes: 7 additions & 6 deletions tine20/Tinebase/js/widgets/grid/DetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ Tine.widgets.grid.DetailsPanel = Ext.extend(Ext.Panel, {
*/
initComponent: function() {
if (!this.tbar) {
this.editRecordAction = new Ext.Action({
text: i18n._('Edit'),
iconCls: 'action_edit',
scope: this,
handler: this.onEdit
});
this.tbar = [
new Ext.Action({
text: i18n._('Back'),
Expand All @@ -149,12 +155,7 @@ Tine.widgets.grid.DetailsPanel = Ext.extend(Ext.Panel, {
handler: this.onClose
}),
'->',
new Ext.Action({
text: i18n._('Edit'),
iconCls: 'action_edit',
scope: this,
handler: this.onEdit
})
this.editRecordAction,
]
this.useResponsiveTbar = true;
}
Expand Down

0 comments on commit 4e8cc4d

Please sign in to comment.