Skip to content
Permalink
Browse files

feat(cf-form): allow passing context information to cf-form, cf-navig…

…ation (#218)

feat(cf-form): allow passing context information to cf-form, cf-navigation
  • Loading branch information...
anehx committed May 9, 2019
2 parents 2d7d6fe + 149e92e commit 2955dc6602c930d700b238eeabf4cf05c7926f8c
@@ -54,6 +54,14 @@ export default Component.extend(ComponentQueryManager, {
*/
overrides: null,

/**
* Can be used to pass "context" information from the outside through
* to custom overrides.
*
* @argument {*} overrides
*/
context: null,

didReceiveAttrs() {
this._super(...arguments);
if (this.documentId) {
@@ -6,12 +6,46 @@ import { ComponentQueryManager } from "ember-apollo-client";
import { task } from "ember-concurrency";
import getNavigationQuery from "ember-caluma/gql/queries/get-navigation";

/**
* Component to display a nested form including navigation.
*
* ```hbs
* {{cf-navigation documentId="myDocId" section=section subSection=subSection}}
* ```
*
* @class CfFormComponent
*/
export default Component.extend(ComponentQueryManager, {
layout,
documentStore: service(),

/**
* The ID of the nested document to display the navigation for
* @argument {String} documentId
*/
documentId: null,
activeDocumentId: null,

/**
* Can be used to pass "context" information from the outside through
* to custom overrides.
*
* @argument {*} context
*/
context: null,

/**
* Form slug of currently visible section
*
* @argument {String} section
*/
section: null,

/**
* Form slug of currently visible sub-section
*
* @argument {String} subSection
*/
subSection: null,

_currentDocumentId: null,

@@ -5,7 +5,7 @@
<div class="uk-flex">
<div class="uk-width-expand">
{{#if componentOverride}}
{{component componentOverride field=field disabled=disabled onSave=(perform save)}}
{{component componentOverride field=field disabled=disabled context=context onSave=(perform save)}}
{{else}}
{{cf-field/input field=field disabled=disabled onSave=(perform save)}}
{{/if}}
@@ -1,3 +1,3 @@
{{#each _document.fields as |field|}}
{{cf-field field=field disabled=disabled}}
{{cf-field field=field disabled=disabled context=context}}
{{/each}}
@@ -33,7 +33,7 @@
</div>

<div class="uk-width-1-1 uk-width-2-3@m">
{{cf-form document=displayedDocument}}
{{cf-form document=displayedDocument context=context}}
</div>
{{/if}}
</div>

0 comments on commit 2955dc6

Please sign in to comment.
You can’t perform that action at this time.