Class: StatusMessagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- StatusMessagesController
- Defined in:
- app/controllers/status_messages_controller.rb
Overview
Copyright (c) 2010-2011, Diaspora Inc. This file is licensed under the Affero General Public License version 3 or later. See the COPYRIGHT file.
Instance Method Summary collapse
- #bookmarklet ⇒ Object
- #create ⇒ Object
-
#new ⇒ Object
Called when a user clicks "Mention" on a profile page.
Instance Method Details
#bookmarklet ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/status_messages_controller.rb', line 35 def bookmarklet @aspects = current_user.aspects gon.preloads[:bookmarklet] = { content: params[:content], title: params[:title], url: params[:url], notes: params[:notes] } end |
#create ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/status_messages_controller.rb', line 46 def create = StatusMessageCreationService.new(current_user).create(normalize_params) respond_to do |format| format.mobile { redirect_to stream_path } format.json { render json: PostPresenter.new(, current_user), status: 201 } end rescue StatusMessageCreationService::BadAspectsIDs render status: 422, plain: I18n.t("status_messages.bad_aspects") rescue StandardError => error handle_create_error(error) end |
#new ⇒ Object
Called when a user clicks "Mention" on a profile page
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/status_messages_controller.rb', line 17 def new if params[:person_id] && fetch_person(params[:person_id]) @aspect = :profile @contact = current_user.contact_for(@person) if @contact @aspects_with_person = @contact.aspects.load render layout: nil else @aspects_with_person = [] end elsif request.format == :mobile @aspect = :all @aspects = current_user.aspects.load else redirect_to stream_path end end |