Add admin layout with admin navigation
And remove the hacky link list from the dashboard.
This commit is contained in:
@@ -3,4 +3,6 @@ class Admin::BaseController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :authorize_admin
|
||||
|
||||
layout "admin"
|
||||
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Admin::DashboardController < Admin::BaseController
|
||||
def index
|
||||
@current_section = :dashboard
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class Admin::DonationsController < Admin::BaseController
|
||||
before_action :set_donation, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_current_section, only: [:index, :show, :new, :edit]
|
||||
|
||||
# GET /donations
|
||||
# GET /donations.json
|
||||
@@ -71,4 +72,8 @@ class Admin::DonationsController < Admin::BaseController
|
||||
def donation_params
|
||||
params.require(:donation).permit(:user_id, :amount_sats, :amount_eur, :amount_usd, :public_name, :paid_at)
|
||||
end
|
||||
|
||||
def set_current_section
|
||||
@current_section = :donations
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class Admin::LdapUsersController < Admin::BaseController
|
||||
before_action :set_current_section
|
||||
|
||||
def index
|
||||
attributes = %w{dn cn uid mail admin}
|
||||
filter = Net::LDAP::Filter.eq("uid", "*")
|
||||
@@ -38,4 +40,8 @@ class Admin::LdapUsersController < Admin::BaseController
|
||||
def ldap_config
|
||||
ldap_config ||= YAML.load(ERB.new(File.read("#{Rails.root}/config/ldap.yml")).result)[Rails.env]
|
||||
end
|
||||
|
||||
def set_current_section
|
||||
@current_section = :ldap_users
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,6 @@ class DashboardController < ApplicationController
|
||||
before_action :require_user_signed_in
|
||||
|
||||
def index
|
||||
@current_section = "dashboard"
|
||||
@current_section = :dashboard
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,6 +5,6 @@ class DonationsController < ApplicationController
|
||||
# GET /donations.json
|
||||
def index
|
||||
@donations = current_user.donations.completed
|
||||
@current_section = "contributions"
|
||||
@current_section = :contributions
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class InvitationsController < ApplicationController
|
||||
def index
|
||||
@invitations_unused = current_user.invitations.unused
|
||||
@invitations_used = current_user.invitations.used
|
||||
@current_section = "invitations"
|
||||
@current_section = :invitations
|
||||
end
|
||||
|
||||
# GET /invitations/a-random-invitation-token
|
||||
|
||||
Reference in New Issue
Block a user