Info Actions
Last modified by Manuel Leduc on 2024/06/25 09:39
Table of Content
Description
Display info actions elements.
Defining a new info action
Add @xwiki/cristal-info-actions-api to your project dependencies.
Define a class extending InfoAction.
import { InfoAction } from "@xwiki/cristal-info-actions-api";
import { ref } from "vue";
import { injectable } from "inversify";
@injectable()
export class DemoInfoAction implements InfoAction {
iconName = "question";
id = "demo";
order = 1000;
async counter() {
return ref(0);
}
}
import { ref } from "vue";
import { injectable } from "inversify";
@injectable()
export class DemoInfoAction implements InfoAction {
iconName = "question";
id = "demo";
order = 1000;
async counter() {
return ref(0);
}
}
- iconName: the name of the boostrap icon to use for the info action
- id: the technical unique id of the info action
- order: the ordering value of the info action, info actions are sorted by ascending order value
- counter(): returns a Ref to the info action counter value. This value can be asynchronous
Existing Info Actions
- Likes: displays the number of likes (currently a static counter with value 99). Order = 1000
- Comments: displays the numbers of comments (currently a static counter with value 00). Order = 2000
- Attachments: displays number of attachments of the current page. Order = 3000