File tree Expand file tree Collapse file tree
app/views/rails_admin/main
lib/rails_admin/config/actions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5252 </ tbody >
5353 </ table >
5454<% end %>
55- <% if @auditing_adapter && authorized? ( :history_index ) %>
55+ <% if @history && authorized? ( :history_index ) %>
5656 < div class ="block " id ="block-tables ">
5757 < div class ="content ">
5858 < h2 >
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class Dashboard < RailsAdmin::Config::Actions::Base
1818
1919 register_instance_option :controller do
2020 proc do
21- @history = @auditing_adapter &.latest ( @action . auditing_versions_limit ) || [ ] if @action . history?
21+ @history = @auditing_adapter &.latest ( @action . auditing_versions_limit ) if @action . history?
2222 if @action . statistics?
2323 @abstract_models = RailsAdmin ::Config . visible_models ( controller : self ) . collect ( &:abstract_model )
2424
Original file line number Diff line number Diff line change 2424 visit dashboard_path
2525 end
2626
27+ it 'does not show history if turned off' , active_record : true do
28+ RailsAdmin . config do |c |
29+ c . audit_with :paper_trail , 'User' , 'PaperTrail::Version'
30+ c . included_models = [ PaperTrailTest ]
31+ c . actions do
32+ dashboard do
33+ history false
34+ end
35+ index # mandatory
36+ new
37+ history_index
38+ end
39+ end
40+ with_versioning do
41+ visit new_path ( model_name : 'paper_trail_test' )
42+ fill_in 'paper_trail_test[name]' , with : 'Jackie Robinson'
43+ click_button 'Save'
44+ end
45+ visit dashboard_path
46+ is_expected . not_to have_content 'Jackie Robinson'
47+ end
48+
2749 it 'counts are different for same-named models in different modules' do
2850 allow ( RailsAdmin . config ( User ::Confirmed ) . abstract_model ) . to receive ( :count ) . and_return ( 10 )
2951 allow ( RailsAdmin . config ( Comment ::Confirmed ) . abstract_model ) . to receive ( :count ) . and_return ( 0 )
You can’t perform that action at this time.
0 commit comments