mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-14 09:04:56 +08:00
Merge branch 'develop' into features/september-release
This commit is contained in:
commit
3a22d7715d
13 changed files with 323 additions and 37 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.28.1.3
|
||||
1.28.2
|
||||
|
|
|
@ -7,6 +7,10 @@ $(document).on('turbolinks:load', function() {
|
|||
window.iFrameModal = document.getElementById('iFrameModal');
|
||||
let iFrameModalFrame = document.getElementById('iFrameModalFrame');
|
||||
|
||||
// Block from running when accessing page without defined iframe modal
|
||||
// (sign in, reset password, accept invitation, 2fa)
|
||||
if (!iFrameModalFrame || !iFrameModal) return;
|
||||
|
||||
window.showIFrameModal = (url) => {
|
||||
iFrameModalFrame.setAttribute('src', url);
|
||||
iFrameModal.classList.remove('hidden');
|
||||
|
|
|
@ -46,7 +46,7 @@ class ApplicationController < ActionController::Base
|
|||
def render_403(style = 'danger')
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
render file: 'public/403.html', status: :forbidden, layout: false
|
||||
render 'errors/403', status: :forbidden, layout: false
|
||||
end
|
||||
format.json do
|
||||
render json: { style: style }, status: :forbidden
|
||||
|
@ -60,7 +60,7 @@ class ApplicationController < ActionController::Base
|
|||
def render_404
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
render file: 'public/404.html', status: :not_found, layout: false
|
||||
render 'errors/404', status: :not_found, layout: false
|
||||
end
|
||||
format.json do
|
||||
render json: {}, status: :not_found
|
||||
|
@ -74,7 +74,7 @@ class ApplicationController < ActionController::Base
|
|||
def render_422(message = t('client_api.permission_error'))
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
render file: 'public/422.html', status: :unprocessable_entity, layout: false
|
||||
render 'errors/422', status: :unprocessable_entity, layout: false
|
||||
end
|
||||
format.json do
|
||||
render json: { message: message }, status: :unprocessable_entity
|
||||
|
|
|
@ -64,9 +64,7 @@ class GeneSequenceAssetsController < ApplicationController
|
|||
file.blob.metadata['asset_type'] = 'gene_sequence'
|
||||
file.blob.metadata['name'] = params[:sequence_name]
|
||||
file.save!
|
||||
|
||||
@asset.view_mode = @parent.assets_view_mode
|
||||
|
||||
@asset.view_mode ||= @parent.assets_view_mode
|
||||
@asset.save!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
:placeholder="i18n.t('open_vector_editor.sequence_name_placeholder')"/>
|
||||
</div>
|
||||
</span>
|
||||
<div v-if="oveEnabledDaysLeft <= 30" class="flex items-center">
|
||||
<div v-if="oveWarning" class="flex items-center">
|
||||
<i class="mr-1 text-brand-warning sn-icon sn-icon-alert-warning"></i>
|
||||
<p v-html="i18n.t('open_vector_editor.trial_expiration_warning_html', { count: oveEnabledDaysLeft })" class="mb-0"></p>
|
||||
<p v-html="oveWarning" class="mb-0"></p>
|
||||
</div>
|
||||
<div class="ove-buttons text-sn-blue">
|
||||
<button :style="{ pointerEvents: 'all' }" @click="saveAndClose" class="btn btn-light font-sans" :disabled="this.readOnly">
|
||||
|
@ -40,19 +40,17 @@
|
|||
fileName: { type: String },
|
||||
updateUrl: { type: String },
|
||||
canEditFile: { type: String },
|
||||
oveEnabledDaysLeftString: { type: String }
|
||||
oveWarning: { type: String }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editor: null,
|
||||
sequenceName: null,
|
||||
closeAfterSave: false,
|
||||
readOnly: this.canEditFile !== 'true',
|
||||
oveEnabledDaysLeft: 0
|
||||
readOnly: this.canEditFile !== 'true'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.oveEnabledDaysLeft = parseInt(this.oveEnabledDaysLeftString);
|
||||
let editorConfig = {
|
||||
onSave: this.saveFile,
|
||||
generatePng: true,
|
||||
|
|
|
@ -3,21 +3,7 @@
|
|||
class OpenVectorEditorService
|
||||
class << self
|
||||
def enabled?
|
||||
ove_enabled_until = ENV.fetch('SCINOTE_OVE_ENABLED_UNTIL', nil)
|
||||
|
||||
return false if ove_enabled_until.blank?
|
||||
|
||||
DateTime.now.utc.to_date < DateTime.strptime(ove_enabled_until, '%d-%m-%Y').utc.to_date
|
||||
end
|
||||
|
||||
def evaluation_period_left
|
||||
return 0 unless enabled?
|
||||
|
||||
ove_enabled_until = ENV.fetch('SCINOTE_OVE_ENABLED_UNTIL', nil)
|
||||
|
||||
return 0 if ove_enabled_until.blank?
|
||||
|
||||
(DateTime.strptime(ove_enabled_until, '%d-%m-%Y').utc.to_date - DateTime.now.utc.to_date).to_i
|
||||
ENV.fetch('SCINOTE_OVE_ENABLED') == 'true'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,8 +10,8 @@ module Reports::Docx::DrawResultTable
|
|||
table_data = JSON.parse(table.contents_utf_8)['data']
|
||||
table_data = obj.add_headers_to_table(table_data, false)
|
||||
|
||||
if table.metadata.present?
|
||||
table.metadata['cells']&.each do |cell|
|
||||
if table.metadata.present? && table.metadata['cells'].is_a?(Array)
|
||||
table.metadata['cells'].each do |cell|
|
||||
next unless cell['row'].present? && cell['col'].present?
|
||||
|
||||
row_index = cell['row'].to_i + 1
|
||||
|
@ -28,8 +28,8 @@ module Reports::Docx::DrawResultTable
|
|||
cell_style rows[0], bold: true, background: color[:concrete]
|
||||
cell_style cols[0], bold: true, background: color[:concrete]
|
||||
|
||||
if table.metadata.present?
|
||||
table.metadata['cells']&.each do |cell|
|
||||
if table.metadata.present? && table.metadata['cells'].is_a?(Array)
|
||||
table.metadata['cells'].each do |cell|
|
||||
next unless cell.present? && cell['row'].present? && cell['col'].present? && cell['className'].present?
|
||||
|
||||
cell_style rows.dig(cell['row'].to_i + 1, cell['col'].to_i + 1),
|
||||
|
|
|
@ -8,8 +8,8 @@ module Reports::Docx::DrawStepTable
|
|||
table_data = JSON.parse(table.contents_utf_8)['data']
|
||||
table_data = obj.add_headers_to_table(table_data, table_type == 'step_well_plates_table')
|
||||
|
||||
if table.metadata.present?
|
||||
table.metadata['cells']&.each do |cell|
|
||||
if table.metadata.present? && table.metadata['cells'].is_a?(Array)
|
||||
table.metadata['cells'].each do |cell|
|
||||
next unless cell['row'].present? && cell['col'].present?
|
||||
|
||||
row_index = cell['row'].to_i + 1
|
||||
|
@ -26,8 +26,8 @@ module Reports::Docx::DrawStepTable
|
|||
cell_style rows[0], bold: true, background: color[:concrete]
|
||||
cell_style cols[0], bold: true, background: color[:concrete]
|
||||
|
||||
if table.metadata.present?
|
||||
table.metadata['cells']&.each do |cell|
|
||||
if table.metadata.present? && table.metadata['cells'].is_a?(Array)
|
||||
table.metadata['cells'].each do |cell|
|
||||
data = cell[1]
|
||||
next unless data.present? && data['row'].present? && data['col'].present? && data['className'].present?
|
||||
|
||||
|
|
118
app/views/errors/403.html.erb
Normal file
118
app/views/errors/403.html.erb
Normal file
|
@ -0,0 +1,118 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= t("errors.forbidden.title") %></title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
body {
|
||||
background-color: #F0F0F6;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.navbar {
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 1px 4px rgba(35, 31, 32, 0.15);
|
||||
height: 52px;
|
||||
left: 0%;
|
||||
position: absolute;
|
||||
right: 0%;
|
||||
top: 0%;
|
||||
}
|
||||
|
||||
div.navbar img {
|
||||
width: 121px;
|
||||
height: 24px;
|
||||
left: 21px;
|
||||
position: absolute;
|
||||
top: calc(50% - 24px/2 - 0px);
|
||||
}
|
||||
|
||||
div.dialog {
|
||||
width: 95%;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
div.dialog > h1 {
|
||||
color: #404048;
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 1.5em;
|
||||
line-height: 29px;
|
||||
margin: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.dialog > p {
|
||||
color: #404048;
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 1.1em;
|
||||
margin: 0.5em;
|
||||
}
|
||||
|
||||
div.dialog > img {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
div.back-button {
|
||||
margin-top: 3em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a.back-button {
|
||||
background: #104DA9;
|
||||
border-radius: 4px;
|
||||
color: #FFFFFF;
|
||||
display: inline-block;
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
margin-top: 3em;
|
||||
padding: 0.8em 1em;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.back-button > img {
|
||||
filter: invert(100%);
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
margin-right: 0.5em;
|
||||
vertical-align:middle;
|
||||
}
|
||||
|
||||
a.back-button > span {
|
||||
color: #FFFFFF;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
.illustration {
|
||||
margin-top: 64px !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body data-turbolinks="false">
|
||||
<div class="navbar">
|
||||
<a href="/">
|
||||
<img id="logo" src="/images/scinote_logo.svg" title="SciNote">
|
||||
</a>
|
||||
</div>
|
||||
<div class="dialog">
|
||||
<img src="/images/undraw_through_the_park.svg" class="illustration">
|
||||
<h1><%= t("errors.forbidden.dialog.title") %></h1>
|
||||
<p><%= t("errors.forbidden.dialog.text") %></p>
|
||||
|
||||
<a class="back-button" href="/dashboard">
|
||||
<img src="/images/arrow-left.svg">
|
||||
<span><%= t("errors.forbidden.dialog.button") %></span>
|
||||
</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
81
app/views/errors/404.html.erb
Normal file
81
app/views/errors/404.html.erb
Normal file
|
@ -0,0 +1,81 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= t("errors.not_found.title") %></title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
body {
|
||||
background-color: #F0F0F6;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.navbar {
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 1px 4px rgba(35, 31, 32, 0.15);
|
||||
height: 52px;
|
||||
left: 0%;
|
||||
position: absolute;
|
||||
right: 0%;
|
||||
top: 0%;
|
||||
}
|
||||
|
||||
div.navbar img {
|
||||
width: 121px;
|
||||
height: 24px;
|
||||
left: 21px;
|
||||
position: absolute;
|
||||
top: calc(50% - 24px/2 - 0px);
|
||||
}
|
||||
|
||||
div.dialog {
|
||||
width: 95%;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
div.dialog > h1 {
|
||||
color: #404048;
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 1.5em;
|
||||
line-height: 29px;
|
||||
margin: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.dialog > p {
|
||||
color: #404048;
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 1.1em;
|
||||
margin: 0.5em;
|
||||
}
|
||||
|
||||
div.dialog > img {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
.illustration {
|
||||
margin-top: 64px !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body data-turbolinks="false">
|
||||
<div class="navbar">
|
||||
<a href="/">
|
||||
<img id="logo" src="/images/scinote_logo.svg" title="SciNote">
|
||||
</a>
|
||||
</div>
|
||||
<div class="dialog">
|
||||
<img src="/images/genericError.svg" class="illustration">
|
||||
<h1><%= t("errors.not_found.dialog.title") %></h1>
|
||||
<p><%= t("errors.not_found.dialog.text_1") %></p>
|
||||
<p><%= t("errors.not_found.dialog.text_2_html", home_url: root_url, search_url: new_search_url) %></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
80
app/views/errors/422.html.erb
Normal file
80
app/views/errors/422.html.erb
Normal file
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= t("errors.unprocessable_entity.title") %></title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<style>
|
||||
body {
|
||||
background-color: #F0F0F6;
|
||||
color: #2E2F30;
|
||||
text-align: center;
|
||||
font-family: arial, sans-serif;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.navbar {
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 1px 4px rgba(35, 31, 32, 0.15);
|
||||
height: 52px;
|
||||
left: 0%;
|
||||
position: absolute;
|
||||
right: 0%;
|
||||
top: 0%;
|
||||
}
|
||||
|
||||
div.navbar img {
|
||||
width: 121px;
|
||||
height: 24px;
|
||||
left: 21px;
|
||||
position: absolute;
|
||||
top: calc(50% - 24px/2 - 0px);
|
||||
}
|
||||
|
||||
div.dialog {
|
||||
width: 95%;
|
||||
margin: 4em auto 0;
|
||||
}
|
||||
|
||||
div.dialog > h1 {
|
||||
color: #404048;
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 1.5em;
|
||||
line-height: 29px;
|
||||
margin: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.dialog > p {
|
||||
color: #404048;
|
||||
font-family: Lato;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 1.1em;
|
||||
margin: 0.5em;
|
||||
}
|
||||
|
||||
div.dialog > img {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
.illustration {
|
||||
margin-top: 64px !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body data-turbolinks="false">
|
||||
<div class="navbar">
|
||||
<a href="/">
|
||||
<img id="logo" src="/images/scinote_logo.svg" title="SciNote">
|
||||
</a>
|
||||
</div>
|
||||
<div class="dialog">
|
||||
<img src="/images/genericError.svg" class="illustration">
|
||||
<h1><%= t("errors.unprocessable_entity.dialog.title") %></h1>
|
||||
<p><%= t("errors.unprocessable_entity.dialog.text") %></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -20,7 +20,7 @@
|
|||
file-name="<%= @file_name %>"
|
||||
update-url="<%= @asset ? gene_sequence_asset_url(@asset) : gene_sequence_assets_url(parent_type: params[:parent_type], parent_id: params[:parent_id]) %>"
|
||||
can-edit-file="<%= asset_managable? %>"
|
||||
ove-enabled-days-left-string="<%= OpenVectorEditorService.evaluation_period_left %>"
|
||||
ove-warning="<%= defined?(@warnings) ? @warnings : '' %>"
|
||||
/>
|
||||
</div>
|
||||
<%= javascript_include_tag 'open_vector_editor' %>
|
||||
|
|
|
@ -3873,3 +3873,24 @@ en:
|
|||
canvas_view: "Canvas view"
|
||||
active_state: "Active state"
|
||||
archived_state: "Archived state"
|
||||
|
||||
errors:
|
||||
forbidden:
|
||||
title: "Access to this page is denied (403)."
|
||||
dialog:
|
||||
title: "It would seem that you are not allowed in here."
|
||||
text: "You should request access from your team administrators."
|
||||
button: "Go back"
|
||||
not_found:
|
||||
title: "This page could not be found (404)."
|
||||
dialog:
|
||||
title: "This page could not be found (404)."
|
||||
text_1: "You may have mistyped the address or the page may have moved."
|
||||
text_2_html: |
|
||||
"If you are the application owner check the logs for more information.
|
||||
You can go back to <a href="%{home_url}">home page</a> or try <a href="%{search_url}">searching.</a>"
|
||||
unprocessable_entity:
|
||||
title: "The change you wanted was rejected (422)."
|
||||
dialog:
|
||||
title: "Ooops, something went wrong."
|
||||
text: "Please contact your SciNote administrator."
|
||||
|
|
Loading…
Add table
Reference in a new issue