Files
discourse-table-builder/javascripts/discourse/components/body-row.js
T
Keegan George 4c8cfa9559 FEATURE: Ability to build a table in the composer
- Adds a button to the composer tools which triggers a modal window for a table builder
- Table builder contains fields to add table contents, as well as buttons to align contents, and add additional tables/rows
2022-07-04 14:58:50 -07:00

35 lines
737 B
JavaScript

import GlimmerComponent from "discourse/components/glimmer";
import { action } from "@ember/object";
export default class BodyRow extends GlimmerComponent {
get disableRemoveRow() {
if (this.args.allRows.length > 1) {
return false;
} else {
return true;
}
}
@action
addBodyValue() {
const columnId = this.args.columnId;
const rowId = this.args.row.id;
const value = this.bodyRowValue;
this.args.setRowValue(columnId, rowId, value);
}
@action
addRow() {
const columnId = this.args.columnId;
const rowId = this.args.allRows.length + 1;
this.args.addRow(columnId, rowId);
}
@action
removeRow() {
this.args.removeRow(this.args.columnId, this.args.row);
}
}