diff --git a/plugins/responsive/lib/ext/application_helper.rb b/plugins/responsive/lib/ext/application_helper.rb index 3e98375..e36ff67 100644 --- a/plugins/responsive/lib/ext/application_helper.rb +++ b/plugins/responsive/lib/ext/application_helper.rb @@ -1,9 +1,7 @@ require_dependency 'application_helper' -require_relative 'input_helper' module ApplicationHelper - extend ActiveSupport::Concern protected module ResponsiveMethods @@ -408,8 +406,11 @@ module ApplicationHelper end include ResponsiveChecks - included do - include ResponsiveMethods + if RUBY_VERSION >= '2.0.0' + prepend ResponsiveMethods + else + extend ActiveSupport::Concern + included { include ResponsiveMethods } end # TODO: apply theme_responsive? condition diff --git a/plugins/responsive/lib/ext/boxes_helper.rb b/plugins/responsive/lib/ext/boxes_helper.rb index 71dbbe2..59581ef 100644 --- a/plugins/responsive/lib/ext/boxes_helper.rb +++ b/plugins/responsive/lib/ext/boxes_helper.rb @@ -1,9 +1,7 @@ require_dependency 'boxes_helper' -require_relative 'application_helper' module BoxesHelper - extend ActiveSupport::Concern protected module ResponsiveMethods @@ -45,35 +43,31 @@ module BoxesHelper return main_content unless boxes.present? render partial: "templates/boxes_#{template}", locals: {boxes: boxes, main_content: main_content}, use_cache: use_cache? end - end - def display_topbox_content(box, main_content) - context = {article: @page, request_path: request.path, locale: locale, params: request.params, controller: controller} - box_decorator.select_blocks(box, box.blocks.includes(:box), context).map do |item| - if item.class.name == 'LinkListBlock' and request.params[:controller] != 'profile_design' - render_linklist_navbar(item) - else - display_block item, main_content - end - end.join("\n") + box_decorator.block_target(box) - end + def display_topbox_content(box, main_content) + context = {article: @page, request_path: request.path, locale: locale, params: request.params, controller: controller} + box_decorator.select_blocks(box, box.blocks.includes(:box), context).map do |item| + if item.class.name == 'LinkListBlock' and request.params[:controller] != 'profile_design' + render_linklist_navbar(item) + else + display_block item, main_content + end + end.join("\n") + box_decorator.block_target(box) + end - def render_linklist_navbar link_list - list = link_list.links.select{ |i| i[:name].present? and i[:address].present? } - render file: 'blocks/link_list_navbar', locals: {block: link_list, links: list} + def render_linklist_navbar link_list + list = link_list.links.select{ |i| i[:name].present? and i[:address].present? } + render file: 'blocks/link_list_navbar', locals: {block: link_list, links: list} + end end include ResponsiveChecks - extend ActiveSupport::Concern - included do - include ResponsiveMethods + if RUBY_VERSION >= '2.0.0' + prepend ResponsiveMethods + else + extend ActiveSupport::Concern + included { include ResponsiveMethods } end end -module ApplicationHelper - - include BoxesHelper::ResponsiveMethods - -end - diff --git a/plugins/responsive/lib/ext/chat_helper.rb b/plugins/responsive/lib/ext/chat_helper.rb index 87f49ec..2d9aef3 100644 --- a/plugins/responsive/lib/ext/chat_helper.rb +++ b/plugins/responsive/lib/ext/chat_helper.rb @@ -1,9 +1,7 @@ require_dependency 'chat_helper' -require_relative 'application_helper' module ChatHelper - extend ActiveSupport::Concern protected module ResponsiveMethods @@ -25,17 +23,12 @@ module ChatHelper end include ResponsiveChecks - included do - include ResponsiveMethods + if RUBY_VERSION >= '2.0.0' + prepend ResponsiveMethods + else + extend ActiveSupport::Concern + included { include ResponsiveMethods } end - protected - -end - -module ApplicationHelper - - include ChatHelper::ResponsiveMethods - end diff --git a/plugins/responsive/lib/ext/forms_helper.rb b/plugins/responsive/lib/ext/forms_helper.rb index 582c5e8..9e6d4f5 100644 --- a/plugins/responsive/lib/ext/forms_helper.rb +++ b/plugins/responsive/lib/ext/forms_helper.rb @@ -1,9 +1,7 @@ require_dependency 'forms_helper' -require_relative 'application_helper' module FormsHelper - extend ActiveSupport::Concern protected module ResponsiveMethods @@ -75,15 +73,12 @@ module FormsHelper end include ResponsiveChecks - included do - include ResponsiveMethods + if RUBY_VERSION >= '2.0.0' + prepend ResponsiveMethods + else + extend ActiveSupport::Concern + included { include ResponsiveMethods } end end -module ApplicationHelper - - include FormsHelper::ResponsiveMethods - -end - -- libgit2 0.21.2