4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/image_thread/patches/form_helper.rb', line 4
def image_thread_field(object_name, method, options = nil)
tag = ActionView::Helpers::Tags::Base.new(object_name, [method, 'images'].join('_'), self)
thread = options.delete(:thread)
options.update(class: 'image_thread_fileupload')
options.update(data: { url: '/image_thread/images',
uploader: [object_name, method, 'uploader', SecureRandom.hex(16)].join('_'),
thread: thread.to_i,
dir: options[:dir],
name: tag.send(:tag_name, true) })
template = " <div class=\"uploader-container\">\n <span class=\"btn btn-success fileinput-button\">\n <span class=\"glyphicon glyphicon-plus\"> Add files</span>\n \#{file_field_tag(:source, options)}\n </span>\n <div class=\"files uploader-\#{method} clearfix\">\#{render_image_thread(thread, tag.send(:tag_name, true))}</div>\n </div>\n HTML\n\n template.html_safe\nend\n"
|