aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorTeddy Wing2012-05-30 19:36:43 -0400
committerTeddy Wing2012-05-30 19:36:43 -0400
commitfb801ab393a47cdc1bae3af063845f52dbdd258a (patch)
tree74352c0f6d83f5f4c2912f35ed2516741e6bd8f0 /app
parent3d71d19460c2dc28c27c4623957feb842baf6ce2 (diff)
downloadinboxes-fb801ab393a47cdc1bae3af063845f52dbdd258a.tar.bz2
Settings: added a settings module so that users can turn email notifications for new messages on or off.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/inboxes/discussions_controller.rb4
-rw-r--r--app/controllers/inboxes/inboxes_settings_controller.rb8
-rw-r--r--app/models/inboxes_setting.rb5
3 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/inboxes/discussions_controller.rb b/app/controllers/inboxes/discussions_controller.rb
index d23f5a5..13dae3d 100644
--- a/app/controllers/inboxes/discussions_controller.rb
+++ b/app/controllers/inboxes/discussions_controller.rb
@@ -39,6 +39,10 @@ class Inboxes::DiscussionsController < Inboxes::BaseController
render :action => "new"
end
end
+
+ def settings
+ @settings = InboxesSetting.find_or_create_by_user_id(current_user)
+ end
private
diff --git a/app/controllers/inboxes/inboxes_settings_controller.rb b/app/controllers/inboxes/inboxes_settings_controller.rb
new file mode 100644
index 0000000..6851791
--- /dev/null
+++ b/app/controllers/inboxes/inboxes_settings_controller.rb
@@ -0,0 +1,8 @@
+class Inboxes::InboxesSettingsController < Inboxes::BaseController
+ def update
+ @settings = InboxesSetting.find_or_create_by_user_id(current_user)
+ @settings.update_attributes(:send_email_notification => params[:inboxes_setting][:send_email_notification])
+
+ redirect_to '/discussions/settings'
+ end
+end
diff --git a/app/models/inboxes_setting.rb b/app/models/inboxes_setting.rb
new file mode 100644
index 0000000..1581131
--- /dev/null
+++ b/app/models/inboxes_setting.rb
@@ -0,0 +1,5 @@
+class InboxesSetting < ActiveRecord::Base
+
+ attr_accessible :send_email_notification
+
+end