require_dependency 'application_helper' module ApplicationHelper protected module ResponsiveMethods FORM_CONTROL_CLASS = "form-control" def button(type, label, url, html_options = {}) return super unless theme_responsive? option = html_options.delete(:option) || 'default' size = html_options.delete(:size) || 'xs' the_class = "with-text btn btn-#{size} btn-#{option} icon-#{type}" if html_options.has_key?(:class) the_class << ' ' << html_options[:class] end #button_without_text type, label, url, html_options.merge(:class => the_class) the_title = html_options[:title] || label if html_options[:disabled] content_tag('a', content_tag('span', label), html_options.merge(class: the_class, title: the_title)) else link_to(content_tag('span', label), url, html_options.merge(class: the_class, title: the_title)) end end def button_without_text(type, label, url, html_options = {}) return super unless theme_responsive? option = html_options.delete(:option) || 'default' size = html_options.delete(:size) || 'xs' the_class = "btn btn-#{size} btn-#{option} icon-#{type}" if html_options.has_key?(:class) the_class << ' ' << html_options[:class] end the_title = html_options[:title] || label if html_options[:disabled] content_tag('a', '', html_options.merge(class: the_class, title: the_title)) else link_to('', url, html_options.merge(class: the_class, title: the_title)) end end def button_to_function(type, label, js_code, html_options = {}, &block) return super unless theme_responsive? option = html_options.delete(:option) || 'default' size = html_options.delete(:size) || 'xs' html_options[:class] = "btn btn-#{size} btn-#{option} with-text #{html_options[:class]}" html_options[:class] << " icon-#{type}" link_to_function(label, js_code, html_options, &block) end def button_to_function_without_text(type, label, js_code, html_options = {}, &block) return super unless theme_responsive? html_options[:title] ||= label option = html_options.delete(:option) || 'default' size = html_options.delete(:size) || 'xs' html_options[:class] = "" unless html_options[:class] html_options[:class] << " btn btn-#{size} btn-#{option} icon-#{type}" link_to_function('', js_code, html_options, &block) end def button_to_remote(type, label, options, html_options = {}) return super unless theme_responsive? option = html_options.delete(:option) || 'default' size = html_options.delete(:size) || 'xs' html_options[:class] = "btn btn-#{size} btn-#{option} with-text" unless html_options[:class] html_options[:class] << " icon-#{type}" link_to_remote(label, options, html_options) end def button_to_remote_without_text(type, label, options, html_options = {}) return super unless theme_responsive? html_options[:title] ||= label option = html_options.delete(:option) || 'default' size = html_options.delete(:size) || 'xs' html_options[:class] = "" unless html_options[:class] html_options[:class] << " btn btn-#{size} btn-#{option} icon-#{type}" link_to_remote('', options, html_options.merge(title: label)) end def icon(icon_name, html_options = {}) return super unless theme_responsive? option = html_options.delete(:option) || 'default' size = html_options.delete(:size) || 'xs' the_class = "btn btn-#{size} btn-#{option} #{icon_name}" if html_options.has_key?(:class) the_class << ' ' << html_options[:class] end content_tag('div', '', html_options.merge(class: the_class)) end def icon_button(type, text, url, html_options = {}) return super unless theme_responsive? option = html_options.delete(:option) || 'default' size = html_options.delete(:size) || 'xs' the_class = "btn btn-#{size} btn-#{option} icon-button icon-#{type}" if html_options.has_key?(:class) the_class << ' ' << html_options[:class] end link_to(content_tag('span', text), url, html_options.merge(class: the_class, title: text)) end def button_bar(options = {}, &block) return super unless theme_responsive? options[:class].nil? ? options[:class]='button-bar' : options[:class]+=' button-bar' concat(content_tag('div', capture(&block).to_s + tag('br', style: 'clear: left;'), options)) end def expirable_button(content, action, text, url, html_options = {}) return super unless theme_responsive? option = html_options.delete(:option) || 'default' size = html_options.delete(:size) || 'xs' html_options[:class] = ["btn btn-#{size} btn-#{option} with-text icon-#{action.to_s}", html_options[:class]].compact.join(' ') expirable_content_reference content, action, text, url, html_options end def search_contents_menu return super unless theme_responsive? host = environment.default_hostname output = '' output end def search_people_menu return super unless theme_responsive? host = environment.default_hostname output = '' output end def search_communities_menu return super unless theme_responsive? host = environment.default_hostname output = '' output end def usermenu_logged_in return super unless theme_responsive? output = '