2019-11-07 16:38:28 -05:00
|
|
|
import { observes } from "discourse-common/utils/decorators";
|
2023-02-14 09:20:15 -05:00
|
|
|
import WizardPreviewBaseComponent from "./wizard-preview-base";
|
2016-09-16 17:02:45 -04:00
|
|
|
|
2023-02-14 09:20:15 -05:00
|
|
|
export default WizardPreviewBaseComponent.extend({
|
|
|
|
width: 371,
|
|
|
|
height: 124,
|
2016-09-16 17:02:45 -04:00
|
|
|
tab: null,
|
|
|
|
image: null,
|
|
|
|
|
|
|
|
@observes("field.value")
|
|
|
|
imageChanged() {
|
|
|
|
this.reload();
|
|
|
|
},
|
|
|
|
|
2016-09-21 16:09:18 -04:00
|
|
|
images() {
|
|
|
|
return { tab: "/images/wizard/tab.png", image: this.get("field.value") };
|
2016-09-16 17:02:45 -04:00
|
|
|
},
|
|
|
|
|
2020-10-05 13:40:41 -04:00
|
|
|
paint(options) {
|
|
|
|
const { ctx, width, height } = options;
|
2016-09-21 16:48:48 -04:00
|
|
|
this.scaleImage(this.tab, 0, 0, width, height);
|
|
|
|
this.scaleImage(this.image, 40, 25, 30, 30);
|
2016-09-16 17:02:45 -04:00
|
|
|
|
|
|
|
ctx.font = `20px 'Arial'`;
|
|
|
|
ctx.fillStyle = "#000";
|
|
|
|
|
2019-05-27 04:15:39 -04:00
|
|
|
let title = this.wizard.getTitle();
|
2016-09-16 17:02:45 -04:00
|
|
|
if (title.length > 20) {
|
|
|
|
title = title.substring(0, 20) + "...";
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx.fillText(title, 80, 48);
|
|
|
|
},
|
|
|
|
});
|