Tonkpils / ember-sweetalert

Ember CLI addon for SweetAlert2
MIT License
19 stars 10 forks source link

1.0 #13

Closed lindyhopchris closed 5 years ago

lindyhopchris commented 6 years ago

So this is a work in progress pull request for what 1.0 could potentially look like. Opening this for discussion!

Thing's I've added:

Some example usages:

{{sweet-alert "Ember CLI Sweet Alert" "Awesome!" "success"
  show=toggleModal
  onOpen=(action (mut cancellation) null)
  onConfirm=(action (mut enterEmail) true)
  onCancel=(action "cancelled")
}}

{{sweet-alert
  show=enterEmail
  title="Submit email to run ajax request"
  input="email"
  showCancelButton=true
  confirmButtonText="submit"
  allowOutsideClick=false
  preConfirm=(action "loading")
  onConfirm=(action "updateEmail")
}}

Things to add:

Let me know comments and ideas!

Tonkpils commented 6 years ago

These changes all look good to me so far. I'm really excited to provide this through npm and not bower.

Would be useful for this addon to provide test helpers.

I definitely think this would be really useful for users.

@lindyhopchris I really appreciate you taking lead on this upgrade and moving the addon forward. 🙇

lindyhopchris commented 6 years ago

@Tonkpils no problem. sorry it's taken me so long to get round to it - had to wait until it was something I actually needed to do as part of what I'm working on.

Will push some more commits with some of the extra stuff.

lxcodes commented 6 years ago

@lindyhopchris Apologies if this is too soon; been waiting on this one for a bit and in the same position as you. Tried to install this into a project, but it's failing on calling sweetAlert it seems on this line (0, _sweetalert.default)(props).then(resolve, reject);.

Is this something we can work on clearing up? May just be that I'm not import properly.

VM3151:1 Uncaught TypeError: _sweetalert.default is not a function
    at eval (eval at <anonymous> (vendor.js:132937), <anonymous>:1:20)
    at vendor.js:132937
    at initializePromise (vendor.js:66127)
    at new Promise (vendor.js:66607)
    at Class._displaySweetAlert (vendor.js:132936)
    at Class.didInsertElement (vendor.js:132924)
    at Class.superWrapper [as didInsertElement] (vendor.js:58716)
    at Class.trigger (vendor.js:61003)
    at Class.superWrapper [as trigger] (vendor.js:58716)
    at CurlyComponentManager.didCreate (vendor.js:34678)
new Ember.RSVP.Promise(function (resolve, reject) {
    (0, _sweetalert.default)(props).then(resolve, reject);
}).then(result => {
    if (result.value) {
        Ember.get(this, 'onConfirm')(result);
    } else {
        Ember.get(this, 'onCancel')(result);
    }

    Ember.set(this, 'show', false);
});
lindyhopchris commented 6 years ago

Hi @al3x-edge

I just installed the 1.0 branch in a fresh Ember app and the {{sweet-alert}} component is working fine. So not sure what's going on in your app. In upgrading did you remove sweet alert from your bower.json?

lxcodes commented 6 years ago

Might not have actually. I’ll give it a shot when I get a chance later today. Is there a specific way to install to a new project besides ember install #1.0? On Sat, Jul 14, 2018 at 1:34 AM Christopher Gammie notifications@github.com wrote:

Hi @al3x-edge https://github.com/al3x-edge

I just installed the 1.0 branch in a fresh Ember app and the {{sweet-alert}} component is working fine. So not sure what's going on in your app. In upgrading did you remove sweet alert from your bower.json?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Tonkpils/ember-sweetalert/pull/13#issuecomment-405000392, or mute the thread https://github.com/notifications/unsubscribe-auth/AADys1M7tWBgE73gNF3zXbSw0wLwVEIrks5uGYLbgaJpZM4U7LGq .

lindyhopchris commented 6 years ago

@Tonkpils think this can probably be merged into develop now? Also, maybe we should release a 1.0.0-alpha.1? Would definitely be good to get feedback from people before actually releasing as 1.0.0.

lindyhopchris commented 5 years ago

@Tonkpils I'm back on something at work that has Ember Sweet Alert in it, so this is my opportunity to try to get this all sorted. Should I proceed with merging and sorting out the remaining issues? Also did you want to give me access for doing NPM releases? You did offer at one stage and guessing from your silence that it might be a good idea if you don't have time to look at this project?

Tonkpils commented 5 years ago

Hey! Sorry it took me long to get back to you. Yeah, I can definitely give you access! Let me get to a computer and I’ll do that right away :)

Tonkpils commented 5 years ago

Also did you want to give me access for doing NPM releases?

@lindyhopchris I'll need your NPM username. You can send it to the email on my profile and I'll get you added right away! 😄

lindyhopchris commented 5 years ago

@Tonkpils just emailed you!