Skip to content
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

[Feature]: Add a pageName object that can be referenced in code #36103

Closed
1 task done
leonlazic opened this issue Sep 3, 2024 · 2 comments
Closed
1 task done

[Feature]: Add a pageName object that can be referenced in code #36103

leonlazic opened this issue Sep 3, 2024 · 2 comments
Assignees
Labels
Enhancement New feature or request Framework Functions Cases related to internal functions like showAlert(), navigateTo() etc... Javascript Product Issues related to users writing javascript in appsmith Query & JS Pod Issues related to the query & JS Pod

Comments

@leonlazic
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Summary

I would like for something like appsmith.url.pageName to exist. I want it to have the exact name with the capitalisation so it can be used in navigate to functions. This would be very usefull for creating back buttons withing the app. I am imagining the this page name could be stored in the url parameter. I know I can hard code this but changing the page name would break things and it would also be useful for other things like showing the title of the page within a text widget.

image

Why should this be worked on?

Enables to set the page name of the previous page in the url which can then be used on the new page to navigate back to the previous one.

@leonlazic leonlazic added the Enhancement New feature or request label Sep 3, 2024
@Nikhil-Nandagopal Nikhil-Nandagopal added the Framework Functions Cases related to internal functions like showAlert(), navigateTo() etc... label Sep 5, 2024
@github-actions github-actions bot added Javascript Product Issues related to users writing javascript in appsmith Query & JS Pod Issues related to the query & JS Pod labels Sep 5, 2024
@leonlazic
Copy link
Author

I have managed to do the navigation just by going to the url. But displaying the page name in UI from the url is really annoying. Since you have to split the words by hyphens and capitalise the ones that are capitalised.

I'm currently using this function but it has quite some issues. Only works for 2 word pages and capitalises every word.

get_page_name_from_url() {
  const page_name = [appsmith.URL.fullPath.split("/")[5].split("-")[0].charAt(0).toUpperCase() + appsmith.URL.fullPath.split("/")[5].split("-")[0].slice(1), appsmith.URL.fullPath.split("/")[5].split("-")[1].charAt(0).toUpperCase() + appsmith.URL.fullPath.split("/")[5].split("-")[1].slice(1)].join(" ") 

return page_name
}

@Nikhil-Nandagopal
Copy link
Contributor

Closing this in favor of #26610

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Framework Functions Cases related to internal functions like showAlert(), navigateTo() etc... Javascript Product Issues related to users writing javascript in appsmith Query & JS Pod Issues related to the query & JS Pod
Projects
None yet
Development

No branches or pull requests

4 participants