J3RN / time-tracker

A time tracking application
http://timesheet.j3rn.com
MIT License
6 stars 14 forks source link

Added Tag labels for index views #108

Closed J3RN closed 7 years ago

J3RN commented 7 years ago

On the Tasks#index page:

screen shot 2016-12-01 at 15 47 09

On TimeEntries#index:

screen shot 2016-12-01 at 15 53 18

Regrettably, <option> tags are not allowed to contain HTML, so they are still left looking the same:

screen shot 2016-12-01 at 15 52 53

I'm fairly satisfied with this, so unless anyone raises serious concerns within the next hour or so, I'll be merging this.

Closes #107

3ygun commented 7 years ago

Looks good! task_with_tag_labels appears easy to extend with color options should the desire arise. Not able to test it currently but is the generated code decently readable? Mainly questioning the line:

task_div + tag_spans.reduce(:+)

looks a little strange (does the :+ just concatenate them?) alas I don't do enough Rails.

J3RN commented 7 years ago

Yes, that's a Ruby thing. I think I tried using .join, which is more readable, but I believe the resulting string wasn't html_safe, and this one is. If it really comes down to it, I could use joinand call html_safe on it --- I just really hate calling html_safe.