Skip to content

Instantly share code, notes, and snippets.

@zidarsk8
Created August 5, 2017 22:38
Show Gist options
  • Save zidarsk8/add6beeded1599be3c82232cf25a00f8 to your computer and use it in GitHub Desktop.
Save zidarsk8/add6beeded1599be3c82232cf25a00f8 to your computer and use it in GitHub Desktop.
diff --git a/src/ggrc/assets/javascripts/components/assessment/info-pane/info-pane.js b/src/ggrc/assets/javascripts/components/assessment/info-pane/info-pane.js
index 2197432da..6d97098c5 100644
--- a/src/ggrc/assets/javascripts/components/assessment/info-pane/info-pane.js
+++ b/src/ggrc/assets/javascripts/components/assessment/info-pane/info-pane.js
@@ -190,10 +190,33 @@
.replace(this.loadUrls());
},
initializeFormFields: function () {
+ var cads = this.attr('instance.custom_attribute_definitions');
+ var cavs = this.attr('instance.custom_attribute_values');
+ var locals = [];
+ var globals = [];
+ var cad_map = {};
+ var i;
+ var cav;
+ for (i=0; i<cads.length; i++) {
+ cad_map[cads[i].id] = cads[i]
+ }
+ for (i=0; i<cavs.length; i++) {
+ cav = cavs[i];
+ if (cad_map[cav.custom_attribute_id].definition_id === null) {
+ globals.push(cav);
+ } else {
+ locals.push(cav);
+ }
+ }
+
this.attr('formFields',
- GGRC.Utils.CustomAttributes.convertValuesToFormFields(
- this.attr('instance.custom_attribute_values')
- )
+ GGRC.Utils.CustomAttributes.convertValuesToFormFields(cavs)
+ );
+ this.attr('formFieldsLocal',
+ GGRC.Utils.CustomAttributes.convertValuesToFormFields(locals)
+ );
+ this.attr('formFieldsGlobal',
+ GGRC.Utils.CustomAttributes.convertValuesToFormFields(globals)
);
},
onFormSave: function () {
diff --git a/src/ggrc/assets/mustache/components/assessment/info-pane/info-pane.mustache b/src/ggrc/assets/mustache/components/assessment/info-pane/info-pane.mustache
index 3682edaaa..e5dba3c63 100644
--- a/src/ggrc/assets/mustache/components/assessment/info-pane/info-pane.mustache
+++ b/src/ggrc/assets/mustache/components/assessment/info-pane/info-pane.mustache
@@ -134,7 +134,7 @@
{{/unless}}
</div>
</div>
- <auto-save-form {fields}="formFields"
+ <auto-save-form {fields}="formFieldsLocal"
{edit-mode}="editMode"
{save-callback}="@saveFormFields"
{trigger-save-cbs}="triggerFormSaveCbs"
@@ -192,6 +192,27 @@
{mapped-items}="relatedInformation"
title-text="Related Information"></assessment-mapped-related-information>
</div>
+ <div class="info-pane__section">
+ <div class="info-pane__section-title">
+ <div class="action-toolbar">
+ <div class="action-toolbar__content-item">Related Information</div>
+ </div>
+ </div>
+ {{log .}}
+ <auto-save-form {fields}="formFieldsGlobal"
+ {edit-mode}="editMode"
+ {save-callback}="@saveFormFields"
+ {trigger-save-cbs}="triggerFormSaveCbs"
+ {^fields-to-save-available}="formState.fieldsToSaveAvailable"
+ {^saving}="formState.saving"
+ {^all-saved}="formState.allSaved"
+ {^form-saved-deferred}="formState.formSavedDeferred"
+ {^is-dirty}="formState.isDirty"
+ {^has-validation-errors}="instance.hasValidationErrors"
+ {evidence-amount}="evidences.length"
+ (validation-changed)="showRequiredInfoModal(%event)"
+ ></auto-save-form>
+ </div>
</div>
<div class="assessment-comments info-pane__sidebar">
<div class="info-pane__section-title">Responses/Comments</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment