Skip to content

Commit 73e70de

Browse files
authored
Merge pull request #365 from kortirso/issue_359
IS-359 styles for admin pages
2 parents 3efcbc1 + 0b8428e commit 73e70de

7 files changed

Lines changed: 8 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
### Fixed
1313
- pagy overflow bug
14+
- styles for admin pages
1415

1516
## [2.0.2] - 2024-12-06
1617
### Added

app/controllers/admin/base_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class BaseController < ApplicationController
1212
def authorize_admin
1313
return if current_user.admin?
1414

15-
access_denied
15+
redirect_to forbidden_path
1616
end
1717
end
1818
end

app/controllers/web/errors_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ class ErrorsController < ApplicationController
55
skip_before_action :authenticate
66

77
def internal; end
8+
9+
def forbidden; end
810
end
911
end

app/views/components/page_wrappers/admin_component.html.erb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<div class="flex flex-col lg:flex-row flex-1 max-h-screen">
22
<div class="w-full lg:w-64 bg-zinc-800 flex flex-col justify-between p-4 lg:p-0">
33
<div class="flex flex-col">
4-
<%= link_to root_path, class: 'user-navigation-link admin lg:my-4 text-xl' do %>
5-
<span>PullKeeper</span>
6-
<% end %>
4+
<%= link_to 'PullKeeper', root_path, class: 'user-navigation-link admin lg:my-4 text-xl' %>
75
<div class="flex flex-row lg:flex-col flex-wrap lg:flex-nowrap">
86
<%= link_to 'Companies', admin_companies_path, class: 'user-navigation-link admin' %>
97
</div>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<%= render PageWrappers::UserComponent.new(current_user: current_user) do %>
2-
<div class="flex flex-1 justify-center items-center">
2+
<div class="h-full flex flex-1 justify-center items-center">
33
<p class="text-2xl uppercase">Access denied</p>
44
</div>
55
<% end %>

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
mount PgHero::Engine, at: 'pghero'
99
mount Emailbutler::Engine => '/emailbutler'
1010
mount Que::View::Engine => '/que_view'
11-
1211
mount Authkeeper::Engine => '/authkeeper'
1312

1413
namespace :admin do
@@ -107,6 +106,7 @@
107106
end
108107

109108
get '/500', to: 'web/errors#internal'
109+
get 'forbidden', to: 'web/errors#forbidden'
110110

111111
root 'web/welcome#index'
112112
end

spec/support/shared/required_admin_auth.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
it 'render shared error' do
88
do_request
99

10-
expect(response).to render_template 'web/errors/forbidden'
10+
expect(response).to redirect_to forbidden_path
1111
end
1212
end
1313
end

0 commit comments

Comments
 (0)