mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 17:36:33 +08:00
Add assigned repositories list
This commit is contained in:
parent
404be29fc0
commit
9678372dd5
5 changed files with 99 additions and 1 deletions
|
@ -74,3 +74,67 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.my-module-assigned-repositories {
|
||||
.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -287,6 +287,7 @@ class MyModulesController < ApplicationController
|
|||
current_team,
|
||||
Constants::RECENT_PROTOCOL_LIMIT
|
||||
).any?
|
||||
@assigned_repositories = @my_module.assigned_repositories_list
|
||||
current_team_switch(@protocol.team)
|
||||
end
|
||||
|
||||
|
|
|
@ -205,6 +205,15 @@ class MyModule < ApplicationRecord
|
|||
.count
|
||||
end
|
||||
|
||||
def assigned_repositories_list
|
||||
my_module_repository_rows.joins(repository_row: :repository)
|
||||
.select('
|
||||
repositories.name,
|
||||
repositories.id,
|
||||
COUNT(my_module_repository_rows.id) as rows_count
|
||||
').group('repositories.name, repositories.id')
|
||||
end
|
||||
|
||||
def unassigned_users
|
||||
User.find_by_sql(
|
||||
"SELECT DISTINCT users.id, users.full_name FROM users " +
|
||||
|
|
24
app/views/my_modules/inventories/_inventories_list.html.erb
Normal file
24
app/views/my_modules/inventories/_inventories_list.html.erb
Normal file
|
@ -0,0 +1,24 @@
|
|||
<div class="my-module-assigned-repositories">
|
||||
<% @assigned_repositories.each do |repository| %>
|
||||
<div class="assigned-repository">
|
||||
<a class="assigned-repository-caret collapsed" role="button"
|
||||
data-toggle="collapse"
|
||||
href="#assigned-repository-items-container-<%= repository.id %>"
|
||||
aria-expanded="false"
|
||||
aria-controls="assigned-repository-items-container-<%= repository.id %>"
|
||||
>
|
||||
<i class="fas fa-caret-right"></i>
|
||||
<span class="assigned-repository-title" data-rows-count="[<%= repository.rows_count %>]">
|
||||
<%= 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 %>
|
||||
</div>
|
|
@ -39,7 +39,7 @@
|
|||
</a>
|
||||
</div>
|
||||
<div class="collapse" id="assigned-items-container">
|
||||
...
|
||||
<%= render partial: "my_modules/inventories/inventories_list" %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Protocol -->
|
||||
|
|
Loading…
Reference in a new issue