Skip to content

Commit

Permalink
fix(docs): add user documentation for workitembutton
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelinz authored and anehx committed Jun 3, 2021
1 parent 71cb7a2 commit 47ef3e1
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 7 deletions.
4 changes: 2 additions & 2 deletions addon/templates/components/work-item-button.hbs
@@ -1,9 +1,9 @@
<UkButton
...attributes
@type={{@type}}
@disabled={{or @loading this.mutate.isRunning}}
@disabled={{or @disabled @loading this.mutate.isRunning}}
@active={{@active}}
@loading={{or @disabled @loading this.mutate.isRunning}}
@loading={{or @loading this.mutate.isRunning}}
@color={{or @color "default"}}
@size={{@size}}
@title={{@title}}
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/router.js
Expand Up @@ -14,6 +14,7 @@ Router.map(function () {
this.route("testing");
this.route("queries");
this.route("migration");
this.route("buttons");
});

this.route("demo", function () {
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/docs.hbs
Expand Up @@ -5,6 +5,7 @@
{{nav.item (t "dummy.testing") "docs.testing"}}
{{nav.item (t "dummy.queries.title") "docs.queries"}}
{{nav.item (t "dummy.migration") "docs.migration"}}
{{nav.item (t "dummy.buttons") "docs.buttons"}}
{{/viewer.nav}}

{{#viewer.main}}
Expand Down
44 changes: 44 additions & 0 deletions tests/dummy/app/templates/docs/buttons.md
@@ -0,0 +1,44 @@
# Buttons

`ember-caluma` provides buttons for mutating the state of work items.

## Usage

### WorkItemButton

The text of the button is per default the mutation name, it can be overwritten with either the `label` parameter or using the component in block form.

```hbs
<WorkItemButton
@mutation="complete"
@workItemId="bb94ad56-d650-4c21-ba51-7c4230aef4b8"
/>
<WorkItemButton
@label="Lorem Ipsum"
@mutation="complete"
@workItemId="bb94ad56-d650-4c21-ba51-7c4230aef4b8"
/>
<WorkItemButton
@mutation="complete"
@workItemId="bb94ad56-d650-4c21-ba51-7c4230aef4b8"
>
Lorem Ipsum
</WorkItemButton>
```

The WorkItemButton component has 3 parameters:

- `mutation` The state mutation to be used either `complete`, `skip` or `cancel`.
- `workItemId` Id of the work item which should be mutated.
- `label` (Optional) Overwrites the button text.

Additionally there are many optional parameters for the underlying [UkButton](https://adfinis-sygroup.github.io/ember-uikit/#/docs/components/button) component, refer to the UkButton component documentation to see what exactly they do:

- `type`
- `disabled`
- `loading`
- `color`
- `size`
- `title`
10 changes: 5 additions & 5 deletions tests/dummy/app/templates/docs/queries.md
Expand Up @@ -44,11 +44,11 @@ public methods:

- `fetch` To initially fetch the first page of the query. This will reset all existing items in the query. `fetch` takes the following optional arguments:

| Name | Type | Description |
| -------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `filter` | `String | Object` | According to the `gql` filter type defined in the query you're using. |
| `order` | `String | Object` | According to the `gql` order type defined in the query you're using. |
| `queryOptions` | `Object` | Pass options to `apollo.query`. For more information on what options exist, [see here](https://www.apollographql.com/docs/react/api/core/ApolloClient/#ApolloClient.query). |
| Name | Type | Description |
| -------------- | ----------------- | ------------------------------------------------------------ |
| `filter` | `String \| Object` | According to the `gql` filter type defined in the query you're using. |
| `order` | `String \| Object` | According to the `gql` order type defined in the query you're using. |
| `queryOptions` | `Object` | Pass options to `apollo.query`. For more information on what options exist, [see here](https://www.apollographql.com/docs/react/api/core/ApolloClient/#ApolloClient.query). |

- `fetchMore` This will load the next page of your data.

Expand Down
1 change: 1 addition & 0 deletions translations/dummy/en.yaml
Expand Up @@ -9,3 +9,4 @@ dummy:
load: "Load"
loadMore: "Load more"
getWorkItems: "getWorkItems"
buttons: "Buttons"

0 comments on commit 47ef3e1

Please sign in to comment.