Turning an auto-expanding table row into a 'click to expand' row

74 Views Asked by At

I have a tablecompiled in Slim, which displays incoming messages in a row called 'events'.

My current issue is that this row automatically adjusts to expand to account for long messages, which creates a lopsided look if every 3rd message for example is quite long, but the rest are approximately one line of text.

I want to change this so that any string longer than 30 characters only displays the first line, and expands (aka reverts to it current format) upon clicking the row.

I however, can't think of the best way to approach this, and don't want to over-engineer a solution. What path would you suggest to achieve this?

table.slim

table.table.table-striped
thead.bg-white
  tr
    th = t('panel.home.show.event')
tbody.activities
  - @activities.each do |activity|
    tr
      - activity_cell = cell(:activity, activity)
      td.event
        == activity_cell.subtitle
        - if activity.deleted_by_slug.present?
          code == link_to(activity.deleted_by_slug, activity_cell.path(:deleted_by_slug))
      td
        == activity_cell.state
0

There are 0 best solutions below