-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notifications? #151
Comments
I've just added an example email notification to admins when a draft post is created to the SydJS Site (It's been on my list for ages) Check out the commit here to see how it works. That commit doesn't include the email templates, which have been in place for a while. You could easily bind the send to something other than the form submission in the view controller, for example, after the Post has been created, using middleware like this: Post.schema.post('save', function() {
if (this.wasNew && this.state == 'draft') {
this.notifyAdmins()
}
}); ... however, I don't want it notifying anyone if someone creates a draft post in Keystone's Admin UI, which this would do. So I trigger it from the route handler. In related news, the email functionality isn't really documented yet, but very cool: check out how SydJS is doing it. We're using the keystone.Email class, which handles Mandrill for you, but also includes a default template which you can customise by
Hope this helps. |
Time to start hacking away :). We use Handlebars (converted from smarty) for all of our email templates and will be storing them in the DB. Looking at lib/email.js looks like you have hard coded to jade extension. Can I suggest at some point that you look at moving Keystone to consolidate (https://github.com/visionmedia/consolidate.js) for easier support of any express template engine? Then it would truely be an option switch away. Jade isn't something that is easy for non-developers to pickup IMHO, and the users of the site I'm working on are used to their HTML WYSIWYG Email editor. If I create an email2 module based on consolidate would you be interested in it?
|
Hey Jeremy, That's been on my list, the Email class really needs some love in the form of flexibility and docs. Thanks for the offer to create an email2 module, I'd actually go one better and suggest you update the existing Email.js class to add support for consolidate. The web views already support any engine that you can use with Express, either through the default support or by providing a custom engine. For consistency, we should add a Keystone option called 'email engine' (to go with the 'view engine' option) and the Email class could decide from there. (You don't need to do anything special to add this, just refer to If the option isn't set (or is set to |
This is now covered by our yeoman generator. |
Where would you tie in on your model or view controller to send notifications when a new one is created? I was trying to look through the SydJs example but I don't see exactly where this is done.
Would like to extend my existing blog, post, link, user signup, etc so that administrators get an email if they have signed up for the notification when an action occurs.
The text was updated successfully, but these errors were encountered: