Skip to content

Commit 4548c8a

Browse files
authored
feature: add header partial (#144)
1 parent e999e53 commit 4548c8a

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

app/helpers/avo/application_helper.rb

+4
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,9 @@ def render_logo
1313
def render_footer
1414
render partial: 'vendor/avo/partials/footer' rescue render partial: 'partials/footer'
1515
end
16+
17+
def render_header
18+
render partial: 'vendor/avo/partials/header' rescue render partial: 'partials/header'
19+
end
1620
end
1721
end

app/views/layouts/avo/application.html.erb

+8-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818
</application-sidebar>
1919

2020
<div class="flex-1 h-full overflow-auto">
21-
<div class="fixed bg-white p-2 shadow-md h-16 w-full flex items-center z-40">
22-
<div class="w-64">
23-
<resources-search :global="true">
21+
<div class="relative bg-white p-2 shadow-md h-16 w-full flex items-center z-40">
22+
<div class="ml-6">
23+
<%= render_header %>
24+
</div>
25+
<div class="flex-1 flex justify-center">
26+
<div class="w-64">
27+
<resources-search :global="true">
28+
</div>
2429
</div>
2530
</div>
2631

app/views/partials/_header.html.erb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= link_to Avo.configuration.app_name, main_app.root_path, class: 'text-green-600 font-semibold', target: :_blank %>

lib/avo/configuration.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Avo
22
class Configuration
33
attr_accessor :root_path
4+
attr_accessor :app_name
45
attr_accessor :timezone
56
attr_accessor :per_page
67
attr_accessor :per_page_steps
@@ -13,6 +14,7 @@ class Configuration
1314

1415
def initialize
1516
@root_path = '/avo'
17+
@app_name = Rails.application.class.to_s.split("::").first
1618
@timezone = 'UTC'
1719
@per_page = 24
1820
@per_page_steps = [12, 24, 48, 72]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= link_to Avo.configuration.app_name, main_app.root_path, class: 'text-green-600 font-semibold', target: :_blank %>

spec/dummy/config/initializers/avo.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Avo.configure do |config|
22
config.root_path = '/avo'
3+
config.app_name = 'Avocadelicious'
34
end

0 commit comments

Comments
 (0)