mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 23:16:15 +08:00
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:
commit
f48c8ac6c7
BIN
app/assets/images/printers/labels_promo.png
Normal file
BIN
app/assets/images/printers/labels_promo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
BIN
app/assets/images/printers/labels_promo_icon_0.png
Normal file
BIN
app/assets/images/printers/labels_promo_icon_0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 800 B |
BIN
app/assets/images/printers/labels_promo_icon_1.png
Normal file
BIN
app/assets/images/printers/labels_promo_icon_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 629 B |
BIN
app/assets/images/printers/labels_promo_icon_2.png
Normal file
BIN
app/assets/images/printers/labels_promo_icon_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 750 B |
|
@ -36,6 +36,7 @@
|
|||
@import "dashboard/*";
|
||||
@import "repository/*";
|
||||
@import "repository_columns/*";
|
||||
@import "label_templates/*";
|
||||
@import "reports/*";
|
||||
@import "settings/*";
|
||||
@import "shared/*";
|
||||
|
|
45
app/assets/stylesheets/label_templates/promo.scss
Normal file
45
app/assets/stylesheets/label_templates/promo.scss
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
35
app/views/label_templates/promo.html.erb
Normal file
35
app/views/label_templates/promo.html.erb
Normal 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>
|
|
@ -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}"
|
||||
|
|
Loading…
Reference in a new issue