Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/230#discussion_r23399875
--- Diff: app/addons/documents/views.js ---
@@ -564,15 +591,79 @@ function(app, FauxtonAPI, Components, Documents,
Databases, Views, QueryOptions)
this.toggleTrash();
this.maybeHighlightAllButton();
+ this.updateExpandButtonLabel();
},
perPage: function () {
return this.allDocsNumber.perPage();
+ },
+
+ // a bit dense, but necessary. It decides on what the Expand/Collapse
button label should be and takes into
+ // account the default expand/collapse state, what rows are checked
and their states
+ updateExpandButtonLabel: function () {
+
+ if (this.defaultDocsStateExpanded) {
+ this.setExpandButtonLabel(false);
+
+ // override the default label and show "Expand" if ALL checked
rows have state === collapse (false)
+ if (this.numSelectedOnPage() &&
this.allCheckedRowsHaveState(false)) {
+ this.setExpandButtonLabel(true);
+ }
+ } else {
+ this.setExpandButtonLabel(true); // default show "Expand"
+
+ // show "Collapse" if ALL checked rows have state === expanded
(true)
+ if (this.numSelectedOnPage() &&
this.allCheckedRowsHaveState(true)) {
+ this.setExpandButtonLabel(false);
+ }
+ }
+ },
--- End diff --
It is a bit dense, yeah. I'll check over your code (second return should be
in the `if`, presumably?)
---
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.
---