Search code examples
htmlcssruby-on-railstwitter-bootstraphaml

Can I put a Rails partial between two arrows?


So, I have a rails partial (an image of a car) that I want to put between two arrows ("<" and ">").

Here's my haml:

 .col-sm-12
   <
   = render partial: 'vehicle_image', locals: { quotation_request: quotation_request } 
   >

The problem I'm having is that I can't get the two arrows to show up on the same row as the image. Any ideas on how this can be fixed?


Solution

  • You could probably assign the arrows to some sort of element instead and lay things out like this

    .row
      .col-sm-1.text-right
        <
      .col-sm-10
        = render partial: 'vehicle_image', locals: { quotation_request: quotation_request } 
      .col-sm-1.text-left
        >
    

    You may have to do a bit of CSS to reduce the paddings/margins so that it that arrows end up where you want them exactly.

    I just attempted it on a personal project using:

       .row
         .col-lg-1
           %h1
             <
         .col-lg-8
           = link_to place_path(place) do
             = image_tag place.main_image.url(:medium), class: 'img-responsive img-place', alt: place.name
         .col-lg-1
           %h1
             >
    

    And got roughly this result after a bit of margin tweaking:

    enter image description here