Skip to content

Commit

Permalink
feat: comment could @ people (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mandydidi committed Dec 17, 2022
1 parent 4d58e27 commit 0f83b3a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ gem 'bootstrap-sass'
gem 'sass-rails', '~> 5.0.3'
gem 'uglifier', '>= 2.7.1'
gem 'jquery-rails'
gem 'jquery-atwho-rails'
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ GEM
hashie (5.0.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jquery-atwho-rails (1.5.4)
jquery-rails (4.5.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
Expand Down Expand Up @@ -299,6 +300,7 @@ DEPENDENCIES
dotenv-rails
factory_girl (~> 4.0)
guard
jquery-atwho-rails
jquery-rails
launchy
omniauth
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require jquery.atwho
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*
*= require_tree .
*= require_self
//= require jquery.atwho
*/
// @import "bootstrap";

Expand Down
1 change: 1 addition & 0 deletions app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def show
@attendees[person] = User.find_by(username: person)
end
@user_id = User.find_by(username: u).id
@usernames = User.pluck(:username)
end

def index
Expand Down
5 changes: 5 additions & 0 deletions app/views/events/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,8 @@
<% end %>
<%# </div>
</div> %>

<script>
data = <%= raw @usernames.compact.to_json %>;
$('#comment_content').atwho({at:"@", 'data':data});
</script>

0 comments on commit 0f83b3a

Please sign in to comment.