Merge pull request #6065 from ivanscinote/SCI-9007-update-colors

Update 'Not started' status color at reports [SCI-9007]
This commit is contained in:
artoscinote 2023-08-28 09:56:25 +02:00 committed by GitHub
commit 953bd234f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 22 additions and 15 deletions

View file

@ -43,7 +43,7 @@ var ExperimnetTable = {
return `<a href="${data.url}">${data.count}</a>`;
},
status: function(data) {
return `<div class="my-module-status ${data.name === 'Not started' ? 'btn-not-started' : ''}"
return `<div class="my-module-status ${data.light_color ? 'status-light' : ''}"
style="background-color: ${data.color}">${data.name}</div>`;
},
assigned: function(data) {

View file

@ -212,7 +212,7 @@
font-weight: bold;
padding: .25em .5em;
&.btn-not-started {
&.status-light {
@include not-started;
}
}

View file

@ -36,7 +36,7 @@
text-overflow: ellipsis;
white-space: nowrap;
&.btn-not-started {
&.status-light {
@include not-started;
}
}

View file

@ -360,7 +360,7 @@
text-overflow: ellipsis;
white-space: nowrap;
&.btn-not-started {
&.status-light {
@include not-started;
}
}

View file

@ -12,7 +12,7 @@
text-align: left;
width: 100%;
&.btn-not-started {
&.status-light {
@include not-started;
}
@ -72,7 +72,7 @@
white-space: nowrap;
}
.btn-not-started {
.status-light {
@include not-started;
}
@ -136,7 +136,7 @@
padding: .5em;
white-space: nowrap;
&.btn-not-started {
&.status-light {
@include not-started;
}
}

View file

@ -121,6 +121,7 @@ module Dashboard
tasks = tasks.search_by_name(current_user, current_team, task_filters[:query]) if task_filters[:query].present?
tasks.joins(:my_module_status)
.includes(:my_module_status)
.select(
'my_modules.*',
'my_module_statuses.name AS status_name',

View file

@ -67,6 +67,10 @@ class MyModuleStatus < ApplicationRecord
mm_copy.errors.messages&.values&.flatten
end
def light_color?
color == '#FFFFFF'
end
private
def next_in_same_flow

View file

@ -154,7 +154,8 @@ module Experiments
def status_presenter(my_module)
{
name: escape_input(my_module.my_module_status.name),
color: escape_input(my_module.my_module_status.color)
color: escape_input(my_module.my_module_status.color),
light_color: escape_input(my_module.my_module_status.light_color?)
}
end

View file

@ -42,7 +42,7 @@ module Reports::Docx::DrawMyModule
@docx.p do
text I18n.t('projects.reports.elements.module.status')
text ' '
text "[#{status.name}]", color: status.color.delete('#')
text "[#{status.name}]", color: (status.light_color? ? '000000' : status.color.delete('#'))
if my_module.completed?
text " #{I18n.t('my_modules.states.completed')} #{I18n.l(my_module.completed_on, format: :full)}"
end

View file

@ -65,7 +65,7 @@
</div>
</div>
<div class="status-label <%= 'btn-not-started' if my_module.my_module_status.name == 'Not started' %>"
<div class="status-label <%= 'status-light' if my_module.my_module_status.light_color? %>"
style="--state-color: <%= my_module.my_module_status.color %>">
<% if my_module.status_changing %>
<i class="fas fa-spinner fa-spin"></i>

View file

@ -16,7 +16,7 @@
<% end %>
</div>
<div class="task-status-container row-border">
<span class="task-status <%= 'btn-not-started' if task.status_name == 'Not started' %>"
<span class="task-status <%= 'status-light' if task.my_module_status.light_color? %>"
style="background:<%= task.status_color %>">
<%= task.status_name %>
</span>

View file

@ -11,7 +11,7 @@
<%= t('my_modules.modals.status_flow_modal.current_status') %><i class="fas fa-long-arrow-alt-right"></i>
<% end %>
</div>
<div class="status-block <%= 'btn-not-started' if status.name == 'Not started' %>"
<div class="status-block <%= 'status-light' if status.light_color? %>"
style="background: <%= status[:color] %>">
<%= status[:name] %>
</div>

View file

@ -24,7 +24,7 @@
data-status-check-url="<%= status_state_my_module_path(my_module) %>">
<button class="btn btn-secondary dropdown-toggle
<%= 'disabled' if my_module.status_changing || my_module.archived_branch? %>
<%= 'btn-not-started' if status.name == 'Not started' %>"
<%= 'status-light' if status.light_color? %>"
type="button"
data-toggle="dropdown"
aria-haspopup="true"
@ -48,7 +48,7 @@
<span><%= t('my_module_statuses.dropdown.return_label') %></span>
<i class="fas fa-long-arrow-alt-right"></i>
<div class="status-container">
<div class="status-name <%= 'btn-not-started' if previous_s.name == 'Not started' %>"
<div class="status-name <%= 'status-light' if previous_s.light_color? %>"
style="<%= "background-color: #{previous_s.color}" %>"><%= previous_s.name %></div>
</div>
</li>

View file

@ -25,7 +25,8 @@
<p class="module-status">
<% status = my_module.my_module_status %>
<%= t('projects.reports.elements.module.status') %>
<span class="status-block" style="background: <%= status.color %>">
<span class="status-block" style="background: <%= status.color %>;
<%= 'color: #000000; border: 1px solid #D0D5DD;' if status.light_color? %>">
<%= status.name %>
</span>
<% if my_module.completed? %>