mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 01:44:34 +08:00
0493d6f31d
* Add preview label at open modal [SCI-7313] * Add density and unit to the label template [SCI-7313]
21 lines
626 B
Ruby
21 lines
626 B
Ruby
# frozen_string_literal: true
|
|
|
|
class LabelTemplateSerializer < ActiveModel::Serializer
|
|
include Canaid::Helpers::PermissionsHelper
|
|
include Rails.application.routes.url_helpers
|
|
|
|
attributes :name, :description, :language_type, :icon_url, :urls, :content, :type,
|
|
:default, :width_mm, :height_mm, :unit, :density
|
|
|
|
def icon_url
|
|
ActionController::Base.helpers.image_path("label_template_icons/#{object.icon}.svg")
|
|
end
|
|
|
|
def urls
|
|
return {} unless can_manage_label_templates?(object.team)
|
|
{
|
|
update: label_template_path(object),
|
|
fields: template_tags_label_templates_path
|
|
}
|
|
end
|
|
end
|