Comments (4)
By design. You can't instantiate an abstract class in OOP, right? same thing.
You are overthinking it. Try:
route('colors', {path: '/colors', routeClass: ColorsIndexRoute}, function () {
route('colors.new', {path: 'new', routeClass: ColorsCreateRoute});
})
btw routeClass
is probably a react-cherrytree thing, it's not core to cherrytree. But my solution still applies. We have a navigation bar in a knockout-based application, and it marks it active by looking for the colors
named route in any of the routes
in router.state.routes
.
from cherrytree.
By design. You can't instantiate an abstract class in OOP, right? same thing.
The abstract route is the only primitive provided by cherrytree to create a index route similar to what ember provides, as pointed in the docs, if there's another way i'll be glad use it
route('colors', {path: '/colors', routeClass: ColorsIndexRoute}, function () {
route('colors.new', {path: 'new', routeClass: ColorsCreateRoute});
})
It will not work because ColorsCreateRoute will become child of ColorsIndexRoute when its a sibling
The colors route has an outlet element (similar to Ember outlet or VueRouter router-view) where the children is rendered
something like
<div>
<h1>Colors<h1>
<div class="outlet"></div> //-> here colors.index or colors.new or colors.show are rendered
</div>
Actual code: https://github.com/blikblum/marionette-wires-revisited/blob/master/src/main.js
from cherrytree.
OK I see the use case - there is a common shell for each of the children, but you can't route to that shell you need to pick a sibling.
from cherrytree.
Sorry I missed the issue when you originally posted!
Hm, interesting problem, I guess a ~dirty workaround is to just do something like router.isActive(route.replace('.index', '').replace('index', 'app'))
. Which is kind of semantically correct - if you wanted to know if 'books.index' is active, you'd do isActive('books.index')
, but you want to know if 'books' is active, so you need to do isActive('books')
.
I'll look over your PR and the other issue now.
from cherrytree.
Related Issues (20)
- Add routes dinamically. Is it possible? HOT 2
- Fix tests. Oopsy. HOT 1
- Handle url Entries HOT 2
- Menu has dark blue highlights on black text HOT 1
- Menu has dark blue highlights on black text HOT 1
- Feature request: Ability to drag-and-drop images or to embed files HOT 2
- Are url hashes supported with pushState: true? HOT 9
- query param with urlencoded newline breakes route detection HOT 1
- Clarify Route Nesting example in the guide HOT 1
- Error transitioning to an abstract route with an index route HOT 3
- Transition silently
- Transition resolve handler added by middleware runs after handler added by application HOT 10
- Saucelabs build is failing HOT 2
- Route names must be unique error! But different leaf nodes. HOT 1
- The latest release in npm is not compiled to ES5 (?) HOT 1
- Consider replacing webpack by rollup
- cherrytree abandoned? HOT 3
- Interest in keeping cherrytree development HOT 7
- Provide typescript definitions HOT 2
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 cherrytree.