1

我有一个显示页面 /invoices/show 显示我的发票内容

<p id="notice"><%= notice %></p>
<div class="row">
<div class="span7">
    <h2 style="text-align:center;"> CONSTRUCTION LTD </h2>
        <h3 style="text-align:center;">OHIO</h3>
            <address style="text-align:center;"> Plot 10<br/>
            </address>

        <h3 style="text-decoration:underline; text-align:center;"> UTILITY BILL </h3>
            <h4 style="text-decoration:underline; text-align:center;"> TAX INVOICE        </h4>

        <table>
            <td valign="top" align="left">
                <div style="float:left; width:450px;">No:&nbsp; <%= @invoice.id  %></div>
                <div style="float:right"> Date:&nbsp; <%= @invoice.invoice_date  %></div>
            </td>
        </table>
            <P></P>
            <P></P>
    <div>To: <%= @invoice.customer.name%></div>
        <p></p>


<table class="table table-bordered table-condensed">
<thead>
<tr class="success">
  <th><label class="control-label">Description</label></th>
  <th><label class="control-label">Rate</label></th>
  <th><label class="control-label">Tax</label></th>
  <th><label class="control-label">Amount</label></th>
</tr>
</thead>
<tbody>
<% @invoice.invoice_items.each do | item| %>
  <tr class="controls"> 
    <td><%= item.description %></td>
    <td><%= item.rate %></td>
    <td><%= item.tax_amount %></td>
    <td><%= item.amount %></td>     
  </tr>
  <tr>
      <td colspan="3" align="left"><strong>TOTAL:</strong></td>
      <td colspan="1"><%= item.amount %></td>
  </tr>
    <% end %>
</tbody>
</table>


<div class="row">
<div class="span3">
    <table>
        <tbody>
            <tr>
                <td> <b>For Landlord</b></td></tr>
            <tr> <td>Approved by:</td></tr>
            <tr> <td>Sign:</td></tr>
        </tbody>
        </table>
    </div>

<div class="span3" style="position: relative; align:left; left:150px;">
    <table>
        <tbody>
            <tr>
                <td> <b>For Tenant</b></td></tr>
            <tr> <td>Approved by:</td></tr>
            <tr> <td>Sign:</td></tr>
        </tbody>
        </table>
 </div>
</div>
<br/>
<br />
<div>
<small><strong>Terms and Conditions</strong></small>
<table>
    <tbody>
        <tr>
            <td><%= Settings.invoice_terms%></td>
        </tr>
    </tbody>
</table>
</div>
<br />

<div class="form actions">
<p>
    <%= link_to t('.edit', :default => t("helpers.links.edit")),
                edit_invoice_path, :class => 'btn btn-primary' %>
</p>
</div>  
</div>
</div>

在我的 application.html.erb 中,我有这个用于 CSS

  <%= stylesheet_link_tag    "application", :media => "all" %>

更重要的是,我的应用程序文件有一个导航栏元素。

我正在尝试通过转到浏览器中的打印选项来打印 Invoices/show.html.erb 页面,但是,我不希望它在我的 application.html.erb 文件和编辑按钮中包含导航栏元素在发票/show.html 中。

我正在使用 Twitter 引导程序,我该怎么做?

4

1 回答 1

0

这是我想到的一个解决方案:

您可以做的是,在您的show视图(或应用程序布局)中添加一个谓词:

if params[:controller] == "invoice" && params[:action] == "show"
  # do or show whatever you want
end

或者您可以为您的views/layouts文件夹添加不同的布局。然后在你的controllers/invoice_controller

def show
  # ...
  render layout: 'a_different_layout_for_invoices'
end
于 2013-01-07T13:34:14.930 回答