diff --git a/app/controllers/id_card/setup_controller.rb b/app/controllers/id_card/setup_controller.rb index 906b554..c611b35 100644 --- a/app/controllers/id_card/setup_controller.rb +++ b/app/controllers/id_card/setup_controller.rb @@ -1,7 +1,7 @@ class IdCard::SetupController < ApplicationController def new - @employer = Employer.find_by(slug: params[:id]) + @employer = Employer.find_by(slug: params[:employer]) @setup = @employer.id_card_setup.new render :new end diff --git a/app/javascript/controllers/logo_upload_controller.js b/app/javascript/controllers/logo_upload_controller.js index 052810b..e6dbae4 100644 --- a/app/javascript/controllers/logo_upload_controller.js +++ b/app/javascript/controllers/logo_upload_controller.js @@ -4,7 +4,7 @@ export default class extends Controller { static values = { logoType: String, employerName: String - } + } static targets = ["preview", "previewContainer", "logoSelect", "logofield", "initialLogoFile"]; async connect() { @@ -39,12 +39,10 @@ export default class extends Controller { newFileName = this.determineEmployerFilename(file) file.name = newFileName } - + this.previewFile(file); this.uploadLogoToServer(file); - - - + this.logofieldTarget.value = newFileName; } @@ -122,4 +120,3 @@ export default class extends Controller { }); } } - diff --git a/app/views/employers/show.html.erb b/app/views/employers/show.html.erb index c8ea842..8e25f44 100644 --- a/app/views/employers/show.html.erb +++ b/app/views/employers/show.html.erb @@ -54,9 +54,11 @@
-

Actions

+

ID Card Actions

+ <%= link_to "Setup", new_id_card_setup_path(employer: @employer.slug), data: { turbo: false }, class: "flex justify-center items-center w-2/3 cursor-pointer bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> + <%= link_to 'Generate Sample Cards', generate_sample_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-2/3 cursor-pointer bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> <%= link_to 'Generate Group Cards (for print)', generate_print_id_card_print_data_path(employer_slug: @employer.slug ),data: { turbo: false }, class: "flex justify-center items-center w-2/3 #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> <%= link_to 'Generate Group Cards (for display)', generate_mobile_display_id_card_print_data_path(employer_slug: @employer.slug ), data: { turbo: false }, class: "flex justify-center items-center w-2/3 #{@employer.active ? "" : "pointer-events-none opacity-50 cursor-not-allowed"} bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-lg h-10 transition duration-100" %> diff --git a/config/routes.rb b/config/routes.rb index cb03dbe..f05a4dc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,7 +2,7 @@ Rails.application.routes.draw do namespace :id_card do - resources :setup, constraints: { id: /.*/ } + resources :setup resources :rx_sections resources :provider_sections resources :employer_logos do