Skip to content

Commit

Permalink
Only show staff in the left column
Browse files Browse the repository at this point in the history
  • Loading branch information
PencilAmazing committed Jan 9, 2025
1 parent aa5b80b commit 0ba0ccc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions app/controllers/admin/shifts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ def index
StaffSpace
.joins(:user)
.where(space_id: @space_id)
.merge(
User.staff
) # NOTE why isn't this the default scope? Ask Alex *again* sometime later lol
.order("users.name")
.each do |staff|
if !staff.nil? && !staff.user.nil?
@colors << {
id: staff.user.id,
name: staff.user.name,
color: staff.color
}
@colors << { user: staff.user, color: staff.color }
end
end
end
Expand All @@ -46,6 +45,7 @@ def shifts
StaffSpace
.joins(:user)
.where(space_id: @space_id)
.merge(User.staff)
.order("users.name")
.each do |staff|
if !staff.nil? && !staff.user.nil? && !staff.user_id.nil?
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/shifts/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<% @colors.each do |user| %>
<div class="pb-2">
<label><%= user[:name] %></label>
<label><%= link_to user[:user].name, user_path(user[:user].username), target: :_blank, rel: :noopener %></label>
<br>
<div class="d-flex">
<input type="color" name="color" onchange="updateColor(<%= user[:id] %>, this.value)" class="form-control form-control-color-shift" value="<%= user[:color] %>" title="Choose your color">
Expand Down

0 comments on commit 0ba0ccc

Please sign in to comment.