Last active
August 10, 2020 12:03
-
-
Save minhhungit/15c1f79e262dca67228584badffeba5b to your computer and use it in GitHub Desktop.
serenity-toolbar-dropdown-button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=================================================== | |
// Copyright @ 2020 | |
// Author : Hung Vo ([email protected]) | |
// Time : 2020, June 10 | |
// Description : ToolDropdownButton | |
//=================================================== | |
namespace YourNamespace.Default { | |
@Serenity.Decorators.registerClass() | |
export class YourGrid extends Serenity.EntityGrid<YourRow, any> { | |
protected getColumnsKey() { return 'Default.YourColumn'; } | |
protected getDialogType() { return YourDialog; } | |
protected getIdProperty() { return YourRow.idProperty; } | |
protected getLocalTextPrefix() { return YourRow.localTextPrefix; } | |
protected getService() { return YourService.baseUrl; } | |
protected getInsertPermission() { return YourRow.insertPermission; } | |
private myToolDropdownButton: J.ToolDropdownButton; | |
constructor(container: JQuery) { | |
super(container); | |
let combineButtons: J.ToolDropdownButtonItem[] = [ | |
{ | |
key: null, | |
isDropdownHeader: true, | |
dropdownHeaderTitle: "I am a header 🤩", | |
cssClass: "text-purple" | |
}, | |
{ | |
key: "demo", | |
title: 'Demoooo', | |
icon: "fa fa-home text-green", | |
cssClass: "text-green", | |
onClick: e => Q.alert("button DEMO is pressed"), | |
}, | |
{ | |
key: null, | |
isSeparator: true | |
}, | |
{ | |
key: null, | |
isDropdownHeader: true, | |
dropdownHeaderTitle: "Another header.... 😜", | |
cssClass: "text-green" | |
}, | |
{ | |
key: "excel-key", | |
title: 'Excel (disabled by configuring)', | |
hint: 'Export to excel', | |
disabled: true, | |
icon: "fa fa-home text-green", | |
onClick: e => Q.alert("button EXCEL is pressed"), | |
}, | |
{ | |
key: "word-key", | |
title: 'Item without icon', /*=> & nbsp; Option without icon*/ | |
onClick: e => Q.alert("button without icon is pressed"), | |
}, | |
{ | |
key: null, | |
isSeparator: true | |
}, | |
{ | |
key: null, | |
isDropdownHeader: true, | |
dropdownHeaderTitle: "3rd header 😜", | |
cssClass: "text-yellow" | |
}, | |
{ | |
key: "powerpoint-key", | |
title: 'Powerpoint // and sooooo loooooooooong option (disabled by helper method)', | |
icon: "fa fa-long-arrow-right text-red", | |
cssClass: "text-red", | |
onClick: e => Q.alert("button POWERPOINT is pressed"), | |
} | |
]; | |
this.myToolDropdownButton = new J.ToolDropdownButton(this.toolbar.element.find(".buttons-outer"), combineButtons, { | |
title: "Export", | |
icon: "fa fa-print text-blue" | |
}); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=================================================== | |
// Copyright @ 2020 | |
// Author : Hung Vo ([email protected]) | |
// Time : 2020, June 10 | |
// Description : ToolDropdownButton | |
//=================================================== | |
/* ToolDropdownButtonGenerator */ | |
.j-tool-dropdown-button { | |
&:hover { | |
background-color: unset !important; | |
} | |
.disabled { | |
cursor: default !important; | |
} | |
.dropdown-toggle { | |
.caret { | |
margin-left: 6px; | |
margin-right: 4px; | |
} | |
} | |
.dropdown-menu{ | |
border-color: #ccc; | |
} | |
.dropdown-menu li { | |
a { | |
/*padding: 5px 10px 5px 12px;*/ | |
color: #333; | |
font-size: 13px; | |
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
} | |
} | |
.dropdown-menu li.disabled { | |
a, i { | |
color: gray !important; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks.