diff --git a/app/assets/stylesheets/label_templates/show.scss b/app/assets/stylesheets/label_templates/show.scss index a37c6b9b0..53b699487 100644 --- a/app/assets/stylesheets/label_templates/show.scss +++ b/app/assets/stylesheets/label_templates/show.scss @@ -4,9 +4,11 @@ display: flex; flex-direction: column; height: calc(100vh - var(--navbar-height)); + padding-left: 1.5em; .title-row { - align-items: center; + @include font-h1; + align-items: end; background: $color-white; border-bottom: $border-tertiary; display: flex; @@ -23,7 +25,6 @@ } .sci-inline-edit { - @include font-h1; flex-grow: 1; max-width: calc(100% - 50px); } @@ -47,6 +48,7 @@ .label-template-container { display: flex; flex-grow: 1; + margin-top: 1em; .title { font-weight: bold; @@ -124,7 +126,7 @@ top: 0; } - &:hover { + &:hover:not(.read-only) { background-color: $color-concrete; .fa-pen { diff --git a/app/javascript/vue/label_template/container.vue b/app/javascript/vue/label_template/container.vue index 3c8dd234d..6a85d40e2 100644 --- a/app/javascript/vue/label_template/container.vue +++ b/app/javascript/vue/label_template/container.vue @@ -12,6 +12,7 @@
+
-
+
{{ i18n.t('label_templates.show.description_title') }}
+
-
+
{{ i18n.t('label_templates.show.content_title', { format: labelTemplate.attributes.language_type.toUpperCase() }) }} @@ -80,10 +88,13 @@
-
+
{{ labelTemplate.attributes.content}}
+
+ {{ labelTemplate.attributes.content}} +
@@ -133,6 +144,12 @@ computed: { hasError() { return this.codeErrorMessage.length > 0 + }, + canManage() { + return this.labelTemplate.attributes.urls.update && this.notFluics + }, + notFluics() { + return this.labelTemplate.attributes.type !== "FluicsLabelTemplate" } }, components: {InlineEdit, InsertFieldDropdown, LabelPreview}, diff --git a/app/serializers/label_template_serializer.rb b/app/serializers/label_template_serializer.rb index ed3852fb8..b8a914f8b 100644 --- a/app/serializers/label_template_serializer.rb +++ b/app/serializers/label_template_serializer.rb @@ -1,15 +1,17 @@ # 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 + attributes :name, :description, :language_type, :icon_url, :urls, :content, :type 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