Skip to content

Commit

Permalink
Feat: Nav Bar component knows about the organization (#1962)
Browse files Browse the repository at this point in the history
This allows the upcoming route change PRs to be more independent of each
other
  • Loading branch information
soey authored Aug 9, 2024
1 parent 826f8ea commit 4d2df0c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app/components/nav_bar/nav_bar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

module NavBar
class NavBar < ApplicationComponent
def initialize(current_user:, **)
def initialize(organization:, current_user:, **)
super

@organization = organization
@current_user = current_user
end

private

attr_reader :current_user
attr_reader :current_user, :organization
end
end
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</a>

<div class="sticky">
<%= c 'nav_bar', current_user: current_user %>
<%= c 'nav_bar', organization: @organization, current_user: current_user %>
<%= c 'browser_support_notification' %>
<%= c 'notifications', notifications: flash, style: :floating, close_after: 6000 %>
<%= yield :notifications %>
Expand Down
3 changes: 2 additions & 1 deletion spec/components/nav_bar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
RSpec.describe NavBar::NavBar, type: :component do
subject { render_inline(described_class.new(**params)) }

let(:params) { { current_user: create(:user) } }
let(:organization) { create(:organization) }
let(:params) { { organization: organization, current_user: create(:user) } }
it { should have_css('.NavBar') }
end

0 comments on commit 4d2df0c

Please sign in to comment.