mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
Added auto generated offer code for new offers
closes https://github.com/TryGhost/Team/issues/1784 - auto generates offer code for new offers from name, same as display name - stops auto generation as soon as offer code is manually edited once
This commit is contained in:
parent
7ea1c2591b
commit
00f2c73d93
@ -57,6 +57,7 @@ export default class OffersController extends Controller {
|
|||||||
|
|
||||||
@tracked defaultProps = null;
|
@tracked defaultProps = null;
|
||||||
@tracked isDisplayTitleEdited = false;
|
@tracked isDisplayTitleEdited = false;
|
||||||
|
@tracked isOfferCodeEdited = false;
|
||||||
|
|
||||||
leaveScreenTransition = null;
|
leaveScreenTransition = null;
|
||||||
portalPreviewGuid = Date.now().valueOf();
|
portalPreviewGuid = Date.now().valueOf();
|
||||||
@ -335,6 +336,10 @@ export default class OffersController extends Controller {
|
|||||||
if (!this.isDisplayTitleEdited && this.offer.isNew) {
|
if (!this.isDisplayTitleEdited && this.offer.isNew) {
|
||||||
this._saveOfferProperty('displayTitle', e.target.value);
|
this._saveOfferProperty('displayTitle', e.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.isOfferCodeEdited && this.offer.isNew) {
|
||||||
|
this._saveOfferProperty('code', slugify(e.target.value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
@ -350,6 +355,7 @@ export default class OffersController extends Controller {
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
setOfferCode(e) {
|
setOfferCode(e) {
|
||||||
|
this.isOfferCodeEdited = true;
|
||||||
this._saveOfferProperty('code', e.target.value);
|
this._saveOfferProperty('code', e.target.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user