-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cf-navigation): auto-link empty form sections to first subsection (…
…#185) Also remove top-level question because it provided no real value and broke the styling
- Loading branch information
Showing
3 changed files
with
42 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
import Component from "@ember/component"; | ||
import layout from "../templates/components/cf-navigation-item"; | ||
import { computed } from "@ember/object"; | ||
|
||
export default Component.extend({ | ||
tagName: "", | ||
layout, | ||
|
||
section: null, | ||
subSection: null | ||
subSection: null, | ||
|
||
_subSection: computed( | ||
"subSection", | ||
"field.childDocument.fields.[]", | ||
function() { | ||
if ( | ||
!this.get("subSection") && | ||
!(this.get("field.childDocument.fields") || []).some( | ||
f => f.get("question.__typename") !== "FormQuestion" | ||
) | ||
) { | ||
return this.get("field.childDocument.fields.firstObject.question.slug"); | ||
} | ||
return this.get("subSection"); | ||
} | ||
) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters