使用content_for实现tab分页的好处

与异步刷新更新局部tab div相比,全局刷新可以有利于外部连接的直接跳转到对应tab
在此前提下,用content_for来实现多tab效果不错!
page: crm/companies/show

<div class="ui grid">
<div class="left floated fourteen wide column">
<a style="font-weight:bold; color:black; font-size:17px;">Company Detail</a> <<%= link_to "Company List", crm_companies_path %>
</div>
</div>
<div class="ui blue segment">
<!-- 基本信息 -->
<h3 class="ui dividing header">
Basic Information
<%= link_to edit_crm_company_path(@company), remote: true do %>
<i class="edit icon"></i>
<% end %>
</h3>
<%= render 'crm/companies/basic_info' %>
<div class="ui attached tabular menu archives">
<%= link_to 'Accounts', crm_accounts_path(company_id: @company.id), class: active_helper(controller: 'accounts') %>
<%= link_to 'Contacts', crm_contacts_path(company_id: @company.id), class: active_helper(controller: 'contacts') %>
</div>
<div class="ui bottom attached segment">
<%= yield :company_detail %>
</div>
</div>


page:crm/accounts/index

<% content_for :company_detail do %>
<table class="ui celled table">
<thead>
<tr>
<th class="center aligned">User Name</th>
<th class="center aligned">Account / Email</th>
<th class="center aligned">Mob | Tel</th>
<th class="center aligned">Account Status</th>
<th class="center aligned">Vendor Status</th>
<th class="center aligned">Action</th>
</tr>
</thead>
<tbody>
<%= render partial: 'list', collection: @contacts, as: :contact %>
</tbody>
</table>
<% end %>
<%= render 'crm/companies/show' %>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值