diff --git a/app/helpers/repository_datatable_helper.rb b/app/helpers/repository_datatable_helper.rb index c925784cb..95f2006ee 100644 --- a/app/helpers/repository_datatable_helper.rb +++ b/app/helpers/repository_datatable_helper.rb @@ -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 diff --git a/app/models/repository_row.rb b/app/models/repository_row.rb index 6fb472b51..eb87cbf7b 100644 --- a/app/models/repository_row.rb +++ b/app/models/repository_row.rb @@ -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 diff --git a/app/services/repository_datatable_service.rb b/app/services/repository_datatable_service.rb index b6ee3c154..415f6ecf6 100644 --- a/app/services/repository_datatable_service.rb +++ b/app/services/repository_datatable_service.rb @@ -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