Allow liking/unliking when JavaScript is disabled
Even if pretty much nobody uses a browser with JavaScript disabled when navigating our sites, there might be times where JavaScript isn't loaded for reasons like a slow internet connections not getting the JavaScript files or a technical issue. So we're making it possible to still use the like/unlike buttons in these cases.
This commit is contained in:
@@ -10,6 +10,7 @@ module Comments
|
||||
@comment.vote_by(voter: current_user, vote: params[:value])
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to request.referer, notice: I18n.t("flash.actions.create.vote") }
|
||||
format.js { render :show }
|
||||
end
|
||||
end
|
||||
@@ -18,6 +19,7 @@ module Comments
|
||||
@comment.unvote_by(current_user)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to request.referer, notice: I18n.t("flash.actions.destroy.vote") }
|
||||
format.js { render :show }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user