Skip to content

Commit 35c4330

Browse files
committed
docs(cookbook): merge Share, Bookmark into App State page
1 parent 3f2cf0f commit 35c4330

4 files changed

Lines changed: 41 additions & 48 deletions

File tree

docs/.vitepress/config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ export default defineConfig({
251251
{ text: "WebSocket", link: "/development/specific/websocket" },
252252
{ text: "Logout", link: "/configuration/logout" },
253253
{ text: "OData", link: "/development/model/odata" },
254-
{ text: "App State", link: "/development/navigation/app_state" },
255-
{ text: "Share, Bookmark", link: "/development/navigation/share" },
254+
{ text: "App State, Share, Bookmark", link: "/development/navigation/app_state" },
256255
{
257256
text: "Utilities",
258257
collapsed: true,

docs/development/navigation/app_state.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
outline: [2, 4]
33
---
4-
# App State
4+
# App State, Share, Bookmark
55

6-
abap2UI5 saves the current app state so you can return to it later — like how standard UI5 apps manage state.
6+
abap2UI5 saves the current app state so you can return to it later — like how standard UI5 apps manage state. This opens up several useful options, like sharing and bookmarking the current state of your app.
77

88
### Usage
99
Each state persists as a draft with a unique ID. Calling `client->set_app_state_active` appends this ID as a hash fragment to the URL. The resulting URL is shareable — copy it and open it in another browser window (or send it to a colleague) to restore the same app state. The hash value (`z2ui5-xapp-state=...`) is a server-side key that points to the saved draft. Drafts expire after a configurable time (default: 4 hours, adjustable via [User Exits](/advanced/extensibility/user_exits)).
@@ -47,3 +47,40 @@ ENDCLASS.
4747
```
4848

4949
For a complete implementation, see sample `Z2UI5_CL_DEMO_APP_321`.
50+
51+
### Share
52+
Add a share button that copies the current state to the clipboard to share with colleagues:
53+
```abap
54+
CLASS z2ui5_cl_sample_share DEFINITION PUBLIC.
55+
56+
PUBLIC SECTION.
57+
INTERFACES z2ui5_if_app.
58+
DATA mv_quantity TYPE string.
59+
60+
ENDCLASS.
61+
62+
CLASS z2ui5_cl_sample_share IMPLEMENTATION.
63+
METHOD z2ui5_if_app~main.
64+
65+
CASE abap_true.
66+
67+
WHEN client->check_on_navigated( ).
68+
69+
DATA(view) = z2ui5_cl_xml_view=>factory( )->shell( )->page(
70+
)->label( `quantity`
71+
)->input( client->_bind_edit( mv_quantity )
72+
)->button( text = `share` press = client->_event( `BUTTON_POST` ) ).
73+
client->view_display( view->stringify( ) ).
74+
75+
WHEN client->check_on_event( `BUTTON_POST` ).
76+
77+
client->follow_up_action( client->_event_client( z2ui5_if_client=>cs_event-CLIPBOARD_APP_STATE ) ).
78+
client->message_toast_display( `clipboard copied` ).
79+
80+
ENDCASE.
81+
ENDMETHOD.
82+
ENDCLASS.
83+
```
84+
85+
### Bookmark
86+
You can also use these URLs for bookmarking, but note that the server keeps the app state only for a limited time. The default is 4 hours. See the [draft service](https://github.com/abap2UI5/abap2UI5/blob/main/src/01/01/z2ui5_cl_core_srv_draft.clas.abap#L46) source.

docs/development/navigation/share.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

docs/development/specific/clipboard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ ENDCLASS.
4444

4545
#### Copy the App State URL
4646

47-
To share the current app state instead of a custom string, use `clipboard_app_state` — see [Share, Bookmark](../navigation/share.md).
47+
To share the current app state instead of a custom string, use `clipboard_app_state` — see [App State, Share, Bookmark](../navigation/app_state.md).
4848

4949
::: warning
5050
The browser's Clipboard API requires HTTPS (or `localhost`). On plain HTTP the call is silently ignored.

0 commit comments

Comments
 (0)