Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gmaps4rails : Setting map width and height

Reading the gmaps4rails gem documentation, I didn't find any way to set the map width and height. Is there any way to do this ?

like image 614
manu_v Avatar asked Mar 14 '11 10:03

manu_v


2 Answers

I should have given further details about this.

I'll make an installation rake task to copy css and javascript in the Rails app.

Well, for now, simply override this in your css (I assume you didn't change the map id).

#gmaps4rails_map {
  width: 800px;
  height: 400px;
}

If you want it to work, beware to include your css after the yield(:head)

<%= yield :head %>
<%= stylesheet_link_tag "your css" %>
like image 120
apneadiving Avatar answered Sep 29 '22 18:09

apneadiving


The answer by @apenadving didn't work for me, assuming that the map div classes and id's didn't change, I needed to do the following (in scss) in order to get things working correctly, maybe I'm missing something...

.map_container{
   $width:675px;
   width:$width;
   .gmaps4rails_map{
     width: $width;
     height: 400px;
   }
}

Also with rails 3.1 and above you can simply do the following in your application.css.scss file

@import "gmaps4rails";
@import "myCoolStyle";
like image 26
user160917 Avatar answered Sep 29 '22 18:09

user160917