Update reports for new RTE [SCI-3263] (#1691)

* Update reports for new RTE
This commit is contained in:
aignatov-bio 2019-04-25 16:16:43 +02:00 committed by GitHub
parent 0cf688be39
commit 1a860037f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 2 deletions

View file

@ -180,7 +180,7 @@ function initializeNewElement(newEl) {
switch (parent.data("type")) { switch (parent.data("type")) {
case "experiment": case "experiment":
url = dh.data("add-experiment-contents-url"); break; url = dh.data("add-experiment-contents-url"); break;
case "my_module": case 'my_module' || 'protocol':
url = dh.data("add-module-contents-url"); break; url = dh.data("add-module-contents-url"); break;
case "step": case "step":
url = dh.data("add-step-contents-url"); break; url = dh.data("add-step-contents-url"); break;

View file

@ -258,6 +258,7 @@ label {
.module-name { .module-name {
margin-left: 15px; margin-left: 15px;
} }
.module-tags { .module-tags {
margin-left: 0; margin-left: 0;
margin-top: 10px; margin-top: 10px;
@ -275,6 +276,12 @@ label {
} }
} }
.module-protocol-description {
margin-left: 0;
margin-right: 0;
margin-top: 10px;
}
&:hover > .report-element-body .module-name { &:hover > .report-element-body .module-name {
color: $brand-primary; color: $brand-primary;
} }

View file

@ -69,6 +69,14 @@ module ReportActions
def generate_module_contents_json(my_module) def generate_module_contents_json(my_module)
res = [] res = []
res << generate_new_el(false)
el = generate_el(
'reports/elements/my_module_protocol_element.html.erb',
protocol: my_module.protocol
)
res << el
ReportExtends::MODULE_CONTENTS.each do |contents| ReportExtends::MODULE_CONTENTS.each do |contents|
elements = [] elements = []
contents.values.each do |element| contents.values.each do |element|

View file

@ -38,7 +38,7 @@
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<% if my_module.description.present? %> <% if my_module.description.present? %>
<%= custom_auto_link(my_module.tinymce_render(:description), team: current_team) %> <%= custom_auto_link(my_module.prepare_for_report(:description), team: current_team) %>
<% else %> <% else %>
<em><%=t "projects.reports.elements.module.no_description" %></em> <em><%=t "projects.reports.elements.module.no_description" %></em>
<% end %> <% end %>

View file

@ -0,0 +1,21 @@
<div class="report-element report-module-protocol-element" data-ts="<%= protocol.created_at %>" data-type="protocol" data-id='{ "protocol_id": <%= protocol.id %> }' data-scroll-id="<%= protocol.id %>">
<div class="report-element-header">
<div class="row">
<div class="pull-left user-time">
<%=t "projects.reports.elements.module.protocol.user_time", timestamp: l(protocol.created_at, format: :full) %>
</div>
<div class="pull-right controls">
<%= render partial: "reports/elements/element_controls.html.erb", locals: { show_sort: true } %>
</div>
</div>
</div>
<div class="report-element-body">
<div class="row module-protocol-description">
<% if protocol.description.present? %>
<%= custom_auto_link(protocol.prepare_for_report(:description), team: current_team) %>
<% else %>
<em><%= t('my_modules.protocols.protocol_status_bar.no_description') %></em>
<% end %>
</div>
</div>

View file

@ -476,6 +476,8 @@ en:
no_description: "No description" no_description: "No description"
tags_header: "Task tags:" tags_header: "Task tags:"
no_tags: "No tags" no_tags: "No tags"
protocol:
user_time: "Protocol created on %{timestamp}."
experiment: experiment:
user_time: "Experiment created on %{timestamp}." user_time: "Experiment created on %{timestamp}."
no_description: "No description" no_description: "No description"