Fix label templates seelctor in print modal [SCI-10632]

This commit is contained in:
Anton 2024-04-12 11:17:09 +02:00
parent d5665b9c14
commit 7b3e5a06e0
4 changed files with 8 additions and 3 deletions

View file

@ -5,7 +5,7 @@ class LabelTemplatesController < ApplicationController
include TeamsHelper
before_action :check_feature_enabled, except: %i(index zpl_preview)
before_action :load_label_templates, only: %i(index datatable)
before_action :load_label_templates, only: %i(index datatable list)
before_action :load_label_template, only: %i(show set_default update template_tags)
before_action :check_view_permissions, except: %i(create duplicate set_default delete update)
before_action :check_manage_permissions, only: %i(create duplicate set_default delete update)
@ -29,6 +29,10 @@ class LabelTemplatesController < ApplicationController
end
end
def list
render json: @label_templates, each_serializer: LabelTemplateSerializer, user: current_user
end
def show
respond_to do |format|
format.json { render json: @label_template, serializer: LabelTemplateSerializer, user: current_user }

View file

@ -272,7 +272,7 @@ export default {
templateOption(option) {
return `
<div class="label-template-option" data-toggle="tooltip" data-placement="right" title="${option.params.description}">
${option.params.icon}
<img src="${option.params.icon}"></img>
${option.label}
</div>
`;

View file

@ -2,7 +2,7 @@
data-print-url="<%= print_repositories_path %>"
data-zebra-progress-url="<%= print_zpl_repositories_path %>"
data-printers-url="<%= label_printers_path(format: :json) %>"
data-label-templates-url="<%= label_templates_path(format: :json) %>"
data-label-templates-url="<%= list_label_templates_path(format: :json) %>"
data-rows-url="<%= rows_to_print_repositories_path %>"
data-print-validation-url="<%= validate_label_template_columns_repositories_path %>"
data-label-preview-url="<%= zpl_preview_label_templates_path %>"

View file

@ -53,6 +53,7 @@ Rails.application.routes.draw do
post :set_default
end
collection do
get :list
post :duplicate
delete :delete
get :datatable