Very nice 😎
Getting current URL in templates.
<-- IF followers.length --> <-- IF following.length -->
If I use that, it displays only on followers/following page.
!followers.length doesn't seem to work and edit.length doesn't work either so I'm not sure how to do this :s
You can also use
ELSE. So, if I'm not mistaken, something like
<!-- IF followers.length --> <!-- ELSE --> Code here <!-- ENDIF followers.length -->
May produce better results.
Yep, that works, but there's also another pages using the menu at the top that I've just noticed.
Is there a way to check if the page is just settings or edit?
These seem to be the only ones that need the button.
We can possibly add the name of the current template into the api return. So that you can do stuff like
<!-- IF account/edit--> only shows up on edit page <!-- ENDIF account/edit -->
account/editwill be true when you are on the url
user/:username/editand false everywhere else.
So to solve your problem you would have to do
<!-- IF account/edit--> <!-- IMPORT partials/mySpecialButton.tpl --> <!-- ENDIF account/edit --> <!-- IF account/settings --> <!-- IMPORT partials/mySpecialButton.tpl --> <!-- ENDIF account/settings -->
So you can include a special template if the page is edit or settings.
yeah that makes sense to me. tbh maybe we should add the name of the template for all returns as a global var? so that there's no confusion for any custom routed api call -> templates such as the above routes
Yeah I was thinking of adding it here like this
options[template] = true;