mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-09 13:46:21 +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 'kaminari'
|
||||
gem 'rack-attack'
|
||||
gem 'rack-cors'
|
||||
|
||||
# JS datetime library, requirement of datetime picker
|
||||
gem 'momentjs-rails', '~> 2.17.1'
|
||||
|
|
|
|||
|
|
@ -410,6 +410,8 @@ GEM
|
|||
rack (2.2.3)
|
||||
rack-attack (6.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rack-cors (1.1.1)
|
||||
rack (>= 2.0.0)
|
||||
rack-proxy (0.6.5)
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
|
|
@ -668,6 +670,7 @@ DEPENDENCIES
|
|||
pry-rails
|
||||
puma
|
||||
rack-attack
|
||||
rack-cors
|
||||
rails (~> 6.0.0)
|
||||
rails-controller-testing
|
||||
rails_12factor
|
||||
|
|
|
|||
|
|
@ -453,7 +453,8 @@ var MyModuleRepositories = (function() {
|
|||
|
||||
FULL_VIEW_MODAL.on('show.bs.modal', function() {
|
||||
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('');
|
||||
});
|
||||
}
|
||||
|
|
@ -518,29 +519,31 @@ var MyModuleRepositories = (function() {
|
|||
|
||||
function updateFullViewRowsCount(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) {
|
||||
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) {
|
||||
title = I18n.t('my_modules.repository.full_view.assign_modal_header', {
|
||||
repository_name: repositoryName
|
||||
});
|
||||
version = '';
|
||||
} else if (snapshotDate) {
|
||||
title = I18n.t('my_modules.repository.full_view.modal_snapshot_header', {
|
||||
repository_name: repositoryName,
|
||||
title = repositoryName;
|
||||
version = I18n.t('my_modules.repository.full_view.modal_snapshot_header', {
|
||||
snaphot_date: snapshotDate
|
||||
});
|
||||
} else {
|
||||
title = I18n.t('my_modules.repository.full_view.modal_live_header', {
|
||||
repository_name: repositoryName
|
||||
});
|
||||
title = 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-name').html(title);
|
||||
FULL_VIEW_MODAL.find('.repository-title').data('repository-name', repositoryName);
|
||||
FULL_VIEW_MODAL.find('.repository-title').html(title);
|
||||
FULL_VIEW_MODAL.find('.repository-version').html(version);
|
||||
}
|
||||
|
||||
function initRepoistoryAssignView() {
|
||||
|
|
|
|||
|
|
@ -5,21 +5,9 @@
|
|||
@include font-h3;
|
||||
line-height: 22px;
|
||||
overflow: hidden;
|
||||
padding-right: 55px;
|
||||
position: relative;
|
||||
text-overflow: ellipsis;
|
||||
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 {
|
||||
|
|
@ -131,6 +119,16 @@
|
|||
|
||||
.assigned-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 {
|
||||
|
|
@ -218,11 +216,26 @@
|
|||
flex-grow: 1;
|
||||
max-width: calc(100% - 20px);
|
||||
|
||||
.repository-name {
|
||||
.repository-name-container {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.repository-title {
|
||||
@include my-module-repository-title;
|
||||
@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 {
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ class RepositoryChecklistValue < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.import_from_text(text, attributes, _options = {})
|
||||
return nil if text.blank?
|
||||
|
||||
value = new(attributes)
|
||||
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
||||
RepositoryImportParser::Util.split_by_delimiter(text: text, delimiter: column.delimiter_char).each do |item_text|
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ class RepositoryListValue < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.import_from_text(text, attributes, _options = {})
|
||||
return nil if text.blank?
|
||||
|
||||
value = new(attributes)
|
||||
column = attributes.dig(:repository_cell_attributes, :repository_column)
|
||||
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>
|
||||
</div>
|
||||
<div class="repository-name-container">
|
||||
<span class="repository-name"></span>
|
||||
<span class="repository-title"></span>
|
||||
<span class="repository-version"></span>
|
||||
</div>
|
||||
</div>
|
||||
<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
|
||||
|
||||
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||
# allow do
|
||||
# origins 'example.com'
|
||||
#
|
||||
# resource '*',
|
||||
# headers: :any,
|
||||
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
||||
# end
|
||||
# end
|
||||
if ENV['SCINOTE_PWA_DOMAIN_NAME'].present?
|
||||
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||
allow do
|
||||
origins ENV['SCINOTE_PWA_DOMAIN_NAME']
|
||||
|
||||
resource '/oauth/token',
|
||||
headers: :any,
|
||||
methods: %i(post)
|
||||
|
||||
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}"
|
||||
export: 'Export'
|
||||
full_view:
|
||||
modal_live_header: '%{repository_name}: Live version'
|
||||
modal_snapshot_header: '%{repository_name}: Snapshot of %{snaphot_date}'
|
||||
modal_live_header: ': Live version'
|
||||
modal_snapshot_header: ': Snapshot of %{snaphot_date}'
|
||||
assign_modal_header: 'Assign from %{repository_name} inventory'
|
||||
snapshots:
|
||||
simple_view:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue