それで、私はロゴとカバー画像を持つモデル (Rails プロジェクト内) を持っています。それらの両方をアップロードするために 1 つのフォームを使用したいのですが、これは transloadit で行うことができますか? 私はどこにも例を見つけることができません...
質問する
99 次
1 に答える
0
これは私のプロジェクトからのものです。6回使用しました。私はそれが役立つことを願っています..
new.html.haml
- title t('.new_provider')
.spacer
.row
.span12
= render 'shared/flash_messages'
%h1= yield :title
.row
.span12
= bootstrap_form_for @provider, validate: true, html: {edit: "false", id: "providerform", enctype:"multipart/form-data", class: 'form-horizontal' } do |f|
= transloadit_jquerify :providerform, :wait => true, :modal=>false
= f.error_messages
= render 'form', f: f
.form-actions
= f.submit t('.create'), id: 'provider_submit', class: 'btn btn-large btn-primary', disable_with: t('helpers.disable_with')
= render 'providers/modal_phone_verification'
_form.html.haml
= f.text_area :business_description, :id =>"business_description", :rows => "4"
.controls
%p.help-block{style:"margin-bottom: 15px; margin-top: -20px;"}
%small
= t('business_description_placeholder')
.control-group
= label_tag :business_photos, t('.business_photos'), class: 'control-label'
.controls
= render partial: 'file_upload', :locals => {f: f}
%span#file-error.help-inline{style: "display:none;color: #b44337"}=t('.file_presence_error')
.control-group
.controls
%p.help-block{style:"margin-bottom: 0px; margin-top: -20px;"}
%small
= t('image_info')
_file_uplaod.html.haml
= transloadit :image_resize
-6.times do |index|
.fileupload.fileupload-new.pull-left{style: "padding-right: 5px;", "data-provides" => "fileupload" }
.fileupload-new.thumbnail{:style => "width: 130px; height: 130px;"}
-if @provider.provider_images.present?
- if @provider.provider_images["provider_image#{index+1}"].present?
%img{:id=>"providerimage1", :src => @provider.provider_images["provider_image#{index+1}"][0]}/
.fileupload-preview.fileupload-exists.thumbnail{:style => "width: 130px; height: 130px;"}
%div
%span.btn.btn-file
%span.fileupload-new{:id => "selectbutton"}
-if index == 0
=t('select_profile_image')
-else
=t('select_image')
%span.fileupload-exists
-if index == 0
=t('select_profile_image')
-else
=t('select_image')
=file_field_tag "provider_image#{index+1}", accept: 'image/png,image/bmp,image/jpeg,image/tif,image/jpg', :onchange =>"validateImageFiles(this);", :data => {:max_file_size => 5.megabytes}
于 2014-04-02T17:17:07.210 に答える