From 6f65d3fe9345c4b0a9f70be7c5ab234f40a89b94 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Thu, 18 Aug 2016 13:42:53 -0700 Subject: [PATCH] Fix multiple issues with CI overview description field Several problems here, the cursor was umping when editing, changes were not being saved, and reverting changes was breaking the whole page. --- .../curriculum-inventory-report-overview.js | 4 ++-- .../curriculum-inventory-report-overview.hbs | 19 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/components/curriculum-inventory-report-overview.js b/app/components/curriculum-inventory-report-overview.js index 636fbaa536..83e124c0ff 100644 --- a/app/components/curriculum-inventory-report-overview.js +++ b/app/components/curriculum-inventory-report-overview.js @@ -78,8 +78,8 @@ export default Component.extend(Validations, ValidationErrorDisplay, { }); }, revertDescriptionChanges(){ - const program = this.get('report'); - this.set('report', program.get('description')); + const report = this.get('report'); + this.set('description', report.get('description')); }, } }); diff --git a/app/templates/components/curriculum-inventory-report-overview.hbs b/app/templates/components/curriculum-inventory-report-overview.hbs index 6091876d33..ee00f6c403 100644 --- a/app/templates/components/curriculum-inventory-report-overview.hbs +++ b/app/templates/components/curriculum-inventory-report-overview.hbs @@ -29,7 +29,7 @@ {{inplace-select value=report.year displayValueOverride=report.yearLabel options=yearOptions save="changeYear"}} {{/if}} - +
{{report.program.title}} ({{report.program.shortTitle}}) @@ -41,21 +41,18 @@ {{report.description}} {{else}} {{#editable-field - value=shortTitle + value=description save=(action 'changeDescription') close=(action 'revertDescriptionChanges') clickPrompt=(if report.description report.description (t 'general.clickToEdit')) as |isSaving save close| }} - {{one-way-textarea - value=description - update=(action (mut description)) - onenter=save - onescape=close - disabled=isSaving - focusOut=(action 'addErrorDisplayFor' 'description') - keyPress=(action 'addErrorDisplayFor' 'description') - }} + {{#if (and (v-get this 'description' 'isInvalid') (is-in showErrorsFor 'description'))}} {{v-get this 'description' 'message'}} {{/if}}