Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Nav Bar component knows about the organization #1962

Merged
merged 1 commit into from
Aug 9, 2024
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
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
Loading