简体   繁体   English

活动管理表TD的自定义高度在导轨中不起作用?

[英]custom height for active admin table td not working in rails?

In my active admin page i want all my td are in same height instead of increasing the height respective to content. 在我的活动管理页面中,我希望所有td都处于同一高度,而不是增加与内容相对应的高度。 I try to set height but its not working. 我尝试设置高度,但不起作用。

admin_custom.css.scss admin_custom.css.scss

    body.active_admin {
    table td{
    height: 36px !important;
    color: black;
    width: auto;
    overflow-y: hidden;
    }
  }

这是我的形象。我希望我的地址显示在一行中。而且只有指定的宽度必须可见,并且通过单击它,我可以看到整个地址。

This is the image i have. 这是我的形象。 I want my address to be displayed in a single line. 我希望我的地址显示在一行中。 And only a specified width has to be visible and by clicking it i can see the entire address 而且只有指定的宽度是可见的,并且通过单击它我可以看到整个地址

This looks like you're using a javascript/css table-displaying plugin, is that right? 看起来您正在使用javascript / css表显示插件,对吗? (I say that because of the little triangles which look like 'order by' buttons) If so then it will probably be automatically assigning what it thinks are sensible widths to the columns. (我说这是因为看起来像“ order by”按钮的小三角形)如果这样的话,它可能会自动为列分配它认为合理的宽度。

If you display the truncated version, which shows the full address when clicked, then that might solve your width problem as well. 如果显示的是截短的版本(单击后显示完整的地址),那么这也可能会解决宽度问题。 I would do this like so: 我会这样做:

<%# in the td which has the address %>
<div class="truncated-address">
  <%= truncate(foo.address, length: 20) %>
<div>
<div class="full-address" style="display:none;">
  <%= foo.address %>
<div> 

then add this to the javascript which is used on the page - i'm writing this in jQuery, you can rewrite it yourself if you're not using jQuery. 然后将其添加到页面上使用的javascript中-我正在jQuery中编写此代码,如果您不使用jQuery,则可以自己重写它。

$(".truncated-address").click(function(){ $(this).hide().siblings().show();});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM