1.附件列表
ul.m_item_list [email protected]_list(‘手机图片‘).each do |attachment| li = link_to ‘/posts/1‘, class: ‘wrap‘ do = image_tag amalgam.attachment_url(attachment) p.des = attachment.description p.type 干红葡萄酒 .button = image_tag(‘button_details.jpg‘)/////=image_tag attachment.file.url
= properties_for @page do |p| # 提供文本框修改 @page 对象的 title = p.string ‘title‘ # 提供文本框修改 @page 对象的 content[‘title‘] 属性 = p.string ‘content.title‘ # 上传名为 pic 的附件 = p.attachment ‘pic‘ # 上传名为 pics 的附件列表 = p.attachment_list ‘pics‘
2.带有index的
[email protected]_with_index do |attachment,index|
3.自身与兄弟元素
[email protected]_and_siblings.each do |sub_nav|
4.properties button
ul -Page.find_by_slug(‘tickets-top‘).children.each do |ticket| li =link_to(ticket.content[‘url‘] || ‘#‘, target: ‘_blank‘) do =editable_image_tag ticket, ‘content.image‘,:display => ‘245x162!‘,:placeholder_options => {:width => 245, :height => 162} h3=ticket.title h2="¥#{ticket.content[‘price‘]}" .btn 立即抢购 = properties_button ticket do |f| = f.string ‘title‘ = f.string ‘content.price‘ = f.string ‘content.url‘ = f.string ‘content.wap_url‘
5.content_tag
=editable_content_tag :div,@page,‘content.content‘,:class=>‘article‘ do |
6.content_img
=editable_image_tag @page,:display => ‘80x371!‘, :placeholder => "position.png",:placeholder_options => {:width => 80, :height => 371}
7.home是举例子 是文件夹
pages |-- home |-- &1.html.slim |-- &2.html.slim 页面: |-- home |-- child1 (home/&1.html.slim) |-- child2 (home/&1.html.slim) | |-- grand_child (home/&2.html.slim)
8变量穿插
h2=
"¥#{ticket.content[‘price‘]}"
=image_tag("tag_#{tag}.jpg")
时间: 2024-11-03 21:40:47