# coding: utf-8 require 'settingslogic' require 'rack/mobile-detect' module H2ocubeRailsHelper module Rails class Rails::Engine < ::Rails::Engine initializer 'Rack::MobileDetect' do |app| app.middleware.use Rack::MobileDetect end end end end def render_html_class cls = [] if params[:controller].include?('/') cls.push params[:controller].gsub('/', '_') params[:controller].split('/').each { |c| cls.push c } else cls.push params[:controller] end cls.push params[:action] cls.push cls[0] + '_' + params[:action] if params.has_key?(:html_class) if params[:html_class].class != Array cls.push params[:html_class].to_s else params[:html_class].each { |c| cls.push c } end end if request.env['X_MOBILE_DEVICE'] cls.push 'mobile', request.env['X_MOBILE_DEVICE'] end cls.compact.uniq.join ' ' end def _title if defined?(@title) title = @title.class.to_s == 'Array' ? @title : [ @title.strip ] else if defined?(@item) if @item.respond_to?(:seo_title) && !@item.seo_title.blank? title = @item.seo_title elsif @item.respond_to?(:title) && !@item.title.blank? title = @item.title elsif @item.respond_to?(:name) && !@item.name.blank? title = @item.name end end title ||= [] end title = [ title ] if title.class.to_s != 'Array' title.push HelperSettings.title title.map{ |t| t.strip } end def render_title "