-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the explorer listnavs more compact and drop the explorer_tree
- Loading branch information
Showing
5 changed files
with
31 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
#accordion.panel-group | ||
- if @accords.present? && @accords.length == 1 # there is no need for JavaScript if only one accordion is present | ||
.panel.panel-default | ||
.panel-heading | ||
%h4.panel-title | ||
%a{:href => '#'} | ||
= @accords.first[:title] | ||
.panel-collapse.collapse.in | ||
.panel-body{:id => @accords.first[:container]} | ||
= render :partial => 'shared/explorer_tree', :locals => {:name => @accords.first[:name]} | ||
- elsif @accords.present? && @accords.length > 1 | ||
- accord_names = @accords.map { |accord| accord[:name].to_sym } | ||
- @accords.each_with_index do |a, i| | ||
= miq_accordion_panel(a[:title], accord_names.include?(@sb[:active_accord]) ? a[:name].to_sym == @sb[:active_accord] : i == 0, a[:container]) do | ||
= render :partial => 'shared/explorer_tree', :locals => {:name => a[:name]} | ||
- if @accords | ||
#accordion.panel-group | ||
-# Set the first accordion as selected if there is no active_accord in the sandbox | ||
- selected = @accords.find(-> { @accords.first }) { |accord| accord[:name].to_sym == @sb[:active_accord] } | ||
- @accords.each do |accord| | ||
= miq_accordion_panel(accord[:title], selected == accord, accord[:container]) do | ||
-# Set the first tree to be rendered if there is a mismatch with the name/type | ||
- tree = @trees.find(-> { @trees.first }) { |t| t.type == accord[:name].to_sym } | ||
= render :partial => 'shared/tree', :locals => {:tree => tree, :name => tree.name.to_s} | ||
|
||
:javascript | ||
$('#accordion').on('show.bs.collapse', miqAccordSelect); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe 'layouts/_explorer.html.haml' do | ||
let(:tree_1) { TreeBuilderConfigurationManager.new('tree_1', 'tree_1', {}) } | ||
let(:accord) { {:title => 'foo', :name => 'tree_1'} } | ||
|
||
before do | ||
set_controller_for_view('provider_foreman') | ||
assign(:sb, {}) | ||
assign(:trees, [tree_1]) | ||
assign(:accords, [accord]) | ||
end | ||
|
||
it 'renders the explorer listnav' do | ||
render :partial => 'layouts/listnav/explorer' | ||
expect(view).to render_template(:partial => 'layouts/listnav/_explorer') | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.