Coder Social home page Coder Social logo

Comments (2)

geekdave avatar geekdave commented on July 2, 2024

If I understand correctly, your issue is not with code inside backbone-subroute, itself... but rather with the the above code snippet that instantiates subroutes.

Specifically, it sounds like your route ":appName/*navPath": "loadApp" stops working for already-visited routes. Actually it's probably not the case that it stopped working... but it's just that a more specific route was created by your subrouter and backbone is matching that route instead of this base one.

So is it possible to remove all the subroutes that have already been initialized? This is a core Backbone Router question, and it's already been decided here. The answer is no. Jeremy Ashkenas said:

You should never be "removing" a route. URLs are supposed to be permanent. If you mint it, you keep it.

So I think this needs to be resolved in your application code, given the above assumptions about routes being permanent. Perhaps instead of enforcing the hasPermissions check at subroute instantiation time, it should be done at the time when a particular base view is created? This way, you would also have the advantage of being able to provide a descriptive "Access Denied" message in the UI instead of just silently ignoring the route (like your code seems to do now).

from backbone.subroute.

patrixd avatar patrixd commented on July 2, 2024

Thank you for your help. Your idea is great. I allways go to a method
related with de module or subroute, where I could check the permissions. I
sometimes chek pemissions of specified views. With the check of the
subroute where I did it, avoids to me check again and again the
permissions. But when I needed to change initial configuration and
permission I got in that trouble.

Kind regards

El 05/07/2013, a las 22:27, Dave Cadwallader [email protected]
escribió:

If I understand correctly, your issue is not with code inside
backbone-subroute, itself... but rather with the the above code snippet
that instantiates subroutes.

Specifically, it sounds like your route ":appName/*navPath":
"loadApp"stops working for already-visited routes. Actually it's
probably not the
case that it stopped working... but it's just that a more specific route
was created by your subrouter and backbone is matching that route instead
of this base one.

So is it possible to remove all the subroutes that have already been
initialized? This is a core Backbone Router question, and it's already been
decided here jashkenas/backbone#1272. The
answer is no. Jeremy Ashkenas said:

You should never be "removing" a route. URLs are supposed to be permanent.
If you mint it, you keep it.

So I think this needs to be resolved in your application code, given the
above assumptions about routes being permanent. Perhaps instead of
enforcing the hasPermissions check at subroute instantiation time, it
should be done at the time when a particular base view is created? This
way, you would also have the advantage of being able to provide a
descriptive "Access Denied" message in the UI instead of just silently
ignoring the route (like your code seems to do now).


Reply to this email directly or view it on
GitHubhttps://github.com//issues/24#issuecomment-20537512
.

from backbone.subroute.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.