mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 09:42:46 +08:00
Move editable? method from helper to model
This commit is contained in:
parent
0effb3ee69
commit
503c05805d
3 changed files with 6 additions and 6 deletions
|
@ -29,7 +29,7 @@ module RepositoryDatatableHelper
|
|||
),
|
||||
'recordInfoUrl': Rails.application.routes.url_helpers
|
||||
.repository_row_path(record.id),
|
||||
'recordEditable': record_editable
|
||||
'recordEditable': record.editable?
|
||||
}
|
||||
|
||||
# Add custom columns
|
||||
|
@ -75,10 +75,6 @@ module RepositoryDatatableHelper
|
|||
Constants::REPOSITORY_TABLE_DEFAULT_STATE['columns'].to_json
|
||||
end
|
||||
|
||||
def record_editable
|
||||
true
|
||||
end
|
||||
|
||||
def display_cell_value(cell, team)
|
||||
value_name = cell.repository_column.data_type.underscore
|
||||
serializer_class = "RepositoryDatatable::#{cell.repository_column.data_type}Serializer".constantize
|
||||
|
|
|
@ -37,4 +37,8 @@ class RepositoryRow < ApplicationRecord
|
|||
.where('repositories.team_id = ? and repository_rows.created_by_id = ?', team, user)
|
||||
.update_all(created_by_id: new_owner.id)
|
||||
end
|
||||
|
||||
def editable?
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,7 +52,7 @@ class RepositoryDatatableService
|
|||
.select('COUNT(DISTINCT my_modules.experiment_id) AS "assigned_experiments_count"')
|
||||
.select('COUNT(DISTINCT experiments.project_id) AS "assigned_projects_count"')
|
||||
end
|
||||
repository_rows.preload(Extends::REPOSITORY_ROWS_PRELOAD_RELATIONS)
|
||||
repository_rows = repository_rows.preload(Extends::REPOSITORY_ROWS_PRELOAD_RELATIONS)
|
||||
|
||||
@repository_rows = sort_rows(order_obj, repository_rows)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue