Github user benkeen commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/119#issuecomment-61203128
Hey @robertkowalski, @ocelotpotpie.
With @garrensmith away I decided to go rogue and do some craazzzy stuff
with this ticket. Mwahahah!! But seriously, feedback would be great.
Let me highlight the unusual parts to explain my rationale.
1. I added a new Components.LookaheadTray, with the idea that itâs an
all-purpose thing and can be used anywhere. For this ticket, it was needed
inside the breadcrumbs on the Database pages; i.e. when you click on a database
name in the breadcrumb, it would show the tray.
2. I *didnât* instantiate this new component from within the breadcrumbs
component. Instead, breadcrumb just adds a special data-event=âxâ role + a
special classname to the database name in the breadcrumb. Thatâs all. The
breadcrumbs component is a nice straightforward, self-contained component.
Adding in an optional way to instantiate a sub-View that did this just seems
wrong. But true, that would be in keeping with the current codebase.
3. I added a new way to pass anonymously pass messages between any chunks
of code. To use it, you can add a data-event=âXâ attribute to any element.
When that element is clicked and the event bubbles up to the document element,
a Fauxton event is fired with a reference to the element that was clicked (see
app/main.js).
4. The lookahead component subscribes to that particular event to show/hide
itself. We can have unique events for each instance, if need be. Hereâs the
weird part: the lookahead tray then adds/removes a class to the breadcrumb
(database name) to change the style. Agreed, this isnât great.
5. One last thing to point out. As we know, when triggering a
Fauxton.navigate() change to the same route object that youâre currently on,
it wonât retrigger the route objectâs initialize(). In 99% of cases this is
what we want. But in the case of this, all the setup work done in initialize()
needed to be undone. Changing databases really. So I added a new `reinitialize`
option to enforce the entire route to be reloaded, like so:
```javascript
FauxtonAPI.navigate(â/â, { reinitialize: true });
```
I do think this is a legit use for this, but I worry it may be abused.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---