-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added profile; use random on desk selection for quick reservations
- Loading branch information
Nils Bartels
committed
Dec 19, 2023
1 parent
3cb9b2e
commit 22bcdf4
Showing
7 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
class ProfilesController < ApplicationController | ||
before_action :set_profile | ||
|
||
# GET /profile | ||
def profile | ||
end | ||
|
||
# PATCH/PUT /profile | ||
def update | ||
if @profile.update(profile_params) | ||
redirect_to profile_path, notice: "Your profile was successfully updated." | ||
else | ||
render :edit | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_profile | ||
@profile = current_user | ||
end | ||
|
||
# Only allow a trusted parameter "white list" through. | ||
def profile_params | ||
params.require(:user).permit(:page, :first_name, :middle_name, :last_name, :tenant_id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
= simple_form_for(@profile, as: :user, method: :patch, url: profile_path) do |f| | ||
.row | ||
.col-md-12 | ||
|
||
= f.input :email, disabled: true, hint: 'You cannot change your email.' | ||
= f.input :first_name | ||
= f.input :middle_name | ||
= f.input :last_name | ||
= f.input :tenant_id, collection: Tenant.all, label_method: :name, value_method: :id | ||
|
||
= f.input :current_position, collection: [:trainee, :apprentice, :employee, :lead, :management], disabled: true, hint: 'You cannot change your position. Please ask an admin if this is wrong.' | ||
= f.input :quota_max_reservations, disabled: true, hint: 'You can create as many reservations as this.' | ||
|
||
= f.button :submit, class: 'btn btn-success' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
%h2 | ||
Profile | ||
|
||
= render 'form', profile: @profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters