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



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

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



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

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



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

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