Skip to content

Commit

Permalink
Fix #1207
Browse files Browse the repository at this point in the history
  • Loading branch information
mjy committed Dec 5, 2019
1 parent 7fdcdf2 commit 10a64fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/helpers/notes_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def note_list_tag(object)
def note_autocomplete_tag(note, term)
return nil if note.nil?
a = [
content_tag(:span, mark_tag(note.text, term), class: [:regular_type]),
content_tag(:span, mark_tag(note.text, term), class: [:regular_type]),
content_tag(:div, object_tag(note.note_object), class: [:feedback, 'feedback-secondary', 'feedback-thin'] ),
content_tag(:span, note.note_object_type, class: [:feedback, 'feedback-info', 'feedback-thin'] ),
].compact.join(' ').html_safe
Expand Down
14 changes: 7 additions & 7 deletions app/helpers/taxon_names_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ def taxon_name_autocomplete_tag(taxon_name, term)
].compact.join(' ').html_safe
end

# @return [String]
# no HTML inside <input>
def taxon_name_autocomplete_selected_tag(taxon_name)
return nil if taxon_name.nil?
[taxon_name.cached, taxon_name.cached_author_year].compact.join(' ')
end

def taxon_name_rank_tag(taxon_name, css_class = [:feedback, 'feedback-info', 'feedback-thin'] )
return nil if taxon_name.nil?
content_tag(:span, taxon_name.rank || 'Combination', class: css_class)
Expand Down Expand Up @@ -145,13 +152,6 @@ def original_taxon_name_link(taxon_name)
link_to(original_taxon_name_tag(taxon_name).html_safe, browse_nomenclature_task_path(taxon_name_id: taxon_name.id))
end

# @return [String]
# no HTML inside <input>
def taxon_name_autocomplete_selected_tag(taxon_name)
return nil if taxon_name.nil?
[taxon_name.cached, taxon_name.cached_author_year].compact.join(' ')
end

def taxon_name_for_select(taxon_name)
taxon_name.name if taxon_name
end
Expand Down
4 changes: 3 additions & 1 deletion app/helpers/workbench/html_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ def mark_tag(string, term)
return nil if string.nil?
return string if term.nil?
t = Regexp.escape(term)
string.gsub(/(#{t})/i, content_tag(:mark, '\1')).html_safe

# (?!>) Don't substitute if the next character is a closing paren
string.gsub(/(#{t})(?!>)/i, content_tag(:mark, '\1')).html_safe
end

end
Expand Down

0 comments on commit 10a64fd

Please sign in to comment.