diff --git a/app/assets/stylesheets/repository/repository_table.scss b/app/assets/stylesheets/repository/repository_table.scss index 06ab58077..0cccaa041 100644 --- a/app/assets/stylesheets/repository/repository_table.scss +++ b/app/assets/stylesheets/repository/repository_table.scss @@ -65,6 +65,10 @@ background-color: $color-alto; } } + + .circle-icon { + margin-left: 30px; + } } // Checklists @@ -104,7 +108,8 @@ display: inline-block; } - .assign-counter-container { + .assign-counter-container, + .circle-icon { margin-left: 0; } } @@ -123,7 +128,8 @@ display: none; } - .assign-counter-container { + .assign-counter-container, + .circle-icon { margin-left: 30px; } } diff --git a/app/helpers/repository_datatable_helper.rb b/app/helpers/repository_datatable_helper.rb index aabb4f4dd..c847d7b29 100644 --- a/app/helpers/repository_datatable_helper.rb +++ b/app/helpers/repository_datatable_helper.rb @@ -42,9 +42,16 @@ module RepositoryDatatableHelper end def assigned_row(record) - if record.assigned_my_modules_count.positive? + if @my_module + if record.assigned_my_modules_count.positive? + " " + else + " " + end + elsif record.assigned_my_modules_count.positive? tooltip = "#{record.assigned_my_modules_count} tasks, #{record.assigned_experiments_count} " \ "experiments, #{record.assigned_projects_count} projects" + "
"\ "#{record.assigned_my_modules_count}
" else diff --git a/app/services/repository_table_state_column_update_service.rb b/app/services/repository_table_state_column_update_service.rb index 380775404..e32b0acee 100644 --- a/app/services/repository_table_state_column_update_service.rb +++ b/app/services/repository_table_state_column_update_service.rb @@ -28,33 +28,37 @@ class RepositoryTableStateColumnUpdateService raise ArgumentError, 'repository is empty' if repository.blank? raise ArgumentError, 'old_column_index is empty' if old_column_index.blank? - RepositoryTableState.where( - repository: repository - ).find_each do |table_state| + RepositoryTableState.where(repository: repository).find_each do |table_state| state = table_state.state + user = table_state.user - # Remove column from ColReorder, columns, length entries - state['columns'].delete_at(old_column_index) - state['ColReorder'].delete(old_column_index) - state['ColReorder'].map! do |index| - if index > old_column_index - index - 1 - else - index + begin + # Remove column from ColReorder, columns, length entries + state['columns'].delete_at(old_column_index) + state['ColReorder'].delete(old_column_index) + state['ColReorder'].map! do |index| + if index > old_column_index + index - 1 + else + index + end end - end - if state.dig('order', 0, 0) == old_column_index - # Fallback to default order if user had table ordered by - # the deleted column - state['order'] = Constants::REPOSITORY_TABLE_DEFAULT_STATE['order'] - elsif state.dig('order', 0, 0) > old_column_index - state['order'][0][0] -= 1 - end + if state.dig('order', 0, 0) == old_column_index + # Fallback to default order if user had table ordered by + # the deleted column + state['order'] = Constants::REPOSITORY_TABLE_DEFAULT_STATE['order'] + elsif state.dig('order', 0, 0) > old_column_index + state['order'][0][0] -= 1 + end - state['length'] = (state['length'] - 1) - state['time'] = (Time.now.to_f * 1_000).to_i - table_state.save + state['length'] = (state['length'] - 1) + state['time'] = (Time.now.to_f * 1_000).to_i + table_state.save + rescue NoMethodError => e + Rails.logger.error e.message + RepositoryTableStateService.new(user, repository).create_default_state + end end end end diff --git a/app/views/repository_columns/manage_column_partials/_checklist.html.erb b/app/views/repository_columns/manage_column_partials/_checklist.html.erb index a41753b57..10cf96183 100644 --- a/app/views/repository_columns/manage_column_partials/_checklist.html.erb +++ b/app/views/repository_columns/manage_column_partials/_checklist.html.erb @@ -4,7 +4,7 @@ selected_delimiter_char = Constants::REPOSITORY_LIST_ITEMS_DELIMITERS_MAP[selected_delimiter.to_sym] %> -<%= hidden_field_tag 'dropdown-options', '', class: 'dropdown-options' %> +<%= hidden_field_tag 'dropdown-options', '[]', class: 'dropdown-options' %>
diff --git a/app/views/repository_columns/manage_column_partials/_list.html.erb b/app/views/repository_columns/manage_column_partials/_list.html.erb index 338832387..24c4eeeeb 100644 --- a/app/views/repository_columns/manage_column_partials/_list.html.erb +++ b/app/views/repository_columns/manage_column_partials/_list.html.erb @@ -4,7 +4,7 @@ selected_delimiter_char = Constants::REPOSITORY_LIST_ITEMS_DELIMITERS_MAP[selected_delimiter.to_sym] %> -<%= hidden_field_tag 'dropdown-options', '', class: 'dropdown-options' %> +<%= hidden_field_tag 'dropdown-options', '[]', class: 'dropdown-options' %>