Prod build process
This commit is contained in:
@@ -26,7 +26,9 @@ export default class extends Controller {
|
||||
|
||||
async #updateFields(templatePlanData) {
|
||||
const titleElement = this.titleTarget
|
||||
titleElement.value = templatePlanData.title.match(/^(.*\d)k(?=\d)/i)[0].replace(/(\d)/, ' $1')
|
||||
if (!titleElement.value) {
|
||||
titleElement.value = templatePlanData.title.match(/^(.*\d)k(?=\d)/i)[0].replace(/(\d)/, ' $1')
|
||||
}
|
||||
const benefitTargetsList = this.benefitTargets
|
||||
templatePlanData.plan_benefits.forEach(function(bene) {
|
||||
const targetElement = benefitTargetsList.find(
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// app/javascript/controllers/font_validator_controller.js
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["textField", "hiddenField", "countDisplayField"]
|
||||
|
||||
connect() {
|
||||
this.measure()
|
||||
}
|
||||
|
||||
measure() {
|
||||
const text = this.textFieldTarget.value
|
||||
const pixelWidth = this.getTextWidth(text, "bold 6px sans-serif")
|
||||
|
||||
// Do something with the pixel width (e.g., store in a hidden field for Rails to read)
|
||||
if (this.hasHiddenFieldTarget) {
|
||||
this.hiddenFieldTarget.value = pixelWidth
|
||||
this.countDisplayFieldTarget.textContent = `${pixelWidth}`
|
||||
if (pixelWidth > 100) {
|
||||
this.countDisplayFieldTarget.classList.add("text-brightlava")
|
||||
} else {
|
||||
this.countDisplayFieldTarget.classList.remove("text-brightlava")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Canvas measurement trick
|
||||
getTextWidth(text, font) {
|
||||
const canvas = document.createElement("canvas")
|
||||
const context = canvas.getContext("2d")
|
||||
context.font = font
|
||||
const metrics = context.measureText(text)
|
||||
return Math.ceil(metrics.width)
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "name", "output" ]
|
||||
|
||||
connect() {
|
||||
// this.element.textContent = "Hello World!"
|
||||
console.log('Hello World hello_controller.js');
|
||||
}
|
||||
|
||||
greet() {
|
||||
console.log('greet');
|
||||
this.outputTarget.textContent =
|
||||
`Hello, ${this.nameTarget.value}!`
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,8 @@ import { Controller } from "@hotwired/stimulus";
|
||||
export default class extends Controller {
|
||||
static values = {
|
||||
logoType: String,
|
||||
employerName: String
|
||||
employerName: String,
|
||||
employerId: Number
|
||||
}
|
||||
static targets = ["preview", "previewContainer", "logoSelect", "logoIdField", "logoNameField", "initialLogoFile"];
|
||||
|
||||
@@ -89,8 +90,13 @@ export default class extends Controller {
|
||||
|
||||
async uploadLogoToServer(logoFile) {
|
||||
console.log('in uploadLogoToServer');
|
||||
const employerId = this.employerIdValue
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append(`id_card_${this.logoTypeValue}_logo[logo_file]`, logoFile);
|
||||
if (employerId) {
|
||||
formData.append(`id_card_${this.logoTypeValue}_logo[employer_id]`, employerId);
|
||||
}
|
||||
|
||||
const csrfToken = document.querySelector("meta[name='csrf-token']").content;
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ export default class extends Controller {
|
||||
syncDefaults() {
|
||||
const pnValue = this.providerNetworkFieldTarget.value
|
||||
if (pnValue == "Cigna") {
|
||||
this.networkLogoFieldTarget.value = 1
|
||||
this.providerSectionFieldTarget.value = 30
|
||||
} else if (pnValue == "Medcost") {
|
||||
this.networkLogoFieldTarget.value = 2
|
||||
this.providerSectionFieldTarget.value = 26
|
||||
this.networkLogoFieldTarget.value = 9
|
||||
this.providerSectionFieldTarget.value = 5
|
||||
} else if (pnValue == "MedCost") {
|
||||
this.networkLogoFieldTarget.value = 7
|
||||
this.providerSectionFieldTarget.value = 4
|
||||
} else {
|
||||
this.networkLogoFieldTarget.value = ""
|
||||
this.providerSectionFieldTarget.value = ""
|
||||
|
||||
Reference in New Issue
Block a user