Sha256: 1e2704620949d536928d21cfacf7d0ada2c1a493a128e9623339e32d7798b419

Contents?: true

Size: 1 KB

Versions: 14

Compression:

Stored size: 1 KB

Contents

class BsFileDownloadInput < Formtastic::Inputs::StringInput
  include FormtasticBootstrap::Inputs::Base
  include FormtasticBootstrap::Inputs::Base::Collections
  include ActionView::Helpers::TagHelper
  include ActionView::Context
  include ActionView::Helpers::UrlHelper


  ##
  # Passare nelle opzioni la chiave :content con una proc che richiamo per generare il buffer
  #
  def to_html

    bootstrap_wrapping do
      content_tag(:div, class: 'input-group bs_label_with_content') do
        content_tag(:div, class: 'row') do
          tmp = ActiveSupport::SafeBuffer.new

          tmp << content_tag(:div, class: "col-md-6") do
            builder.input method, :label => false
          end

          if object.send(method).exists?
            tmp << content_tag(:div, class: "col-md-6 col-lg-6") do
              link_to I18n.t('formtastic.inputs.bs_file_download.download'), object.send(method).url, class: 'btn btn-default'
            end
          end

          tmp
        end
      end
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kono_utils-1.0.1 app/input/bs_file_download_input.rb
kono_utils-1.0.0 app/input/bs_file_download_input.rb
kono_utils-0.15.16 app/input/bs_file_download_input.rb
kono_utils-0.15.15 app/input/bs_file_download_input.rb
kono_utils-0.15.14 app/input/bs_file_download_input.rb
kono_utils-0.15.13 app/input/bs_file_download_input.rb
kono_utils-0.15.12 app/input/bs_file_download_input.rb
kono_utils-0.15.11 app/input/bs_file_download_input.rb
kono_utils-0.15.10 app/input/bs_file_download_input.rb
kono_utils-0.15.9 app/input/bs_file_download_input.rb
kono_utils-0.15.8 app/input/bs_file_download_input.rb
kono_utils-0.15.7 app/input/bs_file_download_input.rb
kono_utils-0.15.6 app/input/bs_file_download_input.rb
kono_utils-0.15.5 app/input/bs_file_download_input.rb