Skip to content
Snippets Groups Projects
Commit 0ff81732 authored by Eugen Ciur's avatar Eugen Ciur
Browse files

Delete roles

parent 92867a61
No related branches found
No related tags found
No related merge requests found
<tr>
<td>
{{@role.name}}
</td>
<td>
{{@role.created_at}}
</td>
<td>
{{@role.updated_at}}
</td>
<td>
<button class="btn btn-link" type="button"> Edit
</button>
<Button::Link
@text="Remove"
@onClick={{(fn this.onRemove @role)}} />
</td>
</tr>
\ No newline at end of file
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
class TableRowComponent extends Component {
@action
async onRemove(role) {
await role.destroyRecord();
}
}
export default TableRowComponent;
\ No newline at end of file
...@@ -2,7 +2,7 @@ import Model, { attr, hasMany } from '@ember-data/model'; ...@@ -2,7 +2,7 @@ import Model, { attr, hasMany } from '@ember-data/model';
class RoleModel extends Model { class RoleModel extends Model {
@attr name; @attr name;
@hasMany('permissions') permissions; @hasMany('permission') permissions;
@attr created_at; @attr created_at;
@attr updated_at; @attr updated_at;
} }
......
...@@ -12,22 +12,7 @@ ...@@ -12,22 +12,7 @@
</thead> </thead>
<tbody> <tbody>
{{#each @model as |role|}} {{#each @model as |role|}}
<tr> <Role::TableRow @role={{role}} />
<td>
{{role.name}}
</td>
<td>
{{role.created_at}}
</td>
<td>
{{role.updated_at}}
</td>
<td>
<button class="btn btn-link" type="button"> Edit
</button>
<button class="btn btn-link" type="button">Remove</button>
</td>
</tr>
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment