小编Chr*_*own的帖子

虾:有没有办法垂直对齐盒子里的所有内容?

我试图将一些内容垂直居中放置在bounding_box中.使用单个文本,这没有问题:

bounding_box([0, bounds.top], :width => pdf.bounds.right, :height => pdf.bounds.top) do
  text "vertically aligned in the surrounding box", :valign => :center
end
Run Code Online (Sandbox Code Playgroud)

但是如果我的边界框中有多个元素,我该怎么办:

bounding_box([0, bounds.top], :width => pdf.bounds.right, :height => pdf.bounds.top) do
  text "vertically aligned in the surrounding box", :valign => :center
  text "vertically aligned in the surrounding box", :valign => :center
end
Run Code Online (Sandbox Code Playgroud)

这不起作用,当你尝试这个时,文本被重叠......

我正在寻找一种方法来分组bounding_box的整个内容,然后垂直对齐整个组.有没有办法用大虾做这个?

非常感谢你的帮助!克里斯

ruby alignment prawn bounding-box valign

8
推荐指数
1
解决办法
3393
查看次数

使用GPS参数处理导轨路线

我想在我的rails应用程序中创建一个路径来处理gps坐标参数.目的是找到给定位置附近的餐馆.

这是我开始的:
match "/restaurants/near/:lat/:lng(/:range)", :to => "restaurants#near", :as => "near", :constraints => {:range => /\d+/}

似乎路由器有浮动参数的问题,像/restaurants/near/53.0123/10.5678这样的网址无法识别.您是否有处理铁路网址中GPS坐标的解决方案或最佳实践?

谢谢!

parameters routing ruby-on-rails ruby-on-rails-3

6
推荐指数
1
解决办法
972
查看次数