Skip to content

Commit

Permalink
Fix new menu form
Browse files Browse the repository at this point in the history
We need to pass the current site as well.
  • Loading branch information
tvdeyen committed Feb 28, 2020
1 parent 2d7f563 commit eb67fa7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/views/alchemy/admin/nodes/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
<%= render_message do %>
<%= Alchemy.t(:no_resource_found) % { resource: Alchemy.t(:menu) } %>
<% end %>
<%= render 'form', node: Alchemy::Node.new(language: Alchemy::Language.current), button_label: Alchemy.t(:create) %>
<%= render 'form', node: Alchemy::Node.new(
site: Alchemy::Site.current,
language: Alchemy::Language.current
),
button_label: Alchemy.t(:create) %>
</div>
<% end %>
</div>
Expand Down
15 changes: 15 additions & 0 deletions spec/features/admin/menus_features_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@
authorize_user(:as_admin)
end

describe 'adding a new menu' do
context 'on the index page' do
let!(:default_site) { create(:alchemy_site, :default) }

it 'creates menu' do
visit alchemy.admin_nodes_path

fill_in 'Name', with: 'Main Menu'
click_button 'create'

expect(page).to have_selector('.node_name', text: 'Main Menu')
end
end
end

describe 'adding a new menu' do
context 'with multiple sites' do
let!(:default_site) { create(:alchemy_site, :default) }
Expand Down

0 comments on commit eb67fa7

Please sign in to comment.