* This commit adds the "archived" attribute to the Article model, which will enable users to automatically filter archived articles/drafts from appearing on their dashboard. It also adds an ellipsis menu with a link to archive the article. I've also moved the Mute Notifications button into the ellipsis menu as well. * Add ellipsis menu and make it work * Fix logic error * Hide ellipsis menus when you click elsewhere on the body * Extract function to remove duplication * Ensure that menu is hidden when the ellipsis button is clicked on an open menu * Ensure that archiving post button works and that 'archived' param is accepted by the controller * Enable link to toggle showing/hiding archived articles * Make 'mute' and 'archive' buttons in ellipsis dropdown list work * Refactor to make Code Climate happy * Minor JS refactors
13 lines
394 B
Ruby
13 lines
394 B
Ruby
class ArticleMutesController < ApplicationController
|
|
after_action :verify_authorized
|
|
|
|
def update
|
|
@article = Article.find_by(id: params[:id])
|
|
authorize @article
|
|
@article.update(receive_notifications: permitted_attributes(@article)[:receive_notifications])
|
|
respond_to do |format|
|
|
format.json { head :ok }
|
|
format.html { redirect_to "/dashboard" }
|
|
end
|
|
end
|
|
end
|