Commit 312280260d9ff3e6016af2a23a9d488d0dafad4a

Authored by Leandro Santos
1 parent be1c36a4
Exists in staging and in 1 other branch production

update manage blocks feature to not break

app/controllers/admin/features_controller.rb
@@ -20,16 +20,11 @@ class FeaturesController < AdminController @@ -20,16 +20,11 @@ class FeaturesController < AdminController
20 SlideshowBlock, 20 SlideshowBlock,
21 ProfileSearchBlock, 21 ProfileSearchBlock,
22 HighlightsBlock, 22 HighlightsBlock,
23 - FriendsBlock,  
24 FavoriteEnterprisesBlock, 23 FavoriteEnterprisesBlock,
25 CommunitiesBlock, 24 CommunitiesBlock,
26 EnterprisesBlock, 25 EnterprisesBlock,
27 - MembersBlock,  
28 DisabledEnterpriseMessageBlock, 26 DisabledEnterpriseMessageBlock,
29 - ProductCategoriesBlock,  
30 - FeaturedProductsBlock,  
31 - FansBlock,  
32 - ProductsBlock ] 27 + FansBlock ]
33 28
34 @blocks += plugins.dispatch(:extra_blocks) 29 @blocks += plugins.dispatch(:extra_blocks)
35 @blocks.sort_by! { |block| block.name } 30 @blocks.sort_by! { |block| block.name }
app/models/environment.rb
@@ -15,7 +15,7 @@ class Environment < ApplicationRecord @@ -15,7 +15,7 @@ class Environment < ApplicationRecord
15 :members_whitelist, :highlighted_news_amount, 15 :members_whitelist, :highlighted_news_amount,
16 :portal_news_amount, :date_format, :signup_intro, 16 :portal_news_amount, :date_format, :signup_intro,
17 :enable_feed_proxy, :http_feed_proxy, :https_feed_proxy, 17 :enable_feed_proxy, :http_feed_proxy, :https_feed_proxy,
18 - :disable_feed_ssl 18 + :disable_feed_ssl, :disabled_blocks
19 19
20 has_many :users 20 has_many :users
21 21
@@ -338,6 +338,8 @@ class Environment < ApplicationRecord @@ -338,6 +338,8 @@ class Environment < ApplicationRecord
338 338
339 settings_items :enabled_plugins, :type => Array, :default => Noosfero::Plugin.available_plugin_names 339 settings_items :enabled_plugins, :type => Array, :default => Noosfero::Plugin.available_plugin_names
340 340
  341 + settings_items :disabled_blocks, :type => Array, :default => []
  342 +
341 settings_items :search_hints, :type => Hash, :default => {} 343 settings_items :search_hints, :type => Hash, :default => {}
342 344
343 # Set to return http forbidden to host not on the allow origin list bellow 345 # Set to return http forbidden to host not on the allow origin list bellow
@@ -413,6 +415,10 @@ class Environment < ApplicationRecord @@ -413,6 +415,10 @@ class Environment < ApplicationRecord
413 enabled_plugins.include?(plugin.to_s) 415 enabled_plugins.include?(plugin.to_s)
414 end 416 end
415 417
  418 + def block_disabled?(block)
  419 + disabled_blocks.include?(block.to_s)
  420 + end
  421 +
416 # enables the features identified by <tt>features</tt>, which is expected to 422 # enables the features identified by <tt>features</tt>, which is expected to
417 # be an Enumarable object containing the identifiers of the desired features. 423 # be an Enumarable object containing the identifiers of the desired features.
418 # Passing <tt>nil</tt> is the same as passing an empty Array. 424 # Passing <tt>nil</tt> is the same as passing an empty Array.
app/views/features/manage_blocks.html.erb
@@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
62 </script> 62 </script>
63 63
64 <div> 64 <div>
65 - <% button_bar do %> 65 + <%= button_bar do %>
66 <%= submit_button('save', _('Save changes'), :id=>"save_blocks") %> 66 <%= submit_button('save', _('Save changes'), :id=>"save_blocks") %>
67 <%= button :back, _('Back to admin panel'), :controller => 'admin_panel', :action => 'index' %> 67 <%= button :back, _('Back to admin panel'), :controller => 'admin_panel', :action => 'index' %>
68 <% end %> 68 <% end %>