mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 09:42:46 +08:00
small fixes
This commit is contained in:
parent
1122fe2d2f
commit
a3a5b21951
7 changed files with 15 additions and 9 deletions
|
@ -19,7 +19,7 @@ class RepositoryCell < ApplicationRecord
|
|||
includes(:repository_cell)
|
||||
.where(repository_cells: { value_type: 'RepositoryNumberValue' })
|
||||
end),
|
||||
optional: true, foreign_key: :value_id
|
||||
optional: true, foreign_key: :value_id, inverse_of: :repository_cell
|
||||
belongs_to :repository_date_time_value,
|
||||
(lambda do
|
||||
includes(:repository_cell)
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
class RepositoryNumberValue < ApplicationRecord
|
||||
belongs_to :created_by, foreign_key: :created_by_id, class_name: 'User',
|
||||
inverse_of: :created_repositroy_number_values
|
||||
inverse_of: :created_repository_number_values
|
||||
belongs_to :last_modified_by, foreign_key: :last_modified_by_id, class_name: 'User',
|
||||
inverse_of: :modified_repositroy_number_values
|
||||
inverse_of: :modified_repository_number_values
|
||||
has_one :repository_cell, as: :value, dependent: :destroy, inverse_of: :value
|
||||
accepts_nested_attributes_for :repository_cell
|
||||
|
||||
|
|
|
@ -264,12 +264,12 @@ class User < ApplicationRecord
|
|||
foreign_key: 'last_modified_by_id',
|
||||
inverse_of: :last_modified_by,
|
||||
dependent: :nullify
|
||||
has_many :created_repositroy_number_values,
|
||||
has_many :created_repository_number_values,
|
||||
class_name: 'RepositoryNumberValue',
|
||||
foreign_key: 'created_by_id',
|
||||
inverse_of: :created_by,
|
||||
dependent: :nullify
|
||||
has_many :modified_repositroy_number_values,
|
||||
has_many :modified_repository_number_values,
|
||||
class_name: 'RepositoryNumberValue',
|
||||
foreign_key: 'last_modified_by_id',
|
||||
inverse_of: :last_modified_by,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<%= t('libraries.manange_modal_column.number_type.decimals_label') %>
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<%= number_field_tag('decimals', selected_decimals, in: 0...101, class: 'form-control') %>
|
||||
<%= number_field_tag('decimals', selected_decimals, in: 0...Constants::REPOSITORY_NUMBER_TYPE_MAX_DECIMALS,
|
||||
class: 'form-control') %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -976,6 +976,7 @@ class Constants
|
|||
EXPORTABLE_ZIP_EXPIRATION_DAYS = 7
|
||||
|
||||
REPOSITORY_LIST_ITEMS_PER_COLUMN = 500
|
||||
REPOSITORY_NUMBER_TYPE_MAX_DECIMALS = 11
|
||||
|
||||
REPOSITORY_LIST_ITEMS_DELIMITERS_MAP = {
|
||||
return: "\n",
|
||||
|
|
|
@ -9,8 +9,5 @@ class CreateRepositoryNumberValue < ActiveRecord::Migration[6.0]
|
|||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
# add jsonb column for repository columns metadata
|
||||
add_column :repository_columns, :metadata, :jsonb, default: {}, null: false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddMetadataToRepositoryColumn < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :repository_columns, :metadata, :jsonb, default: {}, null: false
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue