Skip to content

Commit

Permalink
Merge pull request #3258 from AparnaKarve/bz1534534_fix_tb_buttons
Browse files Browse the repository at this point in the history
Do not display toolbars in the CustomButton/Custom Group form
  • Loading branch information
h-kataria committed Jan 17, 2018
2 parents 43ed1d6 + aea1c7c commit 291519f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/generic_object_definition_controller.rb
Expand Up @@ -210,7 +210,7 @@ def render_form(title, form_partial)
presenter.replace(:main_div, r[:partial => form_partial])
presenter.hide(:paging_div)
presenter[:lock_sidebar] = true
build_toolbar("x_summary_view_tb")
presenter.set_visibility(false, :toolbar)

render :json => presenter.for_render
end
Expand Down
29 changes: 29 additions & 0 deletions spec/controllers/generic_object_definition_controller_spec.rb
Expand Up @@ -96,4 +96,33 @@
expect(toolbar_array[0][2][:url]).to eq('/show_list')
end
end

context "Render form/Toolbar" do
render_views

before do
stub_user(:features => :all)
EvmSpecHelper.create_guid_miq_server_zone
ApplicationController.handle_exceptions = true
allow(controller).to receive(:build_tree)
end

it "does not display toolbar and paging div when custom button is edited" do
custom_button = FactoryGirl.create(:custom_button,
:applies_to_class => "GenericObjectDefinition",
:name => "Default",
:options => {
'button_icon' => 'ff ff-view-expanded',
'button_color' => '#4727ff',
'display' => true,
},)

allow(controller).to receive(:x_node) { "cb-#{custom_button.id}" }
post :tree_select, :params => {'id' => "cb-#{custom_button.id}"}

post :custom_button_edit, :params => {:id => custom_button.id, :format => :js}
expect(response.status).to eq(200)
expect(response.body).to include('"setVisibility":{"paging_div":false,"toolbar":false}')
end
end
end

0 comments on commit 291519f

Please sign in to comment.