diff --git a/app/assets/stylesheets/my_modules/repositories.scss b/app/assets/stylesheets/my_modules/repositories.scss index 34443255a..b79e9169e 100644 --- a/app/assets/stylesheets/my_modules/repositories.scss +++ b/app/assets/stylesheets/my_modules/repositories.scss @@ -74,3 +74,71 @@ } } } + +#assigned-items-container { + .assigned-repository { + border: $border-default; + border-radius: $border-radius-modal; + margin-bottom: 10px; + + .assigned-repository-caret { + align-items: center; + color: inherit; + display: flex; + height: 52px; + padding: 0 18px; + text-decoration: none; + + &:hover, + &:active { + text-decoration: none; + } + + &:not(.collapsed) .fa-caret-right { + @include rotate(90deg); + } + + .fa-caret-right { + flex-shrink: 0; + margin-right: 10px; + } + + .assigned-repository-title { + @include font-h3; + overflow: hidden; + padding-right: 55px; + position: relative; + text-overflow: ellipsis; + white-space: nowrap; + + &::after { + color: $color-alto; + content: attr(data-rows-count); + display: inline-block; + line-height: 22px; + padding-left: 5px; + position: absolute; + right: 0; + width: 55px; + } + } + + .action-buttons { + flex-grow: 1; + flex-shrink: 0; + text-align: right; + + .fas { + cursor: pointer; + line-height: 36px; + text-align: center; + width: 36px; + } + } + } + + &:hover { + background: $color-concrete; + } + } +} diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index 5b86c0878..1db007f54 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -271,6 +271,7 @@ class MyModulesController < ApplicationController current_team, Constants::RECENT_PROTOCOL_LIMIT ).any? + @assigned_repositories = @my_module.assigned_repositories current_team_switch(@protocol.team) end diff --git a/app/models/my_module.rb b/app/models/my_module.rb index a4d01c6f5..8d77f9769 100644 --- a/app/models/my_module.rb +++ b/app/models/my_module.rb @@ -205,6 +205,10 @@ class MyModule < ApplicationRecord .count end + def assigned_repositories + Repository.where(id: repository_rows.select('DISTINCT(repository_id)')) + end + def unassigned_users User.find_by_sql( "SELECT DISTINCT users.id, users.full_name FROM users " + diff --git a/app/views/my_modules/protocols.html.erb b/app/views/my_modules/protocols.html.erb index c5ed7be00..eed294987 100644 --- a/app/views/my_modules/protocols.html.erb +++ b/app/views/my_modules/protocols.html.erb @@ -43,8 +43,8 @@ -
- ... +
+ <%= render partial: "my_modules/repositories/repositories_list" %>
diff --git a/app/views/my_modules/repositories/_repositories_list.html.erb b/app/views/my_modules/repositories/_repositories_list.html.erb new file mode 100644 index 000000000..1bfa4e697 --- /dev/null +++ b/app/views/my_modules/repositories/_repositories_list.html.erb @@ -0,0 +1,24 @@ +<% @assigned_repositories.each do |repository| %> +
+ +
+ Repository table +
+
+<% end %> \ No newline at end of file