Skip to content

Commit 94582f7

Browse files
authored
Added documentation for modifyContent (#18)
1 parent 11200df commit 94582f7

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Added
10+
- Documented the page content modification method for internal users.
911

1012
## [v2021-05-22T22.11.29] - 2021-05-22
13+
### Fixed
14+
- Fixed an unlinked section in the changelog.
1115

1216
## [v2021-05-22T21.30.10] - 2021-05-22
1317

source/includes/_internal.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1-
# DDC specific docs
1+
# DDC Specific Documentation
22

3-
All our secrets go here!!
3+
## Content Modification
4+
5+
This method allows you to modify content on a page level. Right now we only support the modification of the `schedule-service` button. So, by using this method you would be able to modify the link attributes of all the schedule service buttons on a page.
6+
7+
> Usage:
8+
9+
```javascript
10+
(async APILoader => {
11+
const API = await APILoader.create(document.currentScript);
12+
API.modifyContent('schedule-service', {
13+
schema: {
14+
// Attributes of the link you want to add or modify
15+
}
16+
});
17+
})(window.DDC.APILoader);
18+
```
19+
20+
> Schema Object:
21+
22+
```javascript
23+
{
24+
"href": "String", // Link to a new service page
25+
"target": "String", // Set the target attribute of the anchor tag
26+
"onclick": "Function", // Set an onClick event handler for the button. Remember to reset the href of the button while setting a click event.
27+
"popover": "Object", // Popover settings for your button, eg {title: "heading", content: "popover text"}
28+
"attributes": "Object" // List of all data attributes that you would want to add to the button
29+
}
30+
```
31+
32+
> Example Implementation:
33+
34+
```javascript
35+
(async APILoader => {
36+
const API = await APILoader.create(document.currentScript);
37+
API.modifyContent('schedule-service', {
38+
schema: {
39+
"href": "/schedule-form.htm",
40+
"target": "_blank",
41+
"attributes": {
42+
"data-width": "400px",
43+
"data-title": "My custom service"
44+
}
45+
}
46+
});
47+
})(window.DDC.APILoader);
48+
```

0 commit comments

Comments
 (0)