我必须在我的应用程序的仅 show.html.haml 页面上使用某种表格样式。具体来说,我不希望将此样式应用于我在 _form.html.haml 部分中的表单。以下是样式元素:
table {
border-collapse: collapse;
width:100%;
}
td, th {
border: 1px solid gray;
padding:5px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: ellipsis;
}
th {
background-color: #ccc;
text-shadow: 1px 1px 1px rgba(0,0,0,.2);
}
我在 app/vendor/assets/web-app-theme/stylesheets 目录中创建了一个名为 data_tables.css 的小文件,并将其包含在我的 application.js 中,如下所示:
*= 需要 web-app-theme/data_tables
问题是:它不仅影响我的 show.html.haml 页面中的表格(我想要),而且影响 _form_html.haml 部分(我不想要)。显然,我对资产组织有一些不完全了解的地方。以下是我在 app/assets/stylesheets 目录中的 application.css 文件的内容:
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require web-app-theme/base
*= require web-app-theme/style
*= require web-app-theme/wat_ext
*= require web-app-theme/data-tables
*= require formalize
*= require jquery.ui.core
*= require jquery.ui.theme
*= require jquery.ui.tabs
*= require dataTables/src/demo_table_jui
*= require_self
*= require_tree .
*/