Added seperate date support for time entries.
This commit is contained in:
parent
8b00714bf3
commit
8ddd31f662
37
stoptime.rb
37
stoptime.rb
|
@ -38,6 +38,7 @@ unless defined? PUBLIC_DIR
|
||||||
:default => "%Y-%m-%d %H:%M",
|
:default => "%Y-%m-%d %H:%M",
|
||||||
:month_and_year => "%B %Y",
|
:month_and_year => "%B %Y",
|
||||||
:date_only => "%Y-%m-%d",
|
:date_only => "%Y-%m-%d",
|
||||||
|
:time_only => "%H:%M",
|
||||||
:day_code => "%Y%m%d")
|
:day_code => "%Y%m%d")
|
||||||
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(
|
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(
|
||||||
:default => "%Y-%m-%d",
|
:default => "%Y-%m-%d",
|
||||||
|
@ -328,6 +329,20 @@ module StopTime::Models
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class TimeEntryDateSupport < V 1.8 # :nodoc:
|
||||||
|
def self.up
|
||||||
|
add_column(TimeEntry.table_name, :date, :datetime)
|
||||||
|
TimeEntry.all.each do |te|
|
||||||
|
te.date = te.start.at_beginning_of_day
|
||||||
|
te.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
remove_column(TimeEntry.table_name, :date)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end # StopTime::Models
|
end # StopTime::Models
|
||||||
|
|
||||||
# = The Stop… Camping Time! controllers
|
# = The Stop… Camping Time! controllers
|
||||||
|
@ -787,8 +802,10 @@ module StopTime::Controllers
|
||||||
# If the provided information was invalid, the errors are retrieved.
|
# If the provided information was invalid, the errors are retrieved.
|
||||||
def post
|
def post
|
||||||
if @input.has_key? "enter"
|
if @input.has_key? "enter"
|
||||||
|
|
||||||
@time_entry = TimeEntry.create(
|
@time_entry = TimeEntry.create(
|
||||||
:task_id => @input.task,
|
:task_id => @input.task,
|
||||||
|
:date => @input.date,
|
||||||
:start => @input.start,
|
:start => @input.start,
|
||||||
:end => @input.end,
|
:end => @input.end,
|
||||||
:comment => @input.comment,
|
:comment => @input.comment,
|
||||||
|
@ -1075,6 +1092,7 @@ module StopTime::Views
|
||||||
h2 "Timeline"
|
h2 "Timeline"
|
||||||
table.timeline do
|
table.timeline do
|
||||||
col.task {}
|
col.task {}
|
||||||
|
col.date {}
|
||||||
col.start_time {}
|
col.start_time {}
|
||||||
col.end_time {}
|
col.end_time {}
|
||||||
col.comment {}
|
col.comment {}
|
||||||
|
@ -1082,6 +1100,7 @@ module StopTime::Views
|
||||||
col.flag {}
|
col.flag {}
|
||||||
tr do
|
tr do
|
||||||
th "Project/Task"
|
th "Project/Task"
|
||||||
|
th "Date"
|
||||||
th "Start time"
|
th "Start time"
|
||||||
th "End time"
|
th "End time"
|
||||||
th "Comment"
|
th "Comment"
|
||||||
|
@ -1091,10 +1110,11 @@ module StopTime::Views
|
||||||
form :action => R(Timeline), :method => :post do
|
form :action => R(Timeline), :method => :post do
|
||||||
tr do
|
tr do
|
||||||
td { _form_select("task", @task_list) }
|
td { _form_select("task", @task_list) }
|
||||||
|
td { input :type => :text, :name => "date",
|
||||||
|
:value => DateTime.now.to_date.to_formatted_s }
|
||||||
td { input :type => :text, :name => "start",
|
td { input :type => :text, :name => "start",
|
||||||
:value => DateTime.now.to_date.to_formatted_s + " " }
|
:value => DateTime.now.to_time.to_formatted_s(:time_only) }
|
||||||
td { input :type => :text, :name => "end",
|
td { input :type => :text, :name => "end" }
|
||||||
:value => DateTime.now.to_date.to_formatted_s + " " }
|
|
||||||
td { input :type => :text, :name => "comment" }
|
td { input :type => :text, :name => "comment" }
|
||||||
td { "N/A" }
|
td { "N/A" }
|
||||||
td { _form_input_checkbox("bill") }
|
td { _form_input_checkbox("bill") }
|
||||||
|
@ -1108,9 +1128,10 @@ module StopTime::Views
|
||||||
tr do
|
tr do
|
||||||
td { a entry.task.name,
|
td { a entry.task.name,
|
||||||
:href => R(CustomersNTasksN, entry.customer.id, entry.task.id) }
|
:href => R(CustomersNTasksN, entry.customer.id, entry.task.id) }
|
||||||
td { a entry.start,
|
td { a entry.date.to_date,
|
||||||
:href => R(TimelineN, entry.id) }
|
:href => R(TimelineN, entry.id) }
|
||||||
td { entry.end }
|
td { entry.start.to_formatted_s(:time_only) }
|
||||||
|
td { entry.end.to_formatted_s(:time_only)}
|
||||||
td { entry.comment }
|
td { entry.comment }
|
||||||
td { "%.2fh" % entry.hours_total }
|
td { "%.2fh" % entry.hours_total }
|
||||||
td do
|
td do
|
||||||
|
@ -1439,6 +1460,7 @@ module StopTime::Views
|
||||||
h2 "Registered Time"
|
h2 "Registered Time"
|
||||||
table.time_entries do
|
table.time_entries do
|
||||||
col.flag {}
|
col.flag {}
|
||||||
|
col.date {}
|
||||||
col.start_time {}
|
col.start_time {}
|
||||||
col.end_time {}
|
col.end_time {}
|
||||||
col.comment {}
|
col.comment {}
|
||||||
|
@ -1446,6 +1468,7 @@ module StopTime::Views
|
||||||
col.amount {}
|
col.amount {}
|
||||||
tr do
|
tr do
|
||||||
th ""
|
th ""
|
||||||
|
th "Date"
|
||||||
th "Start time"
|
th "Start time"
|
||||||
th "End time"
|
th "End time"
|
||||||
th "Comment"
|
th "Comment"
|
||||||
|
@ -1460,7 +1483,9 @@ module StopTime::Views
|
||||||
@hourly_rate_tasks[task].each do |entry|
|
@hourly_rate_tasks[task].each do |entry|
|
||||||
tr do
|
tr do
|
||||||
td { _form_input_checkbox("time_entries[]", entry.id) }
|
td { _form_input_checkbox("time_entries[]", entry.id) }
|
||||||
td { label entry.start, :for => "time_entries[]_#{entry.id}" }
|
td { label entry.date.to_date,
|
||||||
|
:for => "time_entries[]_#{entry.id}" }
|
||||||
|
td { entry.start }
|
||||||
td { entry.end }
|
td { entry.end }
|
||||||
td { entry.comment }
|
td { entry.comment }
|
||||||
td.right { "%.2fh" % entry.hours_total }
|
td.right { "%.2fh" % entry.hours_total }
|
||||||
|
|
|
@ -57,19 +57,21 @@ ol#menu
|
||||||
padding-bottom: 6px
|
padding-bottom: 6px
|
||||||
background: $light-grey
|
background: $light-grey
|
||||||
|
|
||||||
/* Table layout */
|
/* Table layout */
|
||||||
table
|
table
|
||||||
padding: 3px 0px
|
padding: 3px 0px
|
||||||
border-spacing: 0px 4px
|
border-spacing: 0px 4px
|
||||||
|
|
||||||
col.amount, col.hours, col.hourly_rate
|
col.amount, col.hours, col.hourly_rate
|
||||||
width: 15%
|
width: 10%
|
||||||
col.flag
|
col.flag
|
||||||
width: 3%
|
width: 4%
|
||||||
|
col.date
|
||||||
|
width: 8%
|
||||||
col.start_time, col.end_time
|
col.start_time, col.end_time
|
||||||
width: 15%
|
width: 5%
|
||||||
col.comment
|
col.comment
|
||||||
width: 30%
|
width: 20%
|
||||||
col.task
|
col.task
|
||||||
width: 25%
|
width: 25%
|
||||||
col.name, col.period
|
col.name, col.period
|
||||||
|
@ -78,7 +80,7 @@ table
|
||||||
width: 20%
|
width: 20%
|
||||||
col.address
|
col.address
|
||||||
width: 20%
|
width: 20%
|
||||||
col.email, col.phone, col.date
|
col.email, col.phone
|
||||||
width: 15%
|
width: 15%
|
||||||
col.number
|
col.number
|
||||||
width: 7%
|
width: 7%
|
||||||
|
@ -99,9 +101,11 @@ table
|
||||||
width: 50%
|
width: 50%
|
||||||
|
|
||||||
td
|
td
|
||||||
|
padding: 0px 5px
|
||||||
vertical-align: top
|
vertical-align: top
|
||||||
|
|
||||||
th
|
th
|
||||||
|
padding: 0px 5px
|
||||||
text-align: left
|
text-align: left
|
||||||
background: $dark-grey
|
background: $dark-grey
|
||||||
|
|
||||||
|
@ -113,8 +117,14 @@ table
|
||||||
width: 80px
|
width: 80px
|
||||||
padding-bottom: 5px
|
padding-bottom: 5px
|
||||||
|
|
||||||
|
input
|
||||||
|
width: 100%
|
||||||
|
|
||||||
|
input[type="submit"], input[type="reset"]
|
||||||
|
width: auto
|
||||||
|
|
||||||
/* Form layout */
|
/* Form layout */
|
||||||
form
|
form
|
||||||
ol
|
ol
|
||||||
list-style: none
|
list-style: none
|
||||||
padding: 10px
|
padding: 10px
|
||||||
|
@ -125,8 +135,6 @@ form
|
||||||
margin-right: 10px
|
margin-right: 10px
|
||||||
float: left
|
float: left
|
||||||
|
|
||||||
input, select
|
|
||||||
width: 250px
|
|
||||||
|
|
||||||
ol.radio
|
ol.radio
|
||||||
margin-left: 195px
|
margin-left: 195px
|
||||||
|
@ -141,5 +149,8 @@ form
|
||||||
li
|
li
|
||||||
padding-bottom: 10px
|
padding-bottom: 10px
|
||||||
|
|
||||||
|
input, select
|
||||||
|
width: 250px
|
||||||
|
|
||||||
input[type="submit"], input[type="reset"]
|
input[type="submit"], input[type="reset"]
|
||||||
width: auto
|
width: auto
|
||||||
|
|
Loading…
Reference in New Issue