Merge pull request #4429 from G-Chubinidze/gc_SCI_7172

Expose project IDs in tables & cards view [SCI-7172]  [SCI-7173] [SCI-7201]
This commit is contained in:
G-Chubinidze 2022-12-02 20:16:05 +04:00 committed by GitHub
commit df4ac4d5b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 142 additions and 25 deletions

View file

@ -519,7 +519,7 @@ var ProjectsIndex = (function() {
$(projectsPageSelector)
.on('ajax:success', '.change-projects-view-type-form', function(ev, data) {
$(cardsWrapper).removeClass('list').addClass(data.cards_view_type_class);
$(cardsWrapper).removeClass('list cards').addClass(data.cards_view_type_class);
$(projectsPageSelector).find('.cards-switch .button-to').removeClass('selected');
$(ev.target).find('.button-to').addClass('selected');
$(ev.target).parents('.dropdown.view-switch').removeClass('open');

View file

@ -701,18 +701,13 @@ li.module-hover {
.project-name-cell {
align-items: center;
display: flex;
height: 2em;
margin: 0 1.75em;
overflow: hidden;
a {
color: inherit;
overflow: hidden;
white-space: nowrap;
}
.name {
line-height: 2em;
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
@ -866,7 +861,7 @@ li.module-hover {
}
&.list {
grid-template-columns: max-content repeat(calc(var(--list-columns-number) - 3), minmax(100px, auto)) max-content max-content;
grid-template-columns: max-content repeat(calc(var(--list-columns-number) - 2), minmax(100px, auto)) max-content max-content;
.projects-group {
display: contents;
@ -914,7 +909,7 @@ li.module-hover {
}
.name {
grid-column: 5 span;
grid-column: 6 span;
line-height: 3em;
&:before {
@ -944,22 +939,28 @@ li.module-hover {
}
}
.start-date-cell {
.project-code-cell {
display: flex;
align-items: center;
grid-column: 3;
}
.visibility-cell {
.start-date-cell {
grid-column: 4;
}
.user-cell {
.visibility-cell {
grid-column: 5;
}
.user-cell {
grid-column: 6;
}
.actions-cell {
align-items: center;
display: flex;
grid-column: 6;
grid-column: 7;
position: initial;
}
}
@ -1029,6 +1030,7 @@ li.module-hover {
display: none !important;
}
.projects-container {
.project-actions-menu {
.btn-light:hover {
@ -1039,6 +1041,56 @@ li.module-hover {
.cards-wrapper {
grid-auto-rows: 2.5em;
.visibility-cell {
.value {
color: $color-black;
}
}
.start-date-cell {
.value {
color: $color-black;
}
}
.archived-date-cell {
.value {
color: $color-black;
}
}
&.last-page.cards {
.project-card {
.start-date-cell {
top: 36px;
.value {
color: $color-black;
}
}
.archived-date-cell {
top: 26px;
.value {
color: $color-black;
}
}
.visibility-cell {
top: 16px;
.value {
color: $color-black;
}
}
.user-cell {
top: 6px;
}
}
}
.card.project-card {
.data-row {
color: $color-silver-chalice;
@ -1058,23 +1110,23 @@ li.module-hover {
}
&.list {
--list-columns-number: 7;
--list-columns-number: 8;
grid-auto-rows: 3em 1px;
grid-template-columns: max-content repeat(calc(var(--list-columns-number) - 2), minmax(100px, auto)) max-content;
.card {
&.folder-card {
.name {
grid-column: 6 span;
grid-column: 7 span;
}
}
.archived-date-cell {
grid-column: 6;
grid-column: 7;
}
.actions-cell {
grid-column: 7;
grid-column: 8;
position: initial;
}
}
@ -1094,3 +1146,58 @@ li.module-hover {
margin: 1em 0;
}
}
.cards-wrapper.cards {
grid-gap: 25px;
.project-card {
.project-name-cell {
align-items: start !important;
top: 12%;
min-height: 35px;
position: absolute;
left: 14px;
top: 42px;
a {
color: inherit;
}
.name {
-webkit-box-orient: vertical;
display: -webkit-box;
-webkit-line-clamp: 2;
max-width: 200px;
overflow: hidden;
}
}
.project-code-cell {
height: min-content;
margin-top: 5px;
padding-left: 20px;
position: relative;
}
.data-row {
position: relative;
top: 5%;
.card-label {
color: #808080 !important;
}
&.start-date-cell {
top: 30px;
}
&.visibility-cell {
top: 18px;
}
&.user-cell {
top: 5px;
}
}
}
}

View file

@ -2,6 +2,6 @@
module CardsViewHelper
def cards_view_type_class(view_type)
view_type == 'table' ? 'list' : ''
view_type == 'table' ? 'list' : 'cards'
end
end

View file

@ -12,6 +12,9 @@ class Project < ApplicationRecord
include PermissionCheckableModel
include Assignable
ID_PREFIX = 'PR'
include PrefixedIdModel
enum visibility: { hidden: 0, visible: 1 }
auto_strip_attributes :name, nullify: false

View file

@ -28,6 +28,7 @@
</div>
</div>
<div class="table-header-cell"><%= t('.card.name') %></div>
<div class="table-header-cell"><%= t('.card.id') %></div>
<div class="table-header-cell"><%= t('.card.start_date') %></div>
<div class="table-header-cell"><%= t('.card.visibility') %></div>
<div class="table-header-cell"><%= t('.card.users') %></div>

View file

@ -8,6 +8,10 @@
<span class="sci-checkbox-label"></span>
</div>
</div>
<div class="project-code-cell table-cell">
<span><%= project.code %></span>
</div>
<div class="project-name-cell table-cell">
<% if project.archived? %>
<%= link_to project_url(project, view_mode: :archived) do %>
@ -40,6 +44,14 @@
<span class="value cell-value"> <%= l(project.created_at, format: :full_with_comma) %></span>
</div>
<% if project.archived? %>
<div class="data-row archived-date-cell table-cell">
<span class="card-label"><%= t('projects.index.card.archived_date') %></span>
<span class="value card-value"> <%= l(project.archived_on, format: :full_date) %></span>
<span class="value cell-value"> <%= l(project.archived_on, format: :full_with_comma) %></span>
</div>
<% end %>
<div class="data-row visibility-cell table-cell">
<span class="card-label"><%= t('projects.index.card.visibility') %></span>
<span class="value">
@ -68,12 +80,4 @@
<% end %>
</div>
</div>
<% if project.archived? %>
<div class="data-row archived-date-cell table-cell">
<span class="card-label"><%= t('projects.index.card.archived_date') %></span>
<span class="value card-value"> <%= l(project.archived_on, format: :full_date) %></span>
<span class="value cell-value"> <%= l(project.archived_on, format: :full_with_comma) %></span>
</div>
<% end %>
</div>

View file

@ -447,6 +447,7 @@ en:
more_comments: "More Comments"
card:
start_date: "Start date"
id: "ID"
visibility: "Visible to"
users: "Members"
name: "Project name"
@ -1231,6 +1232,7 @@ en:
restore_button: "Restore"
card:
name: "Experiment"
id: "ID"
start_date: "Start date"
modified_date: "Modified date"
archived_date: "Archived date"