# coding: utf-8 require 'settingslogic' require 'rack/mobile-detect' require 'draper' 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 opts = {} return [@_title] if defined?(@_title) if defined?(@title) title = @title.class.to_s == 'Array' ? @title : [ @title.strip ] else if defined?(@item) if @item.respond_to?(:title) && !@item.title.blank? title = @item.title end end title ||= [] end title = [ title ] if title.class.to_s != 'Array' if opts.has_key? :title title.push opts[:title] else title.push HelperSettings.title end title.compact.map{ |t| t = t.strip; t == '' ? nil : t }.compact end def render_title opts = {} "