mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-16 21:59:00 +08:00
Merge branch 'develop' of https://github.com/biosistemika/scinote-web into develop
This commit is contained in:
commit
a2bfb1cfeb
9 changed files with 72 additions and 37 deletions
1
Gemfile
1
Gemfile
|
|
@ -37,6 +37,7 @@ gem 'jsonapi-renderer', '~> 0.2.2'
|
||||||
gem 'jwt', '~> 1.5'
|
gem 'jwt', '~> 1.5'
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'rack-attack'
|
gem 'rack-attack'
|
||||||
|
gem 'rack-cors'
|
||||||
|
|
||||||
# JS datetime library, requirement of datetime picker
|
# JS datetime library, requirement of datetime picker
|
||||||
gem 'momentjs-rails', '~> 2.17.1'
|
gem 'momentjs-rails', '~> 2.17.1'
|
||||||
|
|
|
||||||
|
|
@ -410,6 +410,8 @@ GEM
|
||||||
rack (2.2.3)
|
rack (2.2.3)
|
||||||
rack-attack (6.1.0)
|
rack-attack (6.1.0)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
|
rack-cors (1.1.1)
|
||||||
|
rack (>= 2.0.0)
|
||||||
rack-proxy (0.6.5)
|
rack-proxy (0.6.5)
|
||||||
rack
|
rack
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
|
|
@ -668,6 +670,7 @@ DEPENDENCIES
|
||||||
pry-rails
|
pry-rails
|
||||||
puma
|
puma
|
||||||
rack-attack
|
rack-attack
|
||||||
|
rack-cors
|
||||||
rails (~> 6.0.0)
|
rails (~> 6.0.0)
|
||||||
rails-controller-testing
|
rails-controller-testing
|
||||||
rails_12factor
|
rails_12factor
|
||||||
|
|
|
||||||
|
|
@ -453,7 +453,8 @@ var MyModuleRepositories = (function() {
|
||||||
|
|
||||||
FULL_VIEW_MODAL.on('show.bs.modal', function() {
|
FULL_VIEW_MODAL.on('show.bs.modal', function() {
|
||||||
FULL_VIEW_MODAL.find('.table-container').empty();
|
FULL_VIEW_MODAL.find('.table-container').empty();
|
||||||
FULL_VIEW_MODAL.find('.repository-name').empty();
|
FULL_VIEW_MODAL.find('.repository-title').empty();
|
||||||
|
FULL_VIEW_MODAL.find('.repository-version').empty();
|
||||||
updateFullViewRowsCount('');
|
updateFullViewRowsCount('');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -518,29 +519,31 @@ var MyModuleRepositories = (function() {
|
||||||
|
|
||||||
function updateFullViewRowsCount(value) {
|
function updateFullViewRowsCount(value) {
|
||||||
FULL_VIEW_MODAL.data('rows-count', value);
|
FULL_VIEW_MODAL.data('rows-count', value);
|
||||||
FULL_VIEW_MODAL.find('.repository-name').attr('data-rows-count', value);
|
FULL_VIEW_MODAL.find('.repository-version').attr('data-rows-count', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderFullViewRepositoryName(name, snapshotDate, assignMode) {
|
function renderFullViewRepositoryName(name, snapshotDate, assignMode) {
|
||||||
var title;
|
var title;
|
||||||
var repositoryName = name || FULL_VIEW_MODAL.find('.repository-name').data('repository-name');
|
var version;
|
||||||
|
var repositoryName = name || FULL_VIEW_MODAL.find('.repository-title').data('repository-name');
|
||||||
|
|
||||||
if (assignMode) {
|
if (assignMode) {
|
||||||
title = I18n.t('my_modules.repository.full_view.assign_modal_header', {
|
title = I18n.t('my_modules.repository.full_view.assign_modal_header', {
|
||||||
repository_name: repositoryName
|
repository_name: repositoryName
|
||||||
});
|
});
|
||||||
|
version = '';
|
||||||
} else if (snapshotDate) {
|
} else if (snapshotDate) {
|
||||||
title = I18n.t('my_modules.repository.full_view.modal_snapshot_header', {
|
title = repositoryName;
|
||||||
repository_name: repositoryName,
|
version = I18n.t('my_modules.repository.full_view.modal_snapshot_header', {
|
||||||
snaphot_date: snapshotDate
|
snaphot_date: snapshotDate
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
title = I18n.t('my_modules.repository.full_view.modal_live_header', {
|
title = repositoryName;
|
||||||
repository_name: repositoryName
|
version = I18n.t('my_modules.repository.full_view.modal_live_header');
|
||||||
});
|
|
||||||
}
|
}
|
||||||
FULL_VIEW_MODAL.find('.repository-name').data('repository-name', repositoryName);
|
FULL_VIEW_MODAL.find('.repository-title').data('repository-name', repositoryName);
|
||||||
FULL_VIEW_MODAL.find('.repository-name').html(title);
|
FULL_VIEW_MODAL.find('.repository-title').html(title);
|
||||||
|
FULL_VIEW_MODAL.find('.repository-version').html(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initRepoistoryAssignView() {
|
function initRepoistoryAssignView() {
|
||||||
|
|
|
||||||
|
|
@ -5,21 +5,9 @@
|
||||||
@include font-h3;
|
@include font-h3;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding-right: 55px;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
&::after {
|
|
||||||
color: $color-alto;
|
|
||||||
content: '[' attr(data-rows-count) ']';
|
|
||||||
display: inline-block;
|
|
||||||
line-height: 22px;
|
|
||||||
padding-left: 5px;
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
width: 55px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.my-module-inventories {
|
.my-module-inventories {
|
||||||
|
|
@ -131,6 +119,16 @@
|
||||||
|
|
||||||
.assigned-repository-title {
|
.assigned-repository-title {
|
||||||
@include my-module-repository-title;
|
@include my-module-repository-title;
|
||||||
|
padding-right: 2.2em;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
color: $color-alto;
|
||||||
|
content: '[' attr(data-rows-count) ']';
|
||||||
|
display: inline-block;
|
||||||
|
padding-right: .7em;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-buttons {
|
.action-buttons {
|
||||||
|
|
@ -218,11 +216,26 @@
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
max-width: calc(100% - 20px);
|
max-width: calc(100% - 20px);
|
||||||
|
|
||||||
.repository-name {
|
.repository-name-container {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.repository-title {
|
||||||
@include my-module-repository-title;
|
@include my-module-repository-title;
|
||||||
@include font-h2;
|
@include font-h2;
|
||||||
display: inline-block;
|
}
|
||||||
width: 100%;
|
|
||||||
|
.repository-version {
|
||||||
|
@include font-h2;
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding-right: .7em;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
color: $color-alto;
|
||||||
|
content: '[' attr(data-rows-count) ']';
|
||||||
|
display: inline-block;
|
||||||
|
padding-left: .3em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.breadcrumbs {
|
.breadcrumbs {
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ class RepositoryChecklistValue < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.import_from_text(text, attributes, _options = {})
|
def self.import_from_text(text, attributes, _options = {})
|
||||||
|
return nil if text.blank?
|
||||||
|
|
||||||
value = new(attributes)
|
value = new(attributes)
|
||||||
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
||||||
RepositoryImportParser::Util.split_by_delimiter(text: text, delimiter: column.delimiter_char).each do |item_text|
|
RepositoryImportParser::Util.split_by_delimiter(text: text, delimiter: column.delimiter_char).each do |item_text|
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,8 @@ class RepositoryListValue < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.import_from_text(text, attributes, _options = {})
|
def self.import_from_text(text, attributes, _options = {})
|
||||||
|
return nil if text.blank?
|
||||||
|
|
||||||
value = new(attributes)
|
value = new(attributes)
|
||||||
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
||||||
list_item = column.repository_list_items.find { |item| item.data == text }
|
list_item = column.repository_list_items.find { |item| item.data == text }
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@
|
||||||
<span class="my-module" title="<%= @my_module.name %>"><%= @my_module.name %></span>
|
<span class="my-module" title="<%= @my_module.name %>"><%= @my_module.name %></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="repository-name-container">
|
<div class="repository-name-container">
|
||||||
<span class="repository-name"></span>
|
<span class="repository-title"></span>
|
||||||
|
<span class="repository-version"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
|
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,22 @@
|
||||||
|
|
||||||
# Read more: https://github.com/cyu/rack-cors
|
# Read more: https://github.com/cyu/rack-cors
|
||||||
|
|
||||||
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
if ENV['SCINOTE_PWA_DOMAIN_NAME'].present?
|
||||||
# allow do
|
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||||
# origins 'example.com'
|
allow do
|
||||||
#
|
origins ENV['SCINOTE_PWA_DOMAIN_NAME']
|
||||||
# resource '*',
|
|
||||||
# headers: :any,
|
resource '/oauth/token',
|
||||||
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
headers: :any,
|
||||||
# end
|
methods: %i(post)
|
||||||
# end
|
|
||||||
|
resource '/rails/active_storage/*',
|
||||||
|
headers: :any,
|
||||||
|
methods: %i(get post options head)
|
||||||
|
|
||||||
|
resource '/api/*',
|
||||||
|
headers: :any,
|
||||||
|
methods: %i(get post put patch delete options head)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -815,8 +815,8 @@ en:
|
||||||
head_title: "%{project} | %{module} | Inventory %{repository}"
|
head_title: "%{project} | %{module} | Inventory %{repository}"
|
||||||
export: 'Export'
|
export: 'Export'
|
||||||
full_view:
|
full_view:
|
||||||
modal_live_header: '%{repository_name}: Live version'
|
modal_live_header: ': Live version'
|
||||||
modal_snapshot_header: '%{repository_name}: Snapshot of %{snaphot_date}'
|
modal_snapshot_header: ': Snapshot of %{snaphot_date}'
|
||||||
assign_modal_header: 'Assign from %{repository_name} inventory'
|
assign_modal_header: 'Assign from %{repository_name} inventory'
|
||||||
snapshots:
|
snapshots:
|
||||||
simple_view:
|
simple_view:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue