Skip to content

Commit

Permalink
feature: add header partial (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev authored Oct 10, 2020
1 parent e999e53 commit 4548c8a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/helpers/avo/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ def render_logo
def render_footer
render partial: 'vendor/avo/partials/footer' rescue render partial: 'partials/footer'
end

def render_header
render partial: 'vendor/avo/partials/header' rescue render partial: 'partials/header'
end
end
end
11 changes: 8 additions & 3 deletions app/views/layouts/avo/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
</application-sidebar>

<div class="flex-1 h-full overflow-auto">
<div class="fixed bg-white p-2 shadow-md h-16 w-full flex items-center z-40">
<div class="w-64">
<resources-search :global="true">
<div class="relative bg-white p-2 shadow-md h-16 w-full flex items-center z-40">
<div class="ml-6">
<%= render_header %>
</div>
<div class="flex-1 flex justify-center">
<div class="w-64">
<resources-search :global="true">
</div>
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions app/views/partials/_header.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= link_to Avo.configuration.app_name, main_app.root_path, class: 'text-green-600 font-semibold', target: :_blank %>
2 changes: 2 additions & 0 deletions lib/avo/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Avo
class Configuration
attr_accessor :root_path
attr_accessor :app_name
attr_accessor :timezone
attr_accessor :per_page
attr_accessor :per_page_steps
Expand All @@ -13,6 +14,7 @@ class Configuration

def initialize
@root_path = '/avo'
@app_name = Rails.application.class.to_s.split("::").first
@timezone = 'UTC'
@per_page = 24
@per_page_steps = [12, 24, 48, 72]
Expand Down
1 change: 1 addition & 0 deletions lib/generators/avo/templates/views/_header.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= link_to Avo.configuration.app_name, main_app.root_path, class: 'text-green-600 font-semibold', target: :_blank %>
1 change: 1 addition & 0 deletions spec/dummy/config/initializers/avo.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Avo.configure do |config|
config.root_path = '/avo'
config.app_name = 'Avocadelicious'
end

0 comments on commit 4548c8a

Please sign in to comment.