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

Settings/server: Move flash message one level up fixing duplicate DOM ids. #1182

Merged
merged 2 commits into from
May 3, 2017
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
8 changes: 3 additions & 5 deletions app/controllers/ops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,7 @@ def replace_right_cell(options = {}) # replace_trees can be an array of tree sym
locals = set_form_locals if @in_a_form
build_supported_depots_for_select

presenter = ExplorerPresenter.new(
:active_tree => x_active_tree,
)
# Update the tree with any new nodes
presenter = ExplorerPresenter.new(:active_tree => x_active_tree)
presenter[:add_nodes] = add_nodes if add_nodes

r = proc { |opts| render_to_string(opts) }
Expand All @@ -535,6 +532,8 @@ def replace_right_cell(options = {}) # replace_trees can be an array of tree sym
x_active_tree_replace_cell(nodetype, presenter, r)
extra_js_commands(presenter)

presenter.replace(:flash_msg_div, r[:partial => "layouts/flash_msg"]) if @flash_array

render :json => presenter.for_render
end

Expand Down Expand Up @@ -673,7 +672,6 @@ def rbac_replace_right_cell(nodetype, presenter, r)
if %w(accordion_select change_tab tree_select).include?(params[:action])
presenter.replace(:ops_tabs, r[:partial => "all_tabs"])
elsif nodetype == "group_seq"
presenter.replace(:flash_msg_div, r[:partial => "layouts/flash_msg"])
presenter.update(:rbac_details, r[:partial => "ldap_seq_form"])
elsif nodetype == "tenant_edit" # schedule edit
# when editing/adding schedule in settings tree
Expand Down
1 change: 1 addition & 0 deletions app/views/ops/_all_tabs.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
= miq_tab_content("settings_evm_servers", @sb[:active_tab]) do
= render :partial => "settings_evm_servers_tab"
- elsif selected?(x_node, "svr")
= render :partial => "layouts/flash_msg"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like we may want to level-up this even more eventually.. but yup, matches the removals for now :)

- cur_svr_id = from_cid(x_node.split("-").last).to_i
%ul.nav.nav-tabs
= miq_tab_header("settings_server", @sb[:active_tab]) do
Expand Down
1 change: 0 additions & 1 deletion app/views/ops/_settings_advanced_tab.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- if @sb[:active_tab] == "settings_advanced"
- url = url_for_only_path(:action => 'settings_form_field_changed', :id => @sb[:active_tab].split('_').last)
= render :partial => "layouts/flash_msg"
#form_div
.alert.alert-danger
%span.pficon-layered
Expand Down
1 change: 0 additions & 1 deletion app/views/ops/_settings_authentication_tab.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- if @sb[:active_tab] == "settings_authentication"
- url = url_for_only_path(:action => 'settings_form_field_changed', :id => @sb[:active_tab].split('_').last)
= render :partial => "layouts/flash_msg"
%h3
= _("Authentication")
.form-horizontal
Expand Down
1 change: 0 additions & 1 deletion app/views/ops/_settings_custom_logos_tab.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- if @sb[:active_tab] == "settings_custom_logos"
- url = url_for_only_path(:action => 'settings_form_field_changed', :id => "#{@sb[:active_tab].split('_')[1]}_#{@sb[:active_tab].split('_').last}")
= render :partial => "layouts/flash_msg"
%h3= _("Custom Logo Image (Shown on top right of all screens)")
- if File.exist?(@logo_file)
= image_tag("/upload/custom_logo.png?#{rand(99_999_999)}")
Expand Down
1 change: 0 additions & 1 deletion app/views/ops/_settings_server_tab.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- if @sb[:active_tab] == "settings_server"
- url = url_for_only_path(:action => 'settings_form_field_changed', :id => @sb[:active_tab].split('_').last)
= render :partial => "layouts/flash_msg"
%h3
= _("Basic Information")
.form-horizontal
Expand Down
1 change: 0 additions & 1 deletion app/views/ops/_settings_workers_tab.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
- if @sb[:active_tab] == "settings_workers"
- url = url_for_only_path(:action => 'settings_form_field_changed', :id => @sb[:active_tab].split('_').last)
= render :partial => "layouts/flash_msg"
.row
.col-md-12.col-lg-6
%hr
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/ops_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
allow(controller).to receive(:check_privileges).and_return(true)
allow(controller).to receive(:assert_privileges).and_return(true)
seed_session_trees('ops', :settings_tree, 'root')
expect(controller).to receive(:render_to_string).with(any_args).twice
expect(controller).to receive(:render_to_string).with(any_args).exactly(3).times
post :change_tab, :params => {:tab_id => tab}
end

Expand Down