Skip to content

Commit 0f624bf

Browse files
authored
Merge pull request #4 from firefinchdev/master
Add: Delete Button With Confirmation For Each Question
2 parents ad1f5f4 + 2b76305 commit 0f624bf

File tree

7 files changed

+3908
-7
lines changed

7 files changed

+3908
-7
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
<p class="card-text">
1515
{{question.description}}
1616
</p>
17+
<div class="button-solid">
18+
{{#confirm-dialog
19+
dialogClass="custom-confirm-dialog"
20+
title="Delete Question"
21+
text="Are you sure you want to delete this question?"}}
22+
<button {{action "deleteQuestion" question}}>Delete</button>
23+
{{/confirm-dialog}}
24+
</div>
1725
<div class="button-solid">
1826
{{#link-to 'questions.id' question.id class="white"}}
1927
<button>Edit</button>

app/styles/app.scss

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
@import "ember-searchable-select/style";
2+
@import "ember-modal-dialog/ember-modal-structure";
3+
@import "ember-modal-dialog/ember-modal-appearance";
24

35
.card {
46
height: auto;
@@ -25,5 +27,22 @@
2527
}
2628

2729
.correct {
28-
background-color: rgba(0, 255, 0, 0.1);
29-
}
30+
background-color: rgba(0, 255, 0, 0.1);
31+
}
32+
.custom-confirm-dialog {
33+
34+
.dialog-title{
35+
background-color: #bbc7bc;
36+
font-weight: bold;
37+
padding: 10px;
38+
}
39+
40+
.dialog-text{
41+
margin: 0px;
42+
}
43+
44+
.dialog-footer{
45+
background-color: #fcffb0;
46+
padding: 5px;
47+
}
48+
}

0 commit comments

Comments
 (0)