Merge pull request #2503 from aignatov-bio/ai-sci-4507-add-assigned-repositories-list

Add assigned repositories list [SCI-4507]
This commit is contained in:
aignatov-bio 2020-04-03 13:59:26 +02:00 committed by GitHub
commit fc810b5524
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 99 additions and 2 deletions

View file

@ -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;
}
}
}

View file

@ -271,6 +271,7 @@ class MyModulesController < ApplicationController
current_team, current_team,
Constants::RECENT_PROTOCOL_LIMIT Constants::RECENT_PROTOCOL_LIMIT
).any? ).any?
@assigned_repositories = @my_module.assigned_repositories
current_team_switch(@protocol.team) current_team_switch(@protocol.team)
end end

View file

@ -205,6 +205,10 @@ class MyModule < ApplicationRecord
.count .count
end end
def assigned_repositories
Repository.where(id: repository_rows.select('DISTINCT(repository_id)'))
end
def unassigned_users def unassigned_users
User.find_by_sql( User.find_by_sql(
"SELECT DISTINCT users.id, users.full_name FROM users " + "SELECT DISTINCT users.id, users.full_name FROM users " +

View file

@ -43,8 +43,8 @@
</span> </span>
</a> </a>
</div> </div>
<div class="collapse" id="assigned-items-container"> <div class="collapse panel-group" id="assigned-items-container">
... <%= render partial: "my_modules/repositories/repositories_list" %>
</div> </div>
</div> </div>
<!-- Protocol --> <!-- Protocol -->

View file

@ -0,0 +1,24 @@
<% @assigned_repositories.each do |repository| %>
<div class="assigned-repository panel">
<a class="assigned-repository-caret collapsed"
role="button"
data-toggle="collapse"
href="#assigned-repository-items-container-<%= repository.id %>"
data-parent="#assigned-items-container"
>
<i class="fas fa-caret-right"></i>
<span class="assigned-repository-title" data-rows-count="[<%= @my_module.repository_rows_count(repository) %>]">
<%= repository.name %>
</span>
<div class="action-buttons">
<i class="fas fa-expand full-screen"></i>
<i class="fas fa-trash unassign-repository"></i>
</div>
</a>
<div class="collapse"
id="assigned-repository-items-container-<%= repository.id %>"
>
Repository table
</div>
</div>
<% end %>