Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Create a mixin for confirmation dialogs when working with long forms

Đang mở
#1,569 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@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ả

Difficulty: Easy in progress Priority: Low Skill: Ember.js

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

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của code-corps/code-corps-ember

Tất cả issue của code-corps/code-corps-ember

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.