if statement messing my table

Hey y'all was working on a task management app just to practice (I'm a total noob here), but when styling it my I've got an if statement inside of a bootstrap table that gets all f'ed up when the if is inside the table the second I take it out everything lines up again.

Here's my code:
https://www.dropbox.com/s/lgvwxc0u19r0gcl/Screenshot%202017-03-18%2022.44.32.png?dl=0

Here's what's doing (see how the items aren't aligning):
https://www.dropbox.com/s/x7n6tn4l5teah5l/Screenshot%202017-03-18%2022.45.16.png?dl=0

I've tried giving them each classes of they're own and trying to align it in CSS but that seems like it's not doing anything.

Any ideas why this is happening and what the solution may be?
Rails 4.2.5 and bootstrap-sass gem

Thanks in advance any help is greatly appreciated.

1 thought on “if statement messing my table”

  1. It probably has something to do with the width and align attributes not being set for the td elements in the else statement.

    Having said that, I wouldn’t hard code the width and alignment in the HTML, but set a CSS class on the td elements and then set the width and align properties in the CSS. I would also refactor some code into a reusable partial since the structure is the same in both the if and else blocks and you want to keep code as DRY as possible.

    EDIT: I looked at the code again and it looks like the only difference is the opacity and strike through of the description? I would instead refactor to have the if statement confined to the description text.

    Reply

Leave a Comment