about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2017-10-15 04:51:42 -0500
committerDavid Yip <yipdw@member.fsf.org>2017-10-21 14:54:36 -0500
commit2e03a10059889cb05d4fab7736447a4315f90bf5 (patch)
treec5f4a997e9ed281ed356284f2c2450fb3a46d8bf /app/controllers
parent4fa2f7e82d68c974ecfdb8896f15a5a3aba25828 (diff)
Spike out index and new views for keyword mutes controller.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/settings/keyword_mutes_controller.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/controllers/settings/keyword_mutes_controller.rb b/app/controllers/settings/keyword_mutes_controller.rb
index ffe94e33a..4b3e01b9c 100644
--- a/app/controllers/settings/keyword_mutes_controller.rb
+++ b/app/controllers/settings/keyword_mutes_controller.rb
@@ -4,4 +4,27 @@ class Settings::KeywordMutesController < ApplicationController
   layout 'admin'
 
   before_action :authenticate_user!
+  before_action :set_account
+
+  def index
+    @keyword_mutes = paginated_keyword_mutes_for_account
+  end
+
+  def new
+    @keyword_mute = keyword_mutes_for_account.build
+  end
+
+  private
+
+  def set_account
+    @account = current_user.account
+  end
+
+  def keyword_mutes_for_account
+    KeywordMute.where(account: @account)
+  end
+
+  def paginated_keyword_mutes_for_account
+    keyword_mutes_for_account.order(:keyword).page params[:page]
+  end
 end