From 95baaefd7a24126e270ca3002f2c6b8bae83f1a8 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Wed, 7 Dec 2022 11:59:27 +0100 Subject: [PATCH 1/3] Add img2zpl gem for ZPL image code generation [SCI-7551] --- Gemfile | 1 + Gemfile.lock | 7 +++++++ app/services/label_templates/repository_row_service.rb | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 08e6892e8..4e3beb4e7 100644 --- a/Gemfile +++ b/Gemfile @@ -97,6 +97,7 @@ gem 'devise-async', git: 'https://github.com/mhfs/devise-async.git', branch: 'devise-4.x' gem 'image_processing', '~> 1.12' +gem 'img2zpl', git: 'https://github.com/scinote-eln/img2zpl' gem 'rufus-scheduler', '~> 3.5' gem 'discard', '~> 1.0' diff --git a/Gemfile.lock b/Gemfile.lock index b765363c2..dfa40139d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,6 +39,13 @@ GIT devise-async (0.10.2) devise (>= 4.0) +GIT + remote: https://github.com/scinote-eln/img2zpl + revision: 23d61cfc3e90ac4caa62dd08546fa0d7590a5140 + specs: + img2zpl (1.0.1) + mini_magick (~> 4.9) + GEM remote: http://rubygems.org/ specs: diff --git a/app/services/label_templates/repository_row_service.rb b/app/services/label_templates/repository_row_service.rb index 37ccda5d5..25dd5729e 100644 --- a/app/services/label_templates/repository_row_service.rb +++ b/app/services/label_templates/repository_row_service.rb @@ -61,14 +61,14 @@ module LabelTemplates @repository_row.created_by.full_name when 'ADDED_ON' I18n.l(@repository_row.created_at, format: :full) - when 'LOGO' - logo + when /^LOGO/ + logo(key) else raise ColumnNotFoundError, I18n.t('label_templates.repository_row.errors.column_not_found') end end - def logo + def logo(_key) raise LogoNotFoundError, I18n.t('label_templates.repository_row.errors.logo_not_supported') end end From c5d91b061b606623ebbede2555aa375c97bb798b Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 7 Dec 2022 13:57:19 +0100 Subject: [PATCH 2/3] Add logo to label templates --- .../stylesheets/label_templates/show.scss | 20 +++++- .../components/logo_insert_modal.vue | 72 +++++++++++++++++++ .../vue/label_template/container.vue | 8 +-- .../label_template/insert_field_dropdown.vue | 27 +++++-- app/services/label_templates/tag_service.rb | 6 +- config/locales/en.yml | 6 ++ public/images/icon_small/link.svg | 7 ++ 7 files changed, 134 insertions(+), 12 deletions(-) create mode 100644 app/javascript/vue/label_template/components/logo_insert_modal.vue create mode 100644 public/images/icon_small/link.svg diff --git a/app/assets/stylesheets/label_templates/show.scss b/app/assets/stylesheets/label_templates/show.scss index 97c01d1d0..8d25a15e4 100644 --- a/app/assets/stylesheets/label_templates/show.scss +++ b/app/assets/stylesheets/label_templates/show.scss @@ -139,7 +139,16 @@ } } - .inser-field-dropdown { + .insert-field-dropdown { + .dimensions-container { + align-items: center; + display: flex; + + img { + margin-top: 27px; + } + } + .open-dropdown-button:not(.collapsed) { .fas { @include rotate(-180deg); @@ -171,7 +180,12 @@ display: flex; padding: 10px 10px 10px 24px; - .fas { + .fas:not(.fa-plus-square) { + margin-left: -1.25em; + margin-right: .25em; + } + + .fa-plus-square { @include font-main; display: none; margin-left: auto; @@ -180,7 +194,7 @@ &:hover { background-color: $color-concrete; - .fas { + .fa-plus-square { display: inline-block; } } diff --git a/app/javascript/vue/label_template/components/logo_insert_modal.vue b/app/javascript/vue/label_template/components/logo_insert_modal.vue new file mode 100644 index 000000000..25f13e622 --- /dev/null +++ b/app/javascript/vue/label_template/components/logo_insert_modal.vue @@ -0,0 +1,72 @@ + + diff --git a/app/javascript/vue/label_template/container.vue b/app/javascript/vue/label_template/container.vue index 59bbe2d3b..b0502e98f 100644 --- a/app/javascript/vue/label_template/container.vue +++ b/app/javascript/vue/label_template/container.vue @@ -59,7 +59,7 @@