Skip to content

Commit

Permalink
Merge pull request #7327 from fjordllc/feature/display-user-name-when…
Browse files Browse the repository at this point in the history
…-hovering-user-icon

ユーザーアイコンにhoverしたときにユーザー名を表示する
  • Loading branch information
komagata authored Feb 20, 2024
2 parents 4a622cd + 37cc341 commit 133e15e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/javascript/markdown-it-container-speak.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default (md) => {
return `<div class="speak">
<div class="speak__speaker">
<a href="/users/${speakerName}" class="a-user-emoji-link">
<img class="js-user-icon a-user-emoji" data-user="${speakerName}">
<img title="@${speakerName}" class="js-user-icon a-user-emoji" data-user="${speakerName}">
<spanv class="speak__speaker-name">${speakerName}</span>
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/markdown-it-user-icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export default MarkdownItRegexp(
/:@(?!mentor:)([a-zA-Z0-9_-]+):/,

(match) => {
return `<a href="/users/${match[1]}" class="a-user-emoji-link"><img class="js-user-icon a-user-emoji" data-user="${match[1]}" width="40" height="40"></a>`
return `<a href="/users/${match[1]}" class="a-user-emoji-link"><img title="@${match[1]}" class="js-user-icon a-user-emoji" data-user="${match[1]}" width="40" height="40"></a>`
}
)
8 changes: 6 additions & 2 deletions test/system/markdown_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class MarkdownTest < ApplicationSystemTestCase
assert_css '.a-long-text.is-md.js-markdown-view'
assert_css '.speak'
assert_css "a[href='/users/mentormentaro']"
assert_includes find('.js-user-icon.a-user-emoji')['data-user'], 'mentormentaro'
emoji = find('.js-user-icon.a-user-emoji')
assert_includes emoji['title'], '@mentormentaro'
assert_includes emoji['data-user'], 'mentormentaro'
end

test 'user profile image markdown test' do
Expand All @@ -25,7 +27,9 @@ class MarkdownTest < ApplicationSystemTestCase

assert_css '.a-long-text.is-md.js-markdown-view'
assert_css "a[href='/users/mentormentaro']"
assert_includes find('.js-user-icon.a-user-emoji')['data-user'], 'mentormentaro'
emoji = find('.js-user-icon.a-user-emoji')
assert_includes emoji['title'], '@mentormentaro'
assert_includes emoji['data-user'], 'mentormentaro'
end

def cmd_ctrl
Expand Down

0 comments on commit 133e15e

Please sign in to comment.