Merge pull request #4307 from aignatov-bio/ai-sci-7029-add-label-promo-page

Add promo page for label templates [SCI-7029]
This commit is contained in:
aignatov-bio 2022-08-04 10:54:20 +02:00 committed by GitHub
commit f48c8ac6c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 98 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

View file

@ -36,6 +36,7 @@
@import "dashboard/*";
@import "repository/*";
@import "repository_columns/*";
@import "label_templates/*";
@import "reports/*";
@import "settings/*";
@import "shared/*";

View file

@ -0,0 +1,45 @@
// scss-lint:disable SelectorDepth NestingDepth
.content-label-templates-promo {
align-items: center;
display: flex;
justify-content: center;
.promo-container {
margin-top: 2em;
max-width: 800px;
position: relative;
}
.promo-image {
left: 0;
position: absolute;
top: 0;
img {
max-width: 60vw;
}
}
.promo-text {
margin-left: 420px;
margin-top: 150px;
.title {
margin-bottom: 1em;
}
.description-item {
align-items: center;
display: flex;
margin-bottom: 1em;
img {
margin-right: 1em;
}
}
.btn {
margin-top: 1em;
}
}
}

View file

@ -3,6 +3,7 @@
class LabelTemplatesController < ApplicationController
include InputSanitizeHelper
before_action :check_feature_enabled
before_action :check_view_permissions, only: %i(index datatable)
before_action :check_manage_permissions, only: %i(new duplicate set_default delete)
before_action :load_label_templates, only: %i(index datatable)
@ -69,6 +70,10 @@ class LabelTemplatesController < ApplicationController
private
def check_feature_enabled
render :promo unless LabelTemplate.enabled?
end
def check_view_permissions
render_403 unless can_view_label_templates?(current_team)
end

View file

@ -11,6 +11,10 @@ class LabelTemplate < ApplicationRecord
validate :default_template
def self.enabled?
ApplicationSettings.instance.values['label_templates_enabled']
end
def render(locals)
locals.reduce(content.dup) do |rendered_content, (key, value)|
rendered_content.gsub!(/\{\{#{key}\}\}/, value.to_s)

View file

@ -0,0 +1,35 @@
<% provide(:sidebar_title, t('sidebar.templates.sidebar_title')) %>
<% provide(:container_class, "no-second-nav-container") %>
<%= content_for :sidebar do %>
<%= render partial: "/shared/sidebar/templates_sidebar", locals: {active: :label} %>
<% end %>
<div class="content-pane flexible label-templates-promo">
<div class="content-header sticky-header">
<div class="title-row">
<h1>
<%= t('label_templates.promo.head_title') %>
</h1>
</div>
<div class="content-label-templates-promo">
<div class="promo-container">
<div class="promo-image">
<%= image_tag 'printers/labels_promo.png' %>
</div>
<div class="promo-text">
<h1 class="title">
<%= t('label_templates.promo.promo_title') %>
</h1>
<div class="description">
<% 3.times do |i| %>
<div class="description-item">
<%= image_tag "printers/labels_promo_icon_#{i}.png" %>
<div class="text-line"><%= t("label_templates.promo.description_#{i}") %></div>
</div>
<% end %>
</div>
<%= link_to t('label_templates.promo.action_button'), nil, class: 'btn btn-primary' %>
</div>
</div>
</div>
</div>

View file

@ -838,6 +838,14 @@ en:
title: 'Delete Label template(s)'
description: 'Are you sure you want to delete the selected Label template(s)?'
promo:
head_title: 'Label templates'
promo_title: 'Label all your tubes & containers by your own standards'
description_0: 'Easily track your inventory items with labels'
description_1: 'Print labels fast & easy'
description_2: 'Always have 100% accurate standard output'
action_button: 'Try Label templates'
label_printers:
create:
success: "Successfully added %{printer_name}"