mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 16:53:23 -05:00
Added Time entries index page
This commit is contained in:
parent
3d71add637
commit
4224f0de40
@ -13,6 +13,7 @@
|
|||||||
//= require jquery
|
//= require jquery
|
||||||
//= require jquery_ujs
|
//= require jquery_ujs
|
||||||
//= require twitter/bootstrap/bootstrap-button
|
//= require twitter/bootstrap/bootstrap-button
|
||||||
|
//= require twitter/bootstrap/bootstrap-modal
|
||||||
//= require utils
|
//= require utils
|
||||||
//= require bootstrap-datepicker
|
//= require bootstrap-datepicker
|
||||||
//= require bootstrap-timepicker
|
//= require bootstrap-timepicker
|
||||||
|
@ -9,6 +9,8 @@ class TimeEntriesController < AuthenticatedController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@user_time_entries = TimeEntry.where(loggable_id: current_user.id)
|
||||||
|
@credits_available = current_user.total_credits
|
||||||
|
@hours_worked = current_user.total_hours
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,4 +12,12 @@ class TimeEntry < ActsAsLoggable::Log
|
|||||||
copy_action_id: 4
|
copy_action_id: 4
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def duration
|
||||||
|
end_date - start_date
|
||||||
|
end
|
||||||
|
|
||||||
|
def duration_in_hours
|
||||||
|
(duration / 1.hour).round(2)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,5 +5,27 @@
|
|||||||
%p Total Hours Worked: #{@hours_worked}
|
%p Total Hours Worked: #{@hours_worked}
|
||||||
%p Total Credits Available: #{@credits_available}
|
%p Total Credits Available: #{@credits_available}
|
||||||
|
|
||||||
|
%table.table
|
||||||
|
%tbody
|
||||||
|
- @user_time_entries.each do |entry|
|
||||||
|
%tr
|
||||||
|
%td #{entry.start_date.to_date.to_formatted_s(:rfc822)}
|
||||||
|
%td #{entry.duration_in_hours}
|
||||||
|
%td #{truncate(entry.description)}
|
||||||
|
%td
|
||||||
|
%button{ class: "btn icon-remove btn-danger", role: "button", "data-toggle" => "modal", "data-target" => "#confirmation" }
|
||||||
|
|
||||||
%a{class: "btn btn-lg btn-block btn-primary", href: new_time_entry_path } Add Time Entry
|
%a{class: "btn btn-lg btn-block btn-primary", href: new_time_entry_path } Add Time Entry
|
||||||
|
|
||||||
|
.modal{ id: "confirmation", class: "hide", role: "dialog", "aria-labelledby" => "confirmation_title", "aria-hidden" => "true", tabindex: -1 }
|
||||||
|
.modal-header
|
||||||
|
%button{ class: "close", "data-dismiss" => "modal", "aria-hidden" => "true"}x
|
||||||
|
%h4{ id: "confirmation_title" } header
|
||||||
|
.modal-body
|
||||||
|
Are you sure?
|
||||||
|
.modal-footer
|
||||||
|
%button{ class: "btn", "data-dismiss" => "modal", "aria-hidden" => "true"} Close
|
||||||
|
%button{ class: "btn btn-primary" } Delete
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user