Skip to content

Commit

Permalink
Allow moderators to edit other users' profiles
Browse files Browse the repository at this point in the history
Progress towards #61
  • Loading branch information
BGMP committed Mar 9, 2024
1 parent 2787327 commit 1a79ffb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/controllers/users_controller.rb
Expand Up @@ -3,7 +3,8 @@ class UsersController < ApplicationController
include RankingsHelper

before_action :authenticate_user!, :except => [:show, :stats]
before_action :authenticate_admin, :except => [:show, :stats, :update_locale]
before_action :authenticate_admin, :except => [:show, :stats, :update_locale, :edit]
before_action :authenticate_mod, :only => [:edit]

def members
@users = User.all
Expand Down
4 changes: 2 additions & 2 deletions app/views/users/show.haml
Expand Up @@ -70,7 +70,7 @@
%a#general-tab.nav-link.active{"aria-controls" => "general", "aria-selected" => "true", "data-toggle" => "tab", href: "#general", role: "tab"}= t("users.tabs.title")
%li.nav-item
%a#stats-tab.nav-link{"aria-controls" => "stats", "aria-selected" => "false", "data-toggle" => "tab", href: "#stats", role: "tab"}= t("users.tabs.stats")
- if user_is_admin?
- if user_is_mod?
%li.nav-item
%a#admin-tab.nav-link{"aria-controls" => "admin", "aria-selected" => "false", "data-toggle" => "tab", href: "#admin", role: "tab"}= t("users.tabs.admin")
.tab-content
Expand Down Expand Up @@ -230,7 +230,7 @@
= number_to_percentage(@user.stats.participation_rate * 100, :precision => 1)
%small
= t("users.stats.overall-stats.participation")
- if user_is_admin?
- if user_is_mod?
#admin.tab-pane.fade{:"aria-labelledby" => "admin-tab", :role => "tabpanel"}
= form_for(@user, html: { method: :put }) do |f|
= f.fields_for :profile do |profile|
Expand Down

0 comments on commit 1a79ffb

Please sign in to comment.