Merge pull request #1391 from okriuchykhin/ok_SCI_2880

Fix smart annotations rendering issues [SCI-2880]
This commit is contained in:
Alex Kriuchykhin 2018-11-28 09:47:20 +01:00 committed by GitHub
commit 20e2cbf0ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 24 additions and 23 deletions

View file

@ -127,7 +127,7 @@ class MyModuleCommentsController < ApplicationController
module: @my_module.name module: @my_module.name
) )
) )
message = custom_auto_link(@comment.message) message = custom_auto_link(@comment.message, team: current_team)
render json: { comment: message }, status: :ok render json: { comment: message }, status: :ok
else else
render json: { errors: @comment.errors.to_hash(true) }, render json: { errors: @comment.errors.to_hash(true) },

View file

@ -120,7 +120,7 @@ class ProjectCommentsController < ApplicationController
project: @project.name project: @project.name
) )
) )
message = custom_auto_link(@comment.message) message = custom_auto_link(@comment.message, team: current_team)
render json: { comment: message }, status: :ok render json: { comment: message }, status: :ok
else else
render json: { errors: @comment.errors.to_hash(true) }, render json: { errors: @comment.errors.to_hash(true) },

View file

@ -124,7 +124,7 @@ class ResultCommentsController < ApplicationController
result: @result.name result: @result.name
) )
) )
message = custom_auto_link(@comment.message) message = custom_auto_link(@comment.message, team: current_team)
render json: { comment: message }, status: :ok render json: { comment: message }, status: :ok
else else
render json: { errors: @comment.errors.to_hash(true) }, render json: { errors: @comment.errors.to_hash(true) },

View file

@ -124,7 +124,7 @@ class StepCommentsController < ApplicationController
step_name: @step.name step_name: @step.name
) )
) )
message = custom_auto_link(@comment.message) message = custom_auto_link(@comment.message, team: current_team)
render json: { comment: message }, status: :ok render json: { comment: message }, status: :ok
else else
render json: { errors: @comment.errors.to_hash(true) }, render json: { errors: @comment.errors.to_hash(true) },

View file

@ -166,18 +166,20 @@ module ApplicationHelper
user_name = user.full_name user_name = user.full_name
unless skip_user_status || user_still_in_team html =
user_name << " #{I18n.t('atwho.res.removed')}" raw("<img src='#{user_avatar_absolute_url(user, :icon_small)}'" \
end
raw("<img src='#{user_avatar_absolute_url(user, :icon_small)}'" \
"alt='avatar' class='atwho-user-img-popover'" \ "alt='avatar' class='atwho-user-img-popover'" \
" ref='#{'missing-img' if missing_avatar(user, :icon_small)}'>") + " ref='#{'missing-img' if missing_avatar(user, :icon_small)}'>") +
raw('<a onClick="$(this).popover(\'show\')" ' \ raw('<a onClick="$(this).popover(\'show\')" ' \
'class="atwho-user-popover" data-container="body" ' \ 'class="atwho-user-popover" data-container="body" ' \
'data-html="true" tabindex="0" data-trigger="focus" ' \ 'data-html="true" tabindex="0" data-trigger="focus" ' \
'data-placement="top" data-toggle="popover" data-content="') + 'data-placement="top" data-toggle="popover" data-content="') +
raw(user_description) + raw('" >') + user_name + raw('</a>') raw(user_description) + raw('" >') + user_name + raw('</a>')
unless skip_user_status || user_still_in_team
html << " #{I18n.t('atwho.res.removed')}"
end
html
end end
# Dirty, dirty hack for displaying images in reports # Dirty, dirty hack for displaying images in reports

View file

@ -48,9 +48,7 @@
<div id="results" data-module-id="<%= @my_module.id %>"> <div id="results" data-module-id="<%= @my_module.id %>">
<% ordered_result_of(@my_module).each do |result| %> <% ordered_result_of(@my_module).each do |result| %>
<% cache [current_user, result] do %> <%= render partial: "result", locals: { result: result } %>
<%= render partial: "result", locals: { result: result } %>
<% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

View file

@ -25,9 +25,7 @@
<div id="steps"> <div id="steps">
<% @protocol.steps.order(:position).each do |step| %> <% @protocol.steps.order(:position).each do |step| %>
<% cache [current_user, step] do %> <%= render partial: "steps/step.html.erb", locals: { step: step } %>
<%= render partial: "steps/step.html.erb", locals: { step: step } %>
<% end %>
<% end %> <% end %>
</div> </div>
<% if @protocol.steps.count == 0 %> <% if @protocol.steps.count == 0 %>

View file

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

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.description) %> <%= custom_auto_link(my_module.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

@ -24,6 +24,7 @@
<div class="row"> <div class="row">
<div class="col-xs-12 text-container ql-editor"> <div class="col-xs-12 text-container ql-editor">
<%= custom_auto_link(generate_image_tag_from_token(result_text.text, result_text, true), <%= custom_auto_link(generate_image_tag_from_token(result_text.text, result_text, true),
team: current_team,
simple_format: false, simple_format: false,
tags: %w(img)) %> tags: %w(img)) %>
</div> </div>

View file

@ -31,6 +31,7 @@
<div class="col-xs-12 ql-editor"> <div class="col-xs-12 ql-editor">
<% if strip_tags(step.description).present? %> <% if strip_tags(step.description).present? %>
<%= custom_auto_link(generate_image_tag_from_token(step.description, step, true), <%= custom_auto_link(generate_image_tag_from_token(step.description, step, true),
team: current_team,
simple_format: false, simple_format: false,
tags: %w(img)) %> tags: %w(img)) %>
<% else %> <% else %>

View file

@ -31,7 +31,7 @@
</span> </span>
<span class="comment-message"> <span class="comment-message">
&nbsp; &nbsp;
<%= custom_auto_link(comment.message) %> <%= custom_auto_link(comment.message, team: current_team) %>
</span> </span>
</li> </li>
<% end %> <% end %>

View file

@ -8,7 +8,7 @@
<span class="fas fa-tasks"></span> <span class="fas fa-tasks"></span>
</div> </div>
<div class="pull-left checklist-name"> <div class="pull-left checklist-name">
<%= custom_auto_link(t('projects.reports.elements.step_checklist.checklist_name', name: checklist.name)) %> <%= custom_auto_link(t('projects.reports.elements.step_checklist.checklist_name', name: checklist.name), team: current_team) %>
</div> </div>
<div class="pull-left user-time"> <div class="pull-left user-time">
<%=t 'projects.reports.elements.step_checklist.user_time', timestamp: l(timestamp, format: :full) %> <%=t 'projects.reports.elements.step_checklist.user_time', timestamp: l(timestamp, format: :full) %>
@ -25,6 +25,7 @@
<input type="checkbox" disabled="disabled" <%= "checked='checked'" if item.checked %>/> <input type="checkbox" disabled="disabled" <%= "checked='checked'" if item.checked %>/>
<span class="<%= 'checked' if item.checked %>"> <span class="<%= 'checked' if item.checked %>">
<%= custom_auto_link(item.text, <%= custom_auto_link(item.text,
team: current_team,
simple_format: true, simple_format: true,
wrapper_tag: { wrapper_tag: 'span'}) %> wrapper_tag: { wrapper_tag: 'span'}) %>
</span> </span>

View file

@ -31,7 +31,7 @@
</span> </span>
<span class="comment-message"> <span class="comment-message">
&nbsp; &nbsp;
<%= custom_auto_link(comment.message) %> <%= custom_auto_link(comment.message, team: current_team) %>
</span> </span>
</li> </li>
<% end %> <% end %>