Skip to content
This repository was archived by the owner on Apr 5, 2020. It is now read-only.

Commit 4af9438

Browse files
committed
page template select live updating template
1 parent 2c6b5e7 commit 4af9438

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/components/Pages/Page/Edit.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,18 +292,13 @@ class PageEdit extends React.Component {
292292
}
293293
}
294294

295-
/**
296-
* Hander for when the value of the page template from the DropDown is changed.
297-
* @param {integer} templateId - The new template id
298-
* @return undefined
299-
*/
300-
handleTemplateChange(templateId) {
301-
if(this.state.templateId === templateId){
295+
handleTemplateChange(templateOption) {
296+
if(this.state.templateId === templateOption.id){
302297
return;
303298
}
304299

305300
this.updateData();
306-
this.updateTemplate(templateId);
301+
this.updateTemplate(templateOption.id);
307302
}
308303

309304
updateTemplate(templateId) {
@@ -382,7 +377,7 @@ class PageEdit extends React.Component {
382377
options={this.state.templateOptions}
383378
indexes={this.state.templateIds}
384379
selectedOption={this.state.templateOptions[this.state.templateId]}
385-
handleChangeCallback={(templateId) => this.handleTemplateChange(templateId)}
380+
handleChangeCallback={(selectedOption) => this.handleTemplateChange(selectedOption)}
386381
/>
387382
{/* Do not display the slug text field if this is the homepage (page with full_path of "/") */}
388383
{this.state.editContext === 'edit' && this.state.full_path === '/' ?

0 commit comments

Comments
 (0)