Commit 312280260d9ff3e6016af2a23a9d488d0dafad4a
1 parent
be1c36a4
Exists in
staging
and in
1 other branch
update manage blocks feature to not break
Showing
3 changed files
with
9 additions
and
8 deletions
Show diff stats
app/controllers/admin/features_controller.rb
| ... | ... | @@ -20,16 +20,11 @@ class FeaturesController < AdminController |
| 20 | 20 | SlideshowBlock, |
| 21 | 21 | ProfileSearchBlock, |
| 22 | 22 | HighlightsBlock, |
| 23 | - FriendsBlock, | |
| 24 | 23 | FavoriteEnterprisesBlock, |
| 25 | 24 | CommunitiesBlock, |
| 26 | 25 | EnterprisesBlock, |
| 27 | - MembersBlock, | |
| 28 | 26 | DisabledEnterpriseMessageBlock, |
| 29 | - ProductCategoriesBlock, | |
| 30 | - FeaturedProductsBlock, | |
| 31 | - FansBlock, | |
| 32 | - ProductsBlock ] | |
| 27 | + FansBlock ] | |
| 33 | 28 | |
| 34 | 29 | @blocks += plugins.dispatch(:extra_blocks) |
| 35 | 30 | @blocks.sort_by! { |block| block.name } | ... | ... |
app/models/environment.rb
| ... | ... | @@ -15,7 +15,7 @@ class Environment < ApplicationRecord |
| 15 | 15 | :members_whitelist, :highlighted_news_amount, |
| 16 | 16 | :portal_news_amount, :date_format, :signup_intro, |
| 17 | 17 | :enable_feed_proxy, :http_feed_proxy, :https_feed_proxy, |
| 18 | - :disable_feed_ssl | |
| 18 | + :disable_feed_ssl, :disabled_blocks | |
| 19 | 19 | |
| 20 | 20 | has_many :users |
| 21 | 21 | |
| ... | ... | @@ -338,6 +338,8 @@ class Environment < ApplicationRecord |
| 338 | 338 | |
| 339 | 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 | 343 | settings_items :search_hints, :type => Hash, :default => {} |
| 342 | 344 | |
| 343 | 345 | # Set to return http forbidden to host not on the allow origin list bellow |
| ... | ... | @@ -413,6 +415,10 @@ class Environment < ApplicationRecord |
| 413 | 415 | enabled_plugins.include?(plugin.to_s) |
| 414 | 416 | end |
| 415 | 417 | |
| 418 | + def block_disabled?(block) | |
| 419 | + disabled_blocks.include?(block.to_s) | |
| 420 | + end | |
| 421 | + | |
| 416 | 422 | # enables the features identified by <tt>features</tt>, which is expected to |
| 417 | 423 | # be an Enumarable object containing the identifiers of the desired features. |
| 418 | 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 | 62 | </script> |
| 63 | 63 | |
| 64 | 64 | <div> |
| 65 | - <% button_bar do %> | |
| 65 | + <%= button_bar do %> | |
| 66 | 66 | <%= submit_button('save', _('Save changes'), :id=>"save_blocks") %> |
| 67 | 67 | <%= button :back, _('Back to admin panel'), :controller => 'admin_panel', :action => 'index' %> |
| 68 | 68 | <% end %> | ... | ... |