Custom login, atForm - Template['override-atForm'].replaces('atForm') not working in 2.14

Worked in 1.10, but getting Template[‘override-atForm’].replaces is not a function error now.

accounts-ui, etc. all in place, same code, same packages

I see there are other ways of going about custom ui for sign in/sign up but any idea why .replaces is no longer working?

ChatGPT tells me Template.replaces() is deprecated. And I’ve got to use a layout template. It’s pretty confusing…

Hi,

I got this working by adding import { Template } from ‘meteor/templating’ to the router.
For me, after that, it does work:
Template.atTitleNL.replaces(“atTitle”);

regards,

Paul

1 Like

Thanks for your input @pwiegers - can I ask what version of Meteor you’re using? Also, where did you place the import? Was it in your override-atTitle.js file or elsewhere?

  1. I’m on 2.14
  2. I put it in the router.coffee

import '../../ui/pages/loginTemplates/atFormNL.html' Template.atFormNL.replaces("atForm")

1 Like

Thanks again @pwiegers. No need to reply if you’re busy, but I’m not familiar with router.coffee. I’m guessing coffescript? Is it similar to FlowRouter? I’ve previously built by override-atForm.js (etc.) files within a folder called accounts on the client which contains the .replaces functionality. I then built my custom html files using (again, etc.) and ultimately intialized using {{>atForm state=‘signIn’}} in the home page template. It’s worked well for styling the sign in/sign up forms in my 1.x apps, but this same structure threw the error on Template…replaces is not a function in 2.14

Any additional info would be much appreciated but I do undestand we’re in the weeds here so again no worries if your busy.

thanks again!

Hi @alschwar ,

No need to reply if you’re busy, but I’m not familiar with router.coffee. I’m guessing coffescript? Is it similar to FlowRouter?

Yes,. that is the router, when you use CoffeeScript, like I do :slight_smile:

I’ve previously built by override-atForm.js (etc.) files within a folder called accounts on the client which contains the .replaces functionality. I then built my custom html files using (again, etc.) and ultimately intialized using {{>atForm state=‘signIn’}} in the home page template. It’s worked well for styling the sign in/sign up forms in my 1.x apps, but this same structure threw the error on Template…replaces is not a function in 2.14
Any additional info would be much appreciated but I do undestand we’re in the weeds here so again no worries if your busy.

Did you include the package aldeed:template-extension in your app? (I did assume so, just double checking!)

I’m in the proces of basically rebuilding my app, moving from 2.1 to 2.14, due to the move of Atlas/Mongo to version 5. I don’t know if you did the same thing; in that case, you might have missed the aldeed-package :slight_smile:

I’m busy, like any developer, I guess. But it’s important to try and support each other!

It seems, though, we are on opposite sides of our globe :joy: I’m in Europe, but you are not?

regards,

Paul

1 Like

aldeed:template-extension seems to have done it! I missed re-adding this in when I built the new 2.14 app (it’s in my 1.10 app). I’m very grateful for your taking the time to think this through - it would seem ChatGPT still can’t compete with humanity with respect to true problem solving intuition :laughing:.
Thanks Paul! btw, I’m in the US, and agree that the thing that really makes the Meteor community special is the gracious support so many are willing to share.

You’re welcome! :slight_smile:
Glad I could help you solve this!

Paul

1 Like