diff --git a/app/assets/stylesheets/_header.scss b/app/assets/stylesheets/_header.scss index 3dadbfbd..b454fd73 100644 --- a/app/assets/stylesheets/_header.scss +++ b/app/assets/stylesheets/_header.scss @@ -1,7 +1,24 @@ .title-container { @include clearfix; - h1 { - float: left; + .user-detail-container { + .user-title { + float: left; + margin-bottom: 0; + } + } +} + +.user-stats { + .joined-time { + margin-left: 0.5em; + font-size: 0.8rem + } + + .total-hours { + float: right; + margin-right: 1em; + font-weight: bold; + text-align: center; } } diff --git a/app/assets/stylesheets/_time_span.scss b/app/assets/stylesheets/_time_span.scss index 6da62d76..2be2a1da 100644 --- a/app/assets/stylesheets/_time_span.scss +++ b/app/assets/stylesheets/_time_span.scss @@ -5,7 +5,6 @@ p { float: right; - // font-size: em; color: #ccc; text-transform: uppercase; letter-spacing: 1px; diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 83b98348..6e5873c9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3,6 +3,7 @@ class UsersController < ApplicationController def show @time_series = time_series_for(resource) + @entry_stats = EntryStats.new(@time_series.entries_for_time_span) end def index diff --git a/app/views/_header.html.haml b/app/views/_header.html.haml index 952beeae..5405a43f 100644 --- a/app/views/_header.html.haml +++ b/app/views/_header.html.haml @@ -1,3 +1,4 @@ .title-container - %h1= title + .user-detail-container + %h1.user-title= title = render "/time_span" if @time_series diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index 3a7f697e..d4e2aef6 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -3,9 +3,14 @@ .outer .container = render "/header", title: @user.full_name + %p.user-stats + %span.joined-time Joined: #{@user.created_at.strftime("%B %d, %Y")} + %span.total-hours Total Hours Spent: #{@entry_stats.total_hours} .charts = render @time_series.chart, time_series: @time_series .charts - = render "/charts/pie_chart", title: t("charts.hours_spent_per_project"), data: EntryStats.new(@time_series.entries_for_time_span).hours_for_subject_collection(Project.all).to_json - = render "/charts/pie_chart", title: t("charts.hours_spent_per_category"), data: EntryStats.new(@time_series.entries_for_time_span).hours_for_subject_collection(Category.all).to_json + = render "/charts/pie_chart", title: t("charts.hours_spent_per_project"), + data: @entry_stats.hours_for_subject_collection(Project.all).to_json + = render "/charts/pie_chart", title: t("charts.hours_spent_per_category"), + data: @entry_stats.hours_for_subject_collection(Category.all).to_json = link_to t("users.show.entries"), user_entries_path(@user)