diff --git a/app/controllers/application.rb b/app/controllers/application.rb index da947e7..cd6ba4d 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -25,11 +25,6 @@ class ApplicationController < ActionController::Base helper :document helper :language - def boxes_editor? - false - end - protected :boxes_editor? - def self.no_design_blocks @no_design_blocks = true end @@ -106,6 +101,14 @@ class ApplicationController < ActionController::Base protected + def boxes_editor? + false + end + + def content_editor? + false + end + def user current_user.person if logged_in? end diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index 00a2c1d..5ea3f86 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -383,5 +383,9 @@ class CmsController < MyProfileController @selected_locale = @article.language || FastGettext.locale end + def content_editor? + true + end + end diff --git a/app/controllers/my_profile/manage_products_controller.rb b/app/controllers/my_profile/manage_products_controller.rb index cc2d988..099fbaf 100644 --- a/app/controllers/my_profile/manage_products_controller.rb +++ b/app/controllers/my_profile/manage_products_controller.rb @@ -50,7 +50,7 @@ class ManageProductsController < ApplicationController render :partial => 'shared/redirect_via_javascript', :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) } else - render :partial => 'shared/dialog_error_messages', :locals => { :object_name => 'product' } + render_dialog_error_messages 'product' end end end @@ -81,7 +81,7 @@ class ManageProductsController < ApplicationController render :partial => 'shared/redirect_via_javascript', :locals => { :url => url_for(:controller => 'manage_products', :action => 'show', :id => @product) } else - render :partial => 'shared/dialog_error_messages', :locals => { :object_name => 'product' } + render_dialog_error_messages 'product' end end end @@ -96,7 +96,7 @@ class ManageProductsController < ApplicationController @inputs = @product.inputs render :partial => 'display_inputs' else - render :partial => 'shared/dialog_error_messages', :locals => { :object_name => 'product' } + render_dialog_error_messages 'product' end else render :partial => 'add_input' @@ -147,7 +147,7 @@ class ManageProductsController < ApplicationController @inputs = @product.inputs render :partial => 'display_inputs' else - render :partial => 'shared/dialog_error_messages', :locals => { :object_name => 'input' } + render_dialog_error_messages 'input' end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7fa9664..ad78387 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -980,7 +980,10 @@ module ApplicationHelper def article_to_html(article, options = {}) options.merge!(:page => params[:npage]) content = article.to_html(options) - return self.instance_eval(&content) if content.kind_of?(Proc) + content = content.kind_of?(Proc) ? self.instance_eval(&content) : content + @plugins && @plugins.enabled_plugins.each do |plugin| + content = plugin.parse_content(content) + end content end @@ -1221,4 +1224,8 @@ module ApplicationHelper end end + def render_dialog_error_messages(instance_name) + render :partial => 'shared/dialog_error_messages', :locals => { :object_name => instance_name } + end + end diff --git a/app/helpers/boxes_helper.rb b/app/helpers/boxes_helper.rb index b165249..c8e9457 100644 --- a/app/helpers/boxes_helper.rb +++ b/app/helpers/boxes_helper.rb @@ -99,7 +99,9 @@ module BoxesHelper unless block.visible? options[:title] = _("This block is invisible. Your visitors will not see it.") end - + @controller.send(:content_editor?) || @plugins.enabled_plugins.each do |plugin| + result = plugin.parse_content(result) + end box_decorator.block_target(block.box, block) + content_tag('div', content_tag('div', diff --git a/app/views/manage_products/_edit_image.rhtml b/app/views/manage_products/_edit_image.rhtml index 3924386..d8c3338 100644 --- a/app/views/manage_products/_edit_image.rhtml +++ b/app/views/manage_products/_edit_image.rhtml @@ -22,5 +22,5 @@ <% if errors %> - <%= render :partial => 'shared/dialog_error_messages', :locals => { :object_name => 'product' } %> + <%= render_dialog_error_messages 'product' %> <% end %> diff --git a/app/views/manage_products/_edit_info.rhtml b/app/views/manage_products/_edit_info.rhtml index ef4e5d7..e4cff79 100644 --- a/app/views/manage_products/_edit_info.rhtml +++ b/app/views/manage_products/_edit_info.rhtml @@ -1,5 +1,5 @@ <% if errors %> - <%= render :partial => 'shared/dialog_error_messages', :locals => { :object_name => 'product' } %> + <%= render_dialog_error_messages 'product' %> <% end %> <% remote_form_for(@product, diff --git a/app/views/manage_products/_edit_name.rhtml b/app/views/manage_products/_edit_name.rhtml index 7b9f416..f73170f 100644 --- a/app/views/manage_products/_edit_name.rhtml +++ b/app/views/manage_products/_edit_name.rhtml @@ -17,5 +17,5 @@ <% if errors %> - <%= render :partial => 'shared/dialog_error_messages', :locals => { :object_name => 'product' } %> + <%= render_dialog_error_messages 'product' %> <% end %> diff --git a/app/views/plugins/index.rhtml b/app/views/plugins/index.rhtml index 13a76c2..4f26306 100644 --- a/app/views/plugins/index.rhtml +++ b/app/views/plugins/index.rhtml @@ -12,7 +12,7 @@ <%= hidden_field_tag('environment[enabled_plugins][]', '') %> <% @active_plugins.each do |plugin| %>