From 85eaf7c2468791ce3ddb8e6814f153f2866aa97a Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 9 Jan 2023 12:33:59 +0100 Subject: [PATCH] Fix small css issues [SCI-7699][SCI-7694][SCI-7678] --- app/assets/stylesheets/experiment/table.scss | 2 +- app/assets/stylesheets/shared/cards.scss | 5 +++-- app/assets/stylesheets/shared/content_pane.scss | 3 +++ app/controllers/my_modules_controller.rb | 11 +++++++---- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/experiment/table.scss b/app/assets/stylesheets/experiment/table.scss index 11b5b4033..50a54be71 100644 --- a/app/assets/stylesheets/experiment/table.scss +++ b/app/assets/stylesheets/experiment/table.scss @@ -60,7 +60,7 @@ position: sticky; position: -webkit-sticky; top: 0; - z-index: 10; + z-index: 7; &.select-all-checkboxes { justify-content: center; diff --git a/app/assets/stylesheets/shared/cards.scss b/app/assets/stylesheets/shared/cards.scss index 5377b702a..504e8d7e3 100644 --- a/app/assets/stylesheets/shared/cards.scss +++ b/app/assets/stylesheets/shared/cards.scss @@ -58,8 +58,8 @@ align-items: center; display: flex; height: 2em; - justify-content: center; - width: 2em; + justify-content: left; + width: 1.5em; } } @@ -111,6 +111,7 @@ .checkbox-cell { grid-column: 1; + justify-content: center; position: initial; } } diff --git a/app/assets/stylesheets/shared/content_pane.scss b/app/assets/stylesheets/shared/content_pane.scss index 6e65738c1..c0914267b 100644 --- a/app/assets/stylesheets/shared/content_pane.scss +++ b/app/assets/stylesheets/shared/content_pane.scss @@ -91,6 +91,9 @@ background: $color-concrete; } + .btn { + height: 36px; + } a { display: inline-block; diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index 54f2ae9d4..399fee217 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -35,11 +35,14 @@ class MyModulesController < ApplicationController end def create - max_xy = @experiment.my_modules.select('MAX("my_modules"."x") AS x, MAX("my_modules"."y") AS y').take - x = max_xy.x ? (max_xy.x + 14) : 1 - y = max_xy.y ? (max_xy.y + 14) : 1 @my_module = @experiment.my_modules.new(my_module_params) - @my_module.assign_attributes(created_by: current_user, last_modified_by: current_user, x: x, y: y) + new_pos = @my_module.get_new_position + @my_module.assign_attributes( + created_by: current_user, + last_modified_by: current_user, + x: new_pos[:x], + y: new_pos[:y] + ) @my_module.transaction do if my_module_tags_params[:tag_ids].present? @my_module.tags << @experiment.project.tags.where(id: JSON.parse(my_module_tags_params[:tag_ids]))