• Threads
  • Categories
  • Users
  • Documentation
  • GitHub
  • Discord
  • forum
  • group
  • search
  1. Threads
  2. Changing Look and Feel
chevron_left Changing Look and Feel

Changed go back URL not working

  • forum 9 replies
  • last reply by test69 Sept. 15, 2017
  • Last
  • link
    test69
    Members 15 posts
    Sept. 14, 2017, 10:59 p.m. Sept. 14, 2017, 10:59 p.m.
    link

    I have one more question, sorry for that. But I think I am really near to modify misago to my needs.
    If I change the URL on the backbutton on category threads overview to "/" (configured it so that / will be the categories page) it will not forward to "/". Only links that work are the normal parent category URL, "/threads/" but just not "/" and also "/categories/" is not working. Do you have any idea why the link to that sites might not work?

    Best and thanks again

  • link
    rafalp
    Project Lead 1476 posts
    Sept. 14, 2017, 11:02 p.m. Sept. 14, 2017, 11:02 p.m.
    link

    Please follow one question = one thread rule. Its in place for good reasons like keeping threads searchable by others ;)

  • link
    test69
    Members 15 posts
    Sept. 14, 2017, 11:08 p.m. Sept. 14, 2017, 11:08 p.m.
    link
    @rafalp has written:

    Please follow one question = one thread rule. Its in place for good reasons like keeping threads searchable by others ;)

    Sorry, kinda thought it might fit into the other question and would not spam the forum too much.

    So there is no way to be able to redirect to "/" on back button?

  • link
    rafalp
    Project Lead 1476 posts
    Sept. 14, 2017, 11:10 p.m. Sept. 14, 2017, 11:10 p.m.
    link

    So there is no way to be able to redirect to "/" on back button?

    Lets start with what do you mean by "back button"? Can you explain?

    Sorry, kinda thought it might fit into the other question and would not spam the forum too much.

    The forum's here for people to start new threads. Disk space is cheap and plenty, and I'll step in if threads started are nonsensical, until then, the more the better. ;)

  • link
    test69
    Members 15 posts
    Sept. 14, 2017, 11:14 p.m. Sept. 14, 2017, 11:14 p.m.
    link

    Lets start with what do you mean by "back button"? Can you explain?

    Bildschirmfoto 2017-09-14 um 23.11.09.png

    I have a Child-Category. The normal usecase of misago is that on back button press it will redirect to the parent category and show all collected threads. What I want is not a redirect to the parent category but directly to the home page (aka /categories/). If I edit the links tho (in frontend .js) to "/" or "/categories/" it just changes the URL in the URL-Bar but will not redirect to the webpage. If I leave the parent category as a link or put in "/threads/" it will redirect to both of them.

    Bildschirmfoto 2017-09-14 um 23.11.09.png

    PNG, 136.8 KB, uploaded by test69 on Sept. 14, 2017.

  • link
    rafalp
    Project Lead 1476 posts
    Sept. 14, 2017, 11:20 p.m. Sept. 14, 2017, 11:20 p.m.
    link

    I see. This button is actually React Router's <Link>, which overtakes the clicks, and there's no react route for /categories/ on threads list. To get behaviour you want you'll need to customize the getGoBackButton method to return <a> instead of <Link> when parent.url.index === '/'.

  • link
    test69
    Members 15 posts
    Sept. 14, 2017, 11:40 p.m. Sept. 14, 2017, 11:40 p.m.
    link
    @rafalp has written:

    I see. This button is actually React Router's <Link>, which overtakes the clicks, and there's no react route for /categories/ on threads list. To get behaviour you want you'll need to customize the getGoBackButton method to return <a> instead of <Link> when parent.url.index === '/'.

    Awesome, thanks again. The check didn't really wanted to work but as I changed the link to <a> directly its working fine now as I intended.

  • link
    test69
    Members 15 posts
    Sept. 15, 2017, 12:35 a.m. Sept. 15, 2017, 12:35 a.m.
    link

    If anyone is interested how I fixed it:
    if(this.props.categories[parent.parent].parent) {...} else {...}
    Basically checks if the next parent category is the last parent category, then I simply return a <a> if there are other parent categories in between it will return the already implemented <link>

  • link
    rafalp
    Project Lead 1476 posts
    Sept. 15, 2017, 12:36 a.m. Sept. 15, 2017, 12:36 a.m.
    link

    I think there's also depth attribute on the parent to see how close to the root one is, with depth === 0 meaning root category and 1 being admin-defined top-level categories.

  • link
    test69
    Members 15 posts
    Sept. 15, 2017, 12:45 a.m. Sept. 15, 2017, 12:45 a.m.
    link
    @rafalp has written:

    I think there's also depth attribute on the parent to see how close to the root one is, with depth === 0 meaning root category and 1 being admin-defined top-level categories.

    parent.depth seems unfortunately undefined

There are no more posts in this thread.

  • This site uses cookies to gather statistical data for use in traffic analysis.
  • Documentation
  • GitHub
  • Discord
  • Terms of service
  • Privacy policy
powered by misago