Sha256: 37f49cdfbde30e96e64d811b22d635981fd94937e0cc7fb283b7e37e53ad4c30
Contents?: true
Size: 1.21 KB
Versions: 6
Compression:
Stored size: 1.21 KB
Contents
<% root = Cms::Section.root.first root.full_path = root.name @sections = [] @sections << root @sections += root.master_section_list @sections.each {|s| s.full_path = "/" + s.full_path unless s == root } @block.attachment_file_path = @block.attachment.file_path if @block.attachment_file_path.blank? && !@block.new_record? %> <%= content_for :html_head do %> <%= javascript_tag do %> jQuery(function($) { <% if @block.new_record? %> var sectionIdPathMap = <%= @sections.inject({}){|map, sec| map[sec.id.to_s] = sec.path.sub(/\/$/,''); map}.to_json.html_safe %> $('#file_block_attachment_file, #file_block_attachment_section_id').change(function(){ $('#file_block_attachment_file_path').val(sectionIdPathMap[$('#file_block_attachment_section_id').val()]+'/'+$.cms.sanitizeFileName($('#file_block_attachment_file').val())) }) <% end %> }); <% end %> <% end %> <%= f.cms_text_field :name %> <%= f.cms_file_field :attachment_file, :label => "File" %> <%= f.cms_drop_down :attachment_section_id, @sections.map{|s| [s.full_path, s.id]}, :label => "Section" %> <%= f.cms_text_field :attachment_file_path, :label => "Path" %> <%= f.cms_tag_list %>
Version data entries
6 entries across 6 versions & 1 rubygems