Module: GeoConcerns::BoundingBoxHelper
- Included in:
- CoverageRenderer
- Defined in:
- app/helpers/geo_concerns/bounding_box_helper.rb
Instance Method Summary collapse
-
#bbox(property) ⇒ Object
Builds HTML string for bounding box selector tool.
-
#bbox_display_inputs ⇒ Object
Returns markup for a row of read only bounding box inputs.
-
#bbox_input_id(property) ⇒ Object
Returns id of location input that is bound to bbox selector.
-
#bbox_script_tag(property) ⇒ Object
Returns script tag markup for loading the bounding box selector.
Instance Method Details
#bbox(property) ⇒ Object
Builds HTML string for bounding box selector tool. Calls boundingBoxSelector javascript function and passes the id of the location input element that it binds to. @return
9 10 11 12 13 14 15 |
# File 'app/helpers/geo_concerns/bounding_box_helper.rb', line 9 def bbox(property) markup = '' markup << %(<div id='bbox'></div>) markup << bbox_display_inputs markup << bbox_script_tag(property) markup.html_safe end |
#bbox_display_inputs ⇒ Object
Returns markup for a row of read only bounding box inputs. @return rubocop:disable MethodLength
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 |
# File 'app/helpers/geo_concerns/bounding_box_helper.rb', line 21 def bbox_display_inputs %( <div class="row bbox-inputs"> <div class="col-md-3"> <div class="input-group"> <span class="input-group-addon"><div>North</div></span> <input readonly id="bbox-north" type="text" class="form-control bbox-input"> </div> </div> <div class="col-md-3"> <div class="input-group"> <span class="input-group-addon"><div>East</div></span> <input readonly id="bbox-east" type="text" class="form-control bbox-input"> </div> </div> <div class="col-md-3"> <div class="input-group"> <span class="input-group-addon"><div>South</div></span> <input readonly id="bbox-south" type="text" class="form-control bbox-input"> </div> </div> <div class="col-md-3"> <div class="input-group"> <span class="input-group-addon"><div>West</div></span> <input readonly id="bbox-west" type="text" class="form-control bbox-input"> </div> </div> </div> ) end |
#bbox_input_id(property) ⇒ Object
Returns id of location input that is bound to bbox selector. @return id of location input element
69 70 71 |
# File 'app/helpers/geo_concerns/bounding_box_helper.rb', line 69 def bbox_input_id(property) "#{curation_concern.class.name.underscore}_#{property}" end |
#bbox_script_tag(property) ⇒ Object
57 58 59 60 61 62 63 |
# File 'app/helpers/geo_concerns/bounding_box_helper.rb', line 57 def bbox_script_tag(property) %( <script> boundingBoxSelector({inputId: #{bbox_input_id(property)}}); </script> ) end |