Comments (2)
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.
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)
- Routes with named params HOT 6
- Suggestion: returning Backbone.navigate or at least returning "this" HOT 3
- Polluted Routes when using a common base router class HOT 5
- Problem with Backbone AMD HOT 3
- Minified version produces wrong route HOT 1
- Filter support HOT 5
- Publish latest version to npm HOT 1
- Backbone and underscore should be dependencies (not devDependencies) HOT 1
- Route gets triggered twice HOT 3
- accessing router initialize parameters from the route callback? HOT 3
- using back button does not re-trigger all my routes
- loadUrl into uninitialized subroute fails HOT 3
- Seeking New Ownership! HOT 6
- Specify createTrailingSlashRoutes as an instance property when extending from Backbone.Subroute
- handling zombie views in the subroute
- Update bower info
- npm support
- Regex routes
- Multiple SubRoutes - is it possible?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backbone.subroute.