Class: DiscussionsController
- Inherits:
-
AjaxController
- Object
- ActionController::Base
- ApplicationController
- AjaxController
- DiscussionsController
- Includes:
- Mumuki::Laboratory::Controllers::Content
- Defined in:
- app/controllers/discussions_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
- #create ⇒ Object
- #index ⇒ Object
- #show ⇒ Object
- #subscription ⇒ Object
- #update ⇒ Object
- #upvote ⇒ Object
Methods included from Mumuki::Laboratory::Controllers::Content
Methods inherited from ApplicationController
#login_button, #redirect_to_main_organization!, #should_choose_organization?, #should_redirect_to_main_organization?, #validate_accessible!
Methods included from Mumuki::Laboratory::Controllers::EmbeddedMode
#embedded_mode?, #enable_embedded_rendering, #standalone_mode?
Methods included from Mumuki::Laboratory::Controllers::DynamicErrors
#blocked_forum, #forbidden, #gone, #internal_server_error, #not_found, #unauthorized
Methods included from Mumuki::Laboratory::Controllers::Notifications
#has_notifications?, #notifications_count, #user_notifications_path
Methods included from Mumuki::Laboratory::Controllers::Authorization
#authorization_slug, #authorize_if_private!, #from_sessions?
Methods included from Mumuki::Laboratory::Controllers::CurrentOrganization
#organization_name, #set_current_organization!, #visit_organization!
Instance Method Details
#create ⇒ Object
36 37 38 39 |
# File 'app/controllers/discussions_controller.rb', line 36 def create discussion = @debatable.discuss! current_user, discussion_params redirect_to [@debatable, discussion] end |
#index ⇒ Object
13 14 15 16 |
# File 'app/controllers/discussions_controller.rb', line 13 def index @discussions = current_content_discussions.for_user(current_user) @filtered_discussions = @discussions.scoped_query_by(discussion_filter_params) end |
#show ⇒ Object
18 19 |
# File 'app/controllers/discussions_controller.rb', line 18 def show end |
#subscription ⇒ Object
26 27 28 29 |
# File 'app/controllers/discussions_controller.rb', line 26 def subscription current_user&.toggle_subscription!(subject) head :ok end |
#update ⇒ Object
21 22 23 24 |
# File 'app/controllers/discussions_controller.rb', line 21 def update subject.update_status! params[:status], current_user redirect_to [@debatable, subject], notice: I18n.t(:discussion_updated) end |
#upvote ⇒ Object
31 32 33 34 |
# File 'app/controllers/discussions_controller.rb', line 31 def upvote current_user&.toggle_upvote!(subject) head :ok end |