Skip to content

Commit

Permalink
修正前端 Mention 的 autocomplete 列表多出现 in-reply-to 的用户名的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Apr 17, 2017
1 parent 565bce4 commit 9d97ff6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/assets/javascripts/app.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ AppView = Backbone.View.extend
$("a[rel=twipsy]").tooltip()

# CommentAble @ 回复功能
App.atReplyable(".cell_comments_new textarea")
App.mentionable(".cell_comments_new textarea")

likeable : (e) ->
if !App.isLogined()
Expand Down Expand Up @@ -350,7 +350,7 @@ window.App =

# scan logins in jQuery collection and returns as a object,
# which key is login, and value is the name.
scanLogins: (query) ->
scanMentionableLogins: (query) ->
result = []
logins = []
for e in query
Expand All @@ -367,7 +367,7 @@ window.App =
result.push(item)
_.uniq(result)

atReplyable : (el, logins) ->
mentionable : (el, logins) ->
logins = [] if !logins
$(el).atwho
at : "@"
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/topics.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ window.TopicView = Backbone.View.extend
show : true

# @ Mention complete
App.atReplyable("textarea", App.scanLogins($(".reply")))
App.mentionable("textarea", App.scanMentionableLogins($(".reply .infos .info")))

# Focus title field in new-topic page
$("body[data-controller-name='topics'] #topic_title").focus()
Expand Down

0 comments on commit 9d97ff6

Please sign in to comment.