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



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

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
# 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
end

#updateObject

Process changes from profile form



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

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