Class: Hyrax::Dashboard::ProfilesController

Inherits:
UsersController
  • Object
show all
Defined in:
app/controllers/hyrax/dashboard/profiles_controller.rb

Overview

Shows and edit the profile of the current_user

Instance Method Summary collapse

Methods inherited from UsersController

#index

Instance Method Details

#editObject

Display form for users to edit their profile information


18
19
20
21
22
23
24
# File 'app/controllers/hyrax/dashboard/profiles_controller.rb', line 18

def edit
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
  add_breadcrumb t(:'hyrax.admin.sidebar.profile'), hyrax.dashboard_profile_path

  @trophies = Hyrax::TrophyPresenter.find_by_user(@user)
end

#showObject


9
10
11
12
13
14
15
# File 'app/controllers/hyrax/dashboard/profiles_controller.rb', line 9

def show
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
  add_breadcrumb t(:'hyrax.admin.sidebar.profile'), hyrax.dashboard_profile_path

  @presenter = Hyrax::UserProfilePresenter.new(@user, current_ability)
end

#updateObject

Process changes from profile form


27
28
29
30
31
32
33
34
# File 'app/controllers/hyrax/dashboard/profiles_controller.rb', line 27

def update
  if conditionally_update
    handle_successful_update
    redirect_to hyrax.dashboard_profile_path(@user.to_param), notice: "Your profile has been updated"
  else
    redirect_to hyrax.edit_dashboard_profile_path(@user.to_param), alert: @user.errors.full_messages
  end
end