Sha256: cff3bfb05cf945b9e7cb343f0bd1f1dc8dc54b486110631f2faa289cf542c1e3

Contents?: true

Size: 1011 Bytes

Versions: 12

Compression:

Stored size: 1011 Bytes

Contents

module GeoConcerns
  class CoverageRenderer < CurationConcerns::Renderers::AttributeRenderer
    include BoundingBoxHelper

    def render
      coverage = values.first if values
      return '' unless coverage
      markup(coverage).html_safe
    end

    private

      def markup(coverage)
        markup = ''
        markup << %(<tr><th>#{label}</th>\n<td id='accordion'><ul class='tabular'>)
        markup << %(<div id='bbox' class='collapse in'></div>)
        markup << bbox_display_inputs
        markup << bbox_script_tag(coverage)
        markup << toggle_button
        markup << %(</ul></td></tr>)
        markup
      end

      def toggle_button
        %(
          <a data-toggle='collapse' data-parent='accordion' href='#bbox' class='btn btn-default'>
           Toggle Map</a>
          )
      end

      def bbox_script_tag(coverage)
        %(
          <script>
            boundingBoxSelector({coverage: '#{coverage}', readonly: true});
          </script>
        )
      end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.3.3 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.3.2 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.3.1 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.3.0 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.2.0 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.1.1 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.1.0 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.0.10 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.0.9 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.0.8 app/renderers/geo_concerns/coverage_renderer.rb
geo_concerns-0.0.7 app/renderers/geo_concerns/coverage_renderer.rb