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
|
||||
|
||||
@@ -9,6 +9,7 @@ module Debates
|
||||
@debate.register_vote(current_user, 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
|
||||
@@ -17,6 +18,7 @@ module Debates
|
||||
@debate.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
|
||||
|
||||
@@ -13,6 +13,7 @@ module Legislation
|
||||
@proposal.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
|
||||
@@ -21,6 +22,7 @@ module Legislation
|
||||
@proposal.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