Skip to content

Commit

Permalink
chore(integration): Update contributing.md
Browse files Browse the repository at this point in the history
  • Loading branch information
shantanuraj committed Dec 10, 2019
1 parent 71b0479 commit 766069c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
35 changes: 27 additions & 8 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,45 @@ Please consider the following with your pull request:
* Make sure we're not leaking styles or breaking the layout of the UI.
* The text used as timer description should be tailored to the majority of users. E.g. if ticket ID is an important piece of information, it should be included. If it's not important information (e.g. never actually shown in the UI, only in URLs) it should not be included.

### Private integration
### DOM integration

If you want to integrate `Toggl Button` with your private project on your custom domain you can
assign the domain to `Generic Toggl` integration in settings "Permissions" tab.
If you want to quickly integrate **Toggl Button** with your website.
You can enable the *DOM Integration* in the **Custom Integrations** section for your domain

Your site needs to contain some variation of the following HTML element, where the Toggl Button will
be created as its child:
![enable-dom-integration](https://user-images.githubusercontent.com/1716853/70514207-34cb4f00-1b59-11ea-894a-538f94f4d1f5.png)

You will have to add one or more `div` in your DOM with the class name `toggl-root`, containing the metadata for the time-entry you want to start, Toggl Button will render a button link as a child of these `divs`.

The schema for the time-entry metadata is

```typescript
interface TogglMetadata {
'class': 'toggl-root'
'data-description': string
'data-project-name': string
'data-project-id'?: number
'data-tags'?: string // comma separated tag names
'data-type'?: 'minimal'
'data-class-name'?: string
}
```

The actual DOM node would resemble

```html
<div
class="toggl-root"
data-class-name="name-of-the-integration"
data-description="Description of a new entry"
data-project-id="ID of a project that the entry should be assigned to"
data-description="Description of the time-entry"
data-project-name="Name of a project that the entry should be assigned to"
data-project-id="Optionally the id of the project that the entry should be assigned to"
data-tags="list,of,tags"
data-type="minimal"
data-class-name="name-of-the-integration"
></div>
```

See [toggl-button-dom-demo.now.sh](https://toggl-button-dom-demo.now.sh/) for reference.

## Making changes to the core extension code

Please consider future maintainers and the "generic" nature of the extension in mind when writing new features. All changes should be tested across both Chrome and Firefox.
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/origins.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default {
file: 'dokuwiki.js'
},
'dom-integration': {
url: '*://*/*',
url: '*://toggl-button-dom-demo.now.sh/*',
name: 'DOM Integration'
},
'draftin.com': {
Expand Down

0 comments on commit 766069c

Please sign in to comment.