Skip to content

Commit

Permalink
Tenants: hide toolbar when clicking on Services, Automate Domains, Pr…
Browse files Browse the repository at this point in the history
…oviders.
  • Loading branch information
martinpovolny authored and Hilda Stastna committed Sep 18, 2019
1 parent 3a19f35 commit 32ef759
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
28 changes: 16 additions & 12 deletions app/assets/javascripts/miq_explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ ManageIQ.explorer.processButtons = function(data) {
ManageIQ.explorer.processReplaceMainDiv = function(data) {
ManageIQ.explorer.updateRightCellText(data);
ManageIQ.explorer.updatePartials(data);
ManageIQ.explorer.setVisibility(data);
};

ManageIQ.explorer.processFlash = function(data) {
Expand Down Expand Up @@ -163,6 +164,20 @@ ManageIQ.explorer.updateRightCellText = function(data) {
}
};

ManageIQ.explorer.setVisibility = function(data) {
if (_.isObject(data.setVisibility)) {
_.forEach(data.setVisibility, function(visible, element) {
if ( miqDomElementExists(element) ) {
if ( visible ) {
$('#' + element).show();
} else {
$('#' + element).hide();
}
}
});
}
};

ManageIQ.explorer.processReplaceRightCell = function(data) {
/* variables for the expression editor */
if (_.isObject(data.expEditor)) {
Expand Down Expand Up @@ -247,18 +262,7 @@ ManageIQ.explorer.processReplaceRightCell = function(data) {
ManageIQ.grids.gtl_list_grid = undefined;
}

if (_.isObject(data.setVisibility)) {
_.forEach(data.setVisibility, function(visible, element) {
if ( miqDomElementExists(element) ) {
if ( visible ) {
$('#' + element).show();
} else {
$('#' + element).hide();
}
}
});
}

ManageIQ.explorer.setVisibility(data);
ManageIQ.explorer.scrollTop(data);
ManageIQ.explorer.updateRightCellText(data);

Expand Down
4 changes: 3 additions & 1 deletion app/controllers/ops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,9 @@ def nested_list(model, options = {})
:name => @record.name,
:title => options[:breadcrumb_title]
}
ex = ExplorerPresenter.main_div(:right_cell_text => title).update('ops_tabs', render_to_string(:partial => "layouts/gtl"))
ex = ExplorerPresenter.main_div(:right_cell_text => title)
.update('ops_tabs', render_to_string(:partial => "layouts/gtl"))
.set_visibility(false, :toolbar)

# Also update breadcrumbs.
add_to_breadcrumbs(:title => options[:breadcrumb_title])
Expand Down
1 change: 1 addition & 0 deletions app/presenters/explorer_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def for_render_main_div
data = check_spinner(:explorer => 'replace_main_div')
data[:rightCellText] = escape_if_unsafe(@options[:right_cell_text]) if @options[:right_cell_text]
data[:updatePartials] = @options[:update_partials]
data[:setVisibility] = @options[:set_visible_elements]
data
end

Expand Down

0 comments on commit 32ef759

Please sign in to comment.