Sha256: bd9d2b8b24b42bc9cb1a06dd0e6fb00f3add2bbf1d9e6ea3d32c44bca9367b24

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

<% # Clients of this partial must supply the following variables:
   # id
   # value
   #
   # Additionally, they may override the following variables:
   width ||= "750px"
   height ||= "650px"
   bkgd_color ||= "FFF"
   bkgd_url ||= ""
   canvas_width ||= 640
   canvas_height ||= 480
   canvas_expansion ||= 3
   hide_rulers ||= false
   hide_menu ||= false
   hide_image_tool ||= false
   show_hyperlink_tool ||= false
   show_layers ||= false
   url ||= nil
   extensions ||= nil
%>

<% iframe_src = URI.parse("/assets/svg-editor.html")

   query_hash = {:dimensions => [canvas_width, canvas_height].join(','),
                 :bkgd_color => bkgd_color,
                 :bkgd_url => bkgd_url,
                 :canvas_expansion => canvas_expansion,
                 :showRulers => !hide_rulers,
                 :showlayers => show_layers}
   query_hash[:url] = url if url
   query_hash[:source] = nil unless url
   query_hash[:extensions] = extensions if extensions

   iframe_src.query = query_hash.map{|k,v| "#{k}=#{v}"}.join('&') %>

<%= javascript_include_tag "sketchily_embed" %>

<%= content_tag(:iframe,
                "svg-edit",
                :src => iframe_src.to_s.html_safe,
                :width => width,
                :height => height,
                :id => "svgedit_#{id}",
                :style => "visibility: hidden") %>

<script type="text/javascript">
  attachLoadHandler("<%= id %>",
                    "<%= value.try(:squish) %>",
                    <%= hide_menu %>,
                    <%= hide_image_tool %>,
                    <%= show_hyperlink_tool %>,
                    "<%= url %>");
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sketchily-4.0.0 app/views/sketchily/_embed.html.erb~