Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed
- pagy overflow bug
- styles for admin pages

## [2.0.2] - 2024-12-06
### Added
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BaseController < ApplicationController
def authorize_admin
return if current_user.admin?

access_denied
redirect_to forbidden_path
end
end
end
2 changes: 2 additions & 0 deletions app/controllers/web/errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ class ErrorsController < ApplicationController
skip_before_action :authenticate

def internal; end

def forbidden; end
end
end
4 changes: 1 addition & 3 deletions app/views/components/page_wrappers/admin_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<div class="flex flex-col lg:flex-row flex-1 max-h-screen">
<div class="w-full lg:w-64 bg-zinc-800 flex flex-col justify-between p-4 lg:p-0">
<div class="flex flex-col">
<%= link_to root_path, class: 'user-navigation-link admin lg:my-4 text-xl' do %>
<span>PullKeeper</span>
<% end %>
<%= link_to 'PullKeeper', root_path, class: 'user-navigation-link admin lg:my-4 text-xl' %>
<div class="flex flex-row lg:flex-col flex-wrap lg:flex-nowrap">
<%= link_to 'Companies', admin_companies_path, class: 'user-navigation-link admin' %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/controllers/web/errors/forbidden.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= render PageWrappers::UserComponent.new(current_user: current_user) do %>
<div class="flex flex-1 justify-center items-center">
<div class="h-full flex flex-1 justify-center items-center">
<p class="text-2xl uppercase">Access denied</p>
</div>
<% end %>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
mount PgHero::Engine, at: 'pghero'
mount Emailbutler::Engine => '/emailbutler'
mount Que::View::Engine => '/que_view'

mount Authkeeper::Engine => '/authkeeper'

namespace :admin do
Expand Down Expand Up @@ -107,6 +106,7 @@
end

get '/500', to: 'web/errors#internal'
get 'forbidden', to: 'web/errors#forbidden'

root 'web/welcome#index'
end
2 changes: 1 addition & 1 deletion spec/support/shared/required_admin_auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
it 'render shared error' do
do_request

expect(response).to render_template 'web/errors/forbidden'
expect(response).to redirect_to forbidden_path
end
end
end