Create a mixin for confirmation dialogs when working with long forms
@snewcomer đang làm issue này rồi.
Từ ngày 9/12/2017.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Problem
We have a number of places where we ask a user to confirm before leaving the page. We could write a mixin to help clean up this logic.
export default Ember.Mixin.extend({;
modelName: null,
message: 'You will lose any unsaved information if you leave this page. Are you sure?',
actions: {
willTransition() {
let modelName = get(this, 'modelName');
if (isPresent(modelName)) {
let model = get(this, modelName);
if (get(modelName, 'isNew') {
this._confirmTransition(transition, model);
}
} else {
this._confirmTransition(transition);
}
}
},
_confirmTransition(transition, model) {
let message = get(this, 'message');
if (window.confirm(message)) {
if isPresent(model) {
model.destroyRecord();
}
} else {
transition.abort();
}
}
})
- Ngôn ngữ chính
- JavaScript
- Star
- 120
- Fork
- 75
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của code-corps/code-corps-ember
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
code-corps/code-corps-ember#1616 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
code-corps/code-corps-ember#1613 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
code-corps/code-corps-ember#1612 ·
-
Difficulty: Medium Skill: ember-cli-page-object
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
code-corps/code-corps-ember#1063 · 1 reaction ·
-
greenkeeper
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
code-corps/code-corps-ember#1765 · 1 bình luận ·
Tất cả issue của code-corps/code-corps-ember
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
neondatabase/website#5944 ·
-
module: core
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
bigbluebutton/bigbluebutton#25849 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·