Skip to content

Commit 8459a63

Browse files
committed
Add: Delete Button For Each Question
1 parent ad1f5f4 commit 8459a63

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# See https://help.github.com/ignore-files/ for more about ignoring files.
22

3+
#WebStorm local user files
4+
/.idea/
5+
36
# compiled output
47
/dist/
58
/tmp/

app/pods/questions/index/controller.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import Controller from '@ember/controller';
33
export default Controller.extend({
44
queryParams: ['page', 'limit'],
55
page: 1,
6-
limit: 10
6+
limit: 10,
7+
actions : {
8+
deleteQuestion(question) {
9+
question.destroyRecord()
10+
}
11+
}
712

813
});

app/pods/questions/index/template.hbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<p class="card-text">
1515
{{question.description}}
1616
</p>
17+
<div class="button-solid">
18+
<button {{action "deleteQuestion" question}}>Delete</button>
19+
</div>
1720
<div class="button-solid">
1821
{{#link-to 'questions.id' question.id class="white"}}
1922
<button>Edit</button>

0 commit comments

Comments
 (0)