Skip to content

Commit

Permalink
Fix multiple issues with CI overview description field
Browse files Browse the repository at this point in the history
Several problems here, the cursor was umping when editing, changes were
not being saved, and reverting changes was breaking the whole page.
  • Loading branch information
jrjohnson committed Aug 18, 2016
1 parent f77774e commit 6f65d3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/components/curriculum-inventory-report-overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
},
}
});
19 changes: 8 additions & 11 deletions app/templates/components/curriculum-inventory-report-overview.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{{inplace-select value=report.year displayValueOverride=report.yearLabel options=yearOptions save="changeYear"}}
{{/if}}
</div>

<div class="block">
<label>{{t "general.program"}}:</label>
<span>{{report.program.title}} ({{report.program.shortTitle}})</span>
Expand All @@ -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')
}}
<textarea
onchange={{action (mut description) value="target.value"}}
value={{description}}
disabled={{isSaving}}
onkeypress={{action 'addErrorDisplayFor' 'description'}}
>{{description}}</textarea>
{{#if (and (v-get this 'description' 'isInvalid') (is-in showErrorsFor 'description'))}}
<span class="validation-error-message">{{v-get this 'description' 'message'}}</span>
{{/if}}
Expand Down

0 comments on commit 6f65d3f

Please sign in to comment.