Sha256: 8c12d898269ca677e14e77d5f9ccce3862202f3e5d7ce0aaeb8dea2b899faf05
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
<% content_for :head do %> <%= stylesheet_link_tag 'sofa_gallery/jquery.jcrop.css' %> <%= javascript_include_tag 'sofa_gallery/jquery.jcrop.js' %> <script type="text/javascript" charset="utf-8"> $(function(){ $('#cropbox').Jcrop({ onChange: update_crop, onSelect: update_crop, aspectRatio: <%= @photo.gallery.force_ratio?? (@photo.gallery.full_width.to_f / @photo.gallery.full_height) : 'null' %> }); }); function update_crop(coords) { var ratio = <%= @photo.image_geometry(:original).width %> / <%= @photo.image_geometry(:admin_full).width %>; $('#crop_x').val(coords.x * ratio); $('#crop_y').val(coords.y * ratio); $('#crop_w').val(coords.w * ratio); $('#crop_h').val(coords.h * ratio); } </script> <% end %> <h1> Crop Photo </h1> <%= image_tag @photo.image.url(:admin_full), :id => 'cropbox' %> <%= gallery_form_for @photo, :as => :photo, :url => { :action => :update } do |form| %> <% [:crop_x, :crop_y, :crop_w, :crop_h].each do |attr| %> <%= form.hidden_field attr, :id => attr %> <% end %> <%= form.submit 'Crop' %> <% end %>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sofa_gallery-0.0.0 | app/views/gallery_admin/photos/crop.html.erb |