Module: PaperCropper::FormHelpers
- Defined in:
- lib/paper_cropper/helpers.rb
Instance Method Summary collapse
-
#tws_cropper_box(attachment_name) ⇒ Object
Create a new cropper box with all buttons and classe.
Instance Method Details
#tws_cropper_box(attachment_name) ⇒ Object
Create a new cropper box with all buttons and classe. This will be use the twitter bootstrap classes
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 |
# File 'lib/paper_cropper/helpers.rb', line 7 def tws_cropper_box obj = self.object form_helper = self aspect_ratio = obj.send "#{}_aspect" out = "<div class='crop-image-container' data-crop-image-range='#{aspect_ratio}'>" out << form_helper.hidden_field(:"#{}_crop_x", class: 'crop-image-value-x') out << form_helper.hidden_field(:"#{}_crop_y", class: 'crop-image-value-y') out << form_helper.hidden_field(:"#{}_crop_width", class: 'crop-image-value-width') out << form_helper.hidden_field(:"#{}_crop_height", class: 'crop-image-value-height') out << form_helper.hidden_field(:"#{}_crop_ratio", class: 'crop-image-value-ratio') out << form_helper.file_field(, class: 'crop-image-file-input', label_col: "col-sm-3", control_col: "col-sm-9") out << '<hr>' image_src = obj.send("#{}?") ? obj.send().url : '' out << '<div class="crop-image-wrapper">' out << "<img class='crop-image' class='crop-image' src='#{image_src}'>" out << '</div>' out << '<hr>' out << '<div class="btn-group pull-left" role="group">' out << "<button type='button' class='crop-image-btn-zoom-in btn btn-default'>+</button>" out << "<button type='button' class='crop-image-btn-zoom-out btn btn-default'>-</button>" out << '</div>' out << '<div class="btn-group pull-right" role="group">' out << "<button type='button' class='crop-image-btn-move-left btn btn-default'>left</button>" out << "<button type='button' class='crop-image-btn-move-right btn btn-default'>right</button>" out << "<button type='button' class='crop-image-btn-move-up btn btn-default'>up</button>" out << "<button type='button' class='crop-image-btn-move-down btn btn-default'>down</button>" out << '</div>' out << '</div>' out.html_safe end |