From ce1540aaa910a1f896f164a47ff3a5a3fe88b3ea Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Fri, 8 May 2020 17:01:55 +0200 Subject: [PATCH] Small task inventories corrections --- .../javascripts/my_modules/repositories.js | 1 + .../my_modules/protocols/index.scss | 13 ++++++-- .../stylesheets/my_modules/repositories.scss | 7 ++-- .../shared_styles/elements/dropdown.scss | 32 +++++++++++++++++++ .../my_module_repositories_controller.rb | 5 ++- app/views/my_modules/protocols.html.erb | 6 ++-- .../_protocol_options_dropdown.html.erb | 2 +- .../repositories/_repositories_list.html.erb | 6 ++-- config/locales/en.yml | 10 +++--- 9 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 app/assets/stylesheets/shared_styles/elements/dropdown.scss diff --git a/app/assets/javascripts/my_modules/repositories.js b/app/assets/javascripts/my_modules/repositories.js index 5cadda99d..5cef0bd65 100644 --- a/app/assets/javascripts/my_modules/repositories.js +++ b/app/assets/javascripts/my_modules/repositories.js @@ -15,6 +15,7 @@ var MyModuleRepositories = (function() { var repositoriesContainer = $('#assigned-items-container'); $.get(repositoriesContainer.data('repositories-list-url'), function(result) { repositoriesContainer.html(result.html); + $('.assigned-items-title').attr('data-assigned-items-count', result.assigned_rows_count); }); } diff --git a/app/assets/stylesheets/my_modules/protocols/index.scss b/app/assets/stylesheets/my_modules/protocols/index.scss index 9b020abf6..776dc2c97 100644 --- a/app/assets/stylesheets/my_modules/protocols/index.scss +++ b/app/assets/stylesheets/my_modules/protocols/index.scss @@ -34,6 +34,17 @@ h2 { margin: 10px 0; + + &.assigned-items-title { + &::after { + @include font-h3; + color: $color-alto; + content: '[' attr(data-assigned-items-count) ']'; + display: inline; + line-height: 22px; + padding-left: 5px; + } + } } } @@ -64,8 +75,6 @@ } .repositories-dropdown-menu { - width: 100%; - .repository { @include font-button; cursor: pointer; diff --git a/app/assets/stylesheets/my_modules/repositories.scss b/app/assets/stylesheets/my_modules/repositories.scss index 06f05a0e3..d524a1fd6 100644 --- a/app/assets/stylesheets/my_modules/repositories.scss +++ b/app/assets/stylesheets/my_modules/repositories.scss @@ -136,11 +136,8 @@ flex-shrink: 0; text-align: right; - .fas { - cursor: pointer; - line-height: 36px; - text-align: center; - width: 36px; + .full-screen:hover { + background: $color-alto; } } } diff --git a/app/assets/stylesheets/shared_styles/elements/dropdown.scss b/app/assets/stylesheets/shared_styles/elements/dropdown.scss new file mode 100644 index 000000000..e8043ced5 --- /dev/null +++ b/app/assets/stylesheets/shared_styles/elements/dropdown.scss @@ -0,0 +1,32 @@ +.sci-dropdown { + [data-toggle="dropdown"] { + &:focus { + box-shadow: none; + } + } + + &.open { + [data-toggle="dropdown"] { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + border-color: $brand-focus; + + .caret { + transform: rotateX(180deg) + } + } + + .dropdown-menu { + border-top-left-radius: 0; + border-top-right-radius: 0; + box-shadow: $flyout-shadow; + margin-top: -1px; + width: 100%; + + li:hover { + background: $color-concrete; + } + } + } + +} diff --git a/app/controllers/my_module_repositories_controller.rb b/app/controllers/my_module_repositories_controller.rb index 61aa19c33..f111ba20a 100644 --- a/app/controllers/my_module_repositories_controller.rb +++ b/app/controllers/my_module_repositories_controller.rb @@ -85,7 +85,10 @@ class MyModuleRepositoriesController < ApplicationController def repositories_list_html @assigned_repositories = @my_module.live_and_snapshot_repositories_list - render json: { html: render_to_string(partial: 'my_modules/repositories/repositories_list') } + render json: { + html: render_to_string(partial: 'my_modules/repositories/repositories_list'), + assigned_rows_count: @assigned_repositories.map{|i| i.assigned_rows_count}.sum + } end def full_view_table diff --git a/app/views/my_modules/protocols.html.erb b/app/views/my_modules/protocols.html.erb index 467ccdc05..a146caa34 100644 --- a/app/views/my_modules/protocols.html.erb +++ b/app/views/my_modules/protocols.html.erb @@ -47,12 +47,12 @@