<commit_before>require_dependency 'application_helper'

module ApplicationHelper

  extend ActiveSupport::Concern
  protected

  module ResponsiveMethods
    FORM_CONTROL_CLASS = "form-control"

    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', '&nbsp;'+content_tag('span', label), html_options.merge(class: the_class, title: the_title))
      else
        link_to('&nbsp;'+content_tag('span', label), 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?

      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(content_tag('span', label), 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?

      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(content_tag('span', label), options, html_options.merge(title: label))
    end<commit_msg>Make button without text be without text<commit_after>require_dependency 'application_helper'

module ApplicationHelper

  extend ActiveSupport::Concern
  protected

  module ResponsiveMethods
    FORM_CONTROL_CLASS = "form-control"

    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(content_tag('span', label), options, html_options.merge(title: label))
    end
{'fraction_non_alphanumeric': 0.13886334375574766, 'fraction_numerical': 0.0, 'mean_word_length': 3.8727598566308243, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5004945', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1676, 'n_words': 353}