Skip to content

Commit

Permalink
[DEMO] Use keyboard shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
flovogt committed Oct 16, 2024
1 parent 38ca133 commit 87ab653
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion webapp/controller/App.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ sap.ui.define([
/**
* Removes all completed items from the todo list.
*/
clearCompleted() {
onClearCompleted() {
const oModel = this.getView().getModel();
const aTodos = oModel.getProperty("/todos").map((oTodo) => Object.assign({}, oTodo));

Expand Down
5 changes: 5 additions & 0 deletions webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"type": "application"
},
"sap.ui5": {
"commands": {
"Clear": {
"shortcut": "Ctrl+Y"
}
},
"dependencies": {
"minUI5Version": "1.121.0",
"libs": {
Expand Down
7 changes: 5 additions & 2 deletions webapp/view/App.view.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" xmlns="sap.m" xmlns:f="sap.f" controllerName="sap.ui.demo.todo.controller.App" displayBlock="true">
<App>
<Page>
<dependents>
<core:CommandExecution id="CE_CLEAR_COMPLETED" command="Clear" enabled="true" execute=".onClearCompleted" />
</dependents>
<customHeader>
<f:ShellBar core:require="{ Helper: 'sap/ui/demo/todo/util/Helper' }" title="{i18n>TITLE}" homeIcon="{:= Helper.resolvePath('./img/logo_ui5.png') }" />
</customHeader>
Expand Down Expand Up @@ -31,7 +34,7 @@
<SegmentedButtonItem text="{i18n>LABEL_COMPLETED}" key="completed"/>
</items>
</SegmentedButton>
<Button id="clearCompleted" enabled="{/itemsRemovable}" icon="sap-icon://delete" text="{i18n>CLEAR_COMPLETED}" press=".clearCompleted"/>
<Button id="clearCompleted" enabled="{/itemsRemovable}" icon="sap-icon://delete" text="{i18n>CLEAR_COMPLETED}" press="cmd:Clear"/>
</OverflowToolbar>
</headerToolbar>
<infoToolbar>
Expand Down Expand Up @@ -68,7 +71,7 @@
</items>
</SegmentedButton>
<ToolbarSpacer />
<Button id="clearCompleted-footer" enabled="{/itemsRemovable}" icon="sap-icon://delete" text="{i18n>CLEAR_COMPLETED}" press=".clearCompleted"/>
<Button id="clearCompleted-footer" enabled="{/itemsRemovable}" icon="sap-icon://delete" text="{i18n>CLEAR_COMPLETED}" press="cmd:Clear"/>
</OverflowToolbar>
</footer>

Expand Down

0 comments on commit 87ab653

Please sign in to comment.