mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-27 15:36:39 +08:00
Amend step labeling for step-result links [SCI-12093]
This commit is contained in:
parent
54f347d4c8
commit
d5e2acdbb6
9 changed files with 12 additions and 17 deletions
|
@ -34,7 +34,7 @@ class StepResultsController < ApplicationController
|
|||
StepResult.create!(step: step, result: @results.first, created_by: current_user)
|
||||
log_activity(:step_and_result_linked, @results.first.my_module, step, @results.first)
|
||||
end
|
||||
render json: { steps: @results.first.steps.map { |s| { id: s.id, name: s.name } } }, status: :created
|
||||
render json: { steps: @results.first.steps.map { |s| { id: s.id, name: s.label } } }, status: :created
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
Rails.logger.error e.message
|
||||
render json: { message: :error }, status: :unprocessable_entity
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
:value="selectedSteps"
|
||||
:searchable="true"
|
||||
@change="changeSteps"
|
||||
:option-renderer="stepRenderer"
|
||||
:multiple="true"
|
||||
:withCheckboxes="true"
|
||||
:placeholder="i18n.t('my_modules.results.modals.link_steps.placeholder')" />
|
||||
|
@ -147,9 +146,6 @@ export default {
|
|||
this.loading = false;
|
||||
});
|
||||
},
|
||||
stepRenderer(option) {
|
||||
return `${option[2].position + 1}. ${option[1]}`;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -179,6 +179,10 @@ class Step < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def label
|
||||
I18n.t('protocols.steps.label', name: name, position: position + 1)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def duplicate_table(new_step, user, table)
|
||||
|
|
|
@ -19,7 +19,7 @@ class ResultSerializer < ActiveModel::Serializer
|
|||
|
||||
def steps
|
||||
object.steps.map do |step|
|
||||
{ id: step.id, name: step.name }
|
||||
{ id: step.id, name: step.label }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ module Reports::Docx::DrawResults
|
|||
text ' | '
|
||||
text I18n.t('projects.reports.elements.result.linked_steps'), color: color[:gray]
|
||||
text ' '
|
||||
text result.steps.pluck(:name).join('; '), color: color[:gray]
|
||||
text result.steps.map(&:label).join('; '), color: color[:gray]
|
||||
end
|
||||
end
|
||||
draw_result_asset(result, @settings) if @settings.dig('task', 'file_results')
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
<%= t('projects.reports.elements.result.user_time', user: result.user.full_name, timestamp: l(result.created_at, format: :full)) %>
|
||||
<% end %>
|
||||
<% if !@settings['exclude_task_metadata'] && result.steps.size.positive? %>
|
||||
| <%= t("projects.reports.elements.result.linked_steps") %> <%= result.steps.pluck(:name).join('; ') %>
|
||||
| <%= t("projects.reports.elements.result.linked_steps") %> <%= result.steps.map(&:label).join('; ') %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<ul id="StepsMenuDropdown<%= result.id %>" class="dropdown-menu dropdown-menu-right px-4 py-2">
|
||||
<% result.steps.each do |step| %>
|
||||
<li class="dropdown-item">
|
||||
<%= link_to step.name, shared_protocol_url(@shareable_link.uuid), class: "!py-2.5 !px-3 hover:!bg-sn-super-light-grey !cursor-pointer !block hover:!no-underline !text-sn-blue !truncate" %>
|
||||
<%= link_to step.label, shared_protocol_url(@shareable_link.uuid), class: "!py-2.5 !px-3 hover:!bg-sn-super-light-grey !cursor-pointer !block hover:!no-underline !text-sn-blue !truncate" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
json.array! @steps do |r|
|
||||
json.array! [
|
||||
r.id,
|
||||
r.name,
|
||||
{
|
||||
position: r.position
|
||||
}
|
||||
]
|
||||
json.array! @steps do |s|
|
||||
json.array! [s.id, s.label]
|
||||
end
|
||||
|
|
|
@ -4027,6 +4027,7 @@ en:
|
|||
ztoa_html: "<i class=\"fas fa-sort-alpha-up\"></i> Name Z to A"
|
||||
|
||||
steps:
|
||||
label: "Step %{position} - %{name}"
|
||||
placeholder: 'Step name'
|
||||
default_name: 'Untitled step'
|
||||
completed: 'Completed'
|
||||
|
|
Loading…
Add table
Reference in a new issue