mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-17 14:19:05 +08:00
Fix toggling of checklist items with smart annotations [SCI-7070]
This commit is contained in:
parent
c106c2d997
commit
fc77adf2bc
1 changed files with 6 additions and 6 deletions
|
|
@ -114,26 +114,26 @@ module ApplicationHelper
|
||||||
def smart_annotation_parser(text, team = nil, base64_encoded_imgs = false, preview_repository = false)
|
def smart_annotation_parser(text, team = nil, base64_encoded_imgs = false, preview_repository = false)
|
||||||
# sometimes happens that the "team" param gets wrong data: "{nil, []}"
|
# sometimes happens that the "team" param gets wrong data: "{nil, []}"
|
||||||
# so we have to check if the "team" param is kind of Team object
|
# so we have to check if the "team" param is kind of Team object
|
||||||
team = nil unless team.is_a? Team
|
team = nil unless team.is_a?(Team)
|
||||||
new_text = smart_annotation_filter_resources(text, team, preview_repository)
|
new_text = smart_annotation_filter_resources(text, team, preview_repository: preview_repository)
|
||||||
new_text = smart_annotation_filter_users(new_text, team, base64_encoded_imgs)
|
smart_annotation_filter_users(new_text, team, base64_encoded_imgs: base64_encoded_imgs)
|
||||||
new_text
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if text have smart annotations of resources
|
# Check if text have smart annotations of resources
|
||||||
# and outputs a link to resource
|
# and outputs a link to resource
|
||||||
def smart_annotation_filter_resources(text, team, preview_repository = false)
|
def smart_annotation_filter_resources(text, team, preview_repository: false)
|
||||||
user = if !defined?(current_user) && @user
|
user = if !defined?(current_user) && @user
|
||||||
@user
|
@user
|
||||||
else
|
else
|
||||||
current_user
|
current_user
|
||||||
end
|
end
|
||||||
|
team ||= defined?(current_team) ? current_team : nil
|
||||||
SmartAnnotations::TagToHtml.new(user, team, text, preview_repository).html
|
SmartAnnotations::TagToHtml.new(user, team, text, preview_repository).html
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if text have smart annotations of users
|
# Check if text have smart annotations of users
|
||||||
# and outputs a popover with user information
|
# and outputs a popover with user information
|
||||||
def smart_annotation_filter_users(text, team, base64_encoded_imgs = false)
|
def smart_annotation_filter_users(text, team, base64_encoded_imgs: false)
|
||||||
sa_user = /\[\@(.*?)~([0-9a-zA-Z]+)\]/
|
sa_user = /\[\@(.*?)~([0-9a-zA-Z]+)\]/
|
||||||
new_text = text.gsub(sa_user) do |el|
|
new_text = text.gsub(sa_user) do |el|
|
||||||
match = el.match(sa_user)
|
match = el.match(sa_user)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue