2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'app/inputs/file_input.rb', line 2
def to_html
bootstrap_wrapping do
attachment = object.send(method)
= ""
with_geom = attachment.styles.values.select do |decl|
decl.geometry
end
if with_geom.any?
infos = "<table class='table table-striped'>"
with_geom.each do |s|
infos << "<tr><th>#{s.name}</th><td>#{s.geometry}</td></tr>"
end
infos << "</table>"
title = I18n.t('fullstack.admin.info', :default => "Info")
content = template.send :h, infos
<< " <i class='icon icon-info-sign' title='#{title}' data-content='#{content}' data-toggle='popover'></i>"
end
if !attachment.exists?
" <span class=\"file-input-attachment-filename\">\n <i class=\"icon icon-file\"></i> (\#{I18n.t('fullstack.admin.no_file_uploaded', :default => \"No file uploaded\")})\n </span> \n <span>\#{info_popup}</span>\n \n <a class=\"btn btn-small file-input-choose-file-button\" href=\"javascript:void(0)\">\n <i class=\"icon icon-upload\"></i>\n \#{I18n.t('fullstack.admin.choose_a_file', :default => \"Choose a file\")}\n </a>\n eos\n \n else\n preview_menu = \"\"\n \n preview_menu << template.content_tag(:li, template.link_to(I18n.t('fullstack.admin.original', :default => \"Original\"), \n attachment.url(:original),\n :target => \"_blank\"\n \n ))\n \n preview_menu << template.content_tag(:li, \"\", :class => :divider) if !attachment.styles.empty?\n \n attachment.styles.map do |name, decl|\n preview_menu << template.content_tag(:li, template.link_to(name.to_s.humanize, attachment.url(name), :target => \"_blank\"))\n end\n\n <<-eos\n \n <span class=\"file-input-attachment-filename\"><i class=\"icon icon-file\"></i> \#{template.send(:html_escape, attachment.url.split(\"/\").last.split(\"?\").first)} </span> \n <span>\#{info_popup}</span>\n \n <a class=\"btn btn-small file-input-choose-file-button\" href=\"javascript:void(0)\">\n <i class=\"icon icon-upload\"></i>\n \#{I18n.t('fullstack.admin.change', :default => \"Change\")}\n </a>\n <span class=\"dropdown\">\n <a class=\"btn dropdown-toggle btn-small\" data-toggle=\"dropdown\" href=\"#\">\n <i class=\"icon icon-eye-open\"></i>\n \#{I18n.t('fullstack.admin.preview', :default => \"Preview\")}\n <span class=\"caret\"></span>\n </a>\n <ul class=\"dropdown-menu\">\n \#{preview_menu}\n </ul>\n \n </span>\n \n \#{template.button(\n I18n.t('fullstack.admin.delete', :default => \"Delete\"),\n \"javascript:void(0)\",\n :type => :danger, :class => \"file-input-delete-attachment-button btn-small\", :\"data-toggle\" => :button\n )}\n \n eos\n \n end.html_safe << builder.file_field(method, :style => \"display:none;\") << (builder.check_box(\"\#{method}_delete\", :class => \"file-input-delete-attachment-checkbox\", :style => \"display:none;\") if attachment.exists?)\n end\nend\n"
|