Add new statuses to reports

This commit is contained in:
aignatov-bio 2020-07-23 14:24:30 +02:00
parent c13730ee8d
commit a0d19b5d98
5 changed files with 84 additions and 47 deletions

View file

@ -279,10 +279,17 @@ label {
.module-start-date,
.module-due-date {
margin-left: 5px;
white-space: nowrap;
}
.module-status {
.status-block {
border-radius: $border-radius-tag;
color: $color-white;
padding: 2px 4px;
}
}
.module-tags {
margin-left: 0;
margin-top: 10px;
@ -387,6 +394,16 @@ label {
&:hover > .report-element-body .step-name {
color: $brand-primary;
}
.step-label-default {
@include font-h3;
color: $color-alto;
}
.step-label-success {
@include font-h3;
color: $brand-success;
}
}
/* Step attachment style (table, asset or checklist) */

View file

@ -153,7 +153,7 @@ module ReportsHelper
style = 'default'
text = t('protocols.steps.uncompleted')
end
"<span class=\"label label-#{style}\">#{text}</span>".html_safe
"<span class=\"label step-label-#{style}\">[#{text}]</span>".html_safe
end
# Fixes issues with avatar images in reports

View file

@ -13,17 +13,6 @@ module Reports::Docx::DrawMyModule
@docx.p do
text I18n.t('projects.reports.elements.module.user_time',
timestamp: I18n.l(my_module.created_at, format: :full)), color: color[:gray]
text ' | '
if my_module.due_date.present?
text I18n.t('projects.reports.elements.module.due_date',
due_date: I18n.l(my_module.due_date, format: :full)), color: color[:gray]
else
text I18n.t('projects.reports.elements.module.no_due_date'), color: color[:gray]
end
if my_module.completed?
text " #{I18n.t('my_modules.states.completed')}", bold: true, color: color[:green]
text " #{I18n.l(my_module.completed_on, format: :full)}", color: color[:gray]
end
if my_module.archived?
text ' | '
text I18n.t('search.index.archived'), color: color[:gray]
@ -33,11 +22,32 @@ module Reports::Docx::DrawMyModule
scinote_url + Rails.application.routes.url_helpers.protocols_my_module_path(my_module),
link_style
end
if my_module.description.present?
html = custom_auto_link(my_module.description, team: @report_team)
html_to_word_converter(html)
else
@docx.p I18n.t 'projects.reports.elements.module.no_description'
@docx.p do
if my_module.started_on.present?
text I18n.t('projects.reports.elements.module.started_on',
started_on: I18n.l(my_module.started_on, format: :full))
else
text I18n.t('projects.reports.elements.module.no_due_date')
end
end
@docx.p do
if my_module.due_date.present?
text I18n.t('projects.reports.elements.module.due_date',
due_date: I18n.l(my_module.due_date, format: :full))
else
text I18n.t('projects.reports.elements.module.no_due_date')
end
end
status = my_module.my_module_status
@docx.p do
text I18n.t('projects.reports.elements.module.status')
text ' '
text "[#{status.name}]", color: status.color.delete('#')
text ' '
text I18n.l(my_module.completed_on, format: :full)
end
@docx.p do
@ -53,6 +63,13 @@ module Reports::Docx::DrawMyModule
end
end
if my_module.description.present?
html = custom_auto_link(my_module.description, team: @report_team)
html_to_word_converter(html)
else
@docx.p I18n.t 'projects.reports.elements.module.no_description'
end
@docx.p
subject['children'].each do |child|
public_send("draw_#{child['type_of']}", child)

View file

@ -24,36 +24,27 @@
<% end %>
</h4>
</div>
<div class="pull-right module-start-date">
<% if my_module.started_on.present? %>
<%= t('projects.reports.elements.module.started_on', started_on: l(my_module.started_on, format: :full)) %>
<% else %>
<em><%=t "projects.reports.elements.module.no_start_date" %></em>
<% end %>
</div>
<div class="pull-right module-due-date">
<% if my_module.due_date.present? %>
<%=t "projects.reports.elements.module.due_date", due_date: l(my_module.due_date, format: :full) %>
<% else %>
<em><%=t "projects.reports.elements.module.no_due_date" %></em>
<% end %>
<% if my_module.completed? %>
<%= t("my_modules.states.completed") %>
<%= l(my_module.completed_on, format: :full) %>
<% end %>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<% if my_module.description.present? %>
<%= custom_auto_link(my_module.prepare_for_report(:description, for_export_all),
team: current_team,
base64_encoded_imgs: for_export_all) %>
<% else %>
<em><%=t "projects.reports.elements.module.no_description" %></em>
<% end %>
</div>
</div>
<p class="module-start-date">
<% if my_module.started_on.present? %>
<%= t('projects.reports.elements.module.started_on', started_on: l(my_module.started_on, format: :full)) %>
<% else %>
<em><%=t "projects.reports.elements.module.no_start_date" %></em>
<% end %>
</p>
<p class="module-due-date">
<% if my_module.due_date.present? %>
<%=t "projects.reports.elements.module.due_date", due_date: l(my_module.due_date, format: :full) %>
<% else %>
<em><%=t "projects.reports.elements.module.no_due_date" %></em>
<% end %>
</p>
<p class="module-status">
<% status = my_module.my_module_status %>
<%=t "projects.reports.elements.module.status" %>
<span class="status-block" style="background: <%= status.color %>"><%= status.name %></span>
<%= l(my_module.completed_on, format: :full) %>
</p>
<div class="row module-tags">
<div class="pull-left">
<%=t "projects.reports.elements.module.tags_header" %>
@ -70,6 +61,17 @@
</div>
<% end %>
</div>
<div class="row">
<div class="col-xs-12">
<% if my_module.description.present? %>
<%= custom_auto_link(my_module.prepare_for_report(:description, for_export_all),
team: current_team,
base64_encoded_imgs: for_export_all) %>
<% else %>
<em><%=t "projects.reports.elements.module.no_description" %></em>
<% end %>
</div>
</div>
</div>
<div class="report-element-children">
<%= children if (defined? children and children.present?) %>

View file

@ -519,6 +519,7 @@ en:
module:
user_time: "Task created on %{timestamp}."
started_on: "Start date: %{started_on}"
status: "Status:"
no_start_date: "No start date"
due_date: "Due date: %{due_date}"
no_due_date: "No due date"