Class: BsFileDownloadInput

Inherits:
Formtastic::Inputs::StringInput
  • Object
show all
Includes:
ActionView::Context, ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper, FormtasticBootstrap::Inputs::Base, FormtasticBootstrap::Inputs::Base::Collections
Defined in:
app/input/bs_file_download_input.rb

Instance Method Summary collapse

Instance Method Details

#to_htmlObject

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



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/input/bs_file_download_input.rb', line 12

def to_html

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

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

        if object.send(method).exists?
          tmp << (: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