mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 08:43:23 -05:00
Added default times to log forms
This commit is contained in:
parent
4ebcbca081
commit
39246da893
@ -1,4 +1,6 @@
|
|||||||
class BikeLogs < Netzke::Basepack::Grid
|
class BikeLogs < Netzke::Basepack::Grid
|
||||||
|
|
||||||
|
|
||||||
def configure(c)
|
def configure(c)
|
||||||
super
|
super
|
||||||
|
|
||||||
@ -13,10 +15,11 @@ class BikeLogs < Netzke::Basepack::Grid
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.columns = [
|
c.columns = [
|
||||||
{ :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165 },
|
{ :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165, :default_value => Time.now.to_formatted_s(:db) },
|
||||||
|
{ :name => :end_date, :hidden => true, :default_value => Time.now.to_formatted_s(:db) },
|
||||||
{ :name => :hours, :getter => lambda { |rec| (rec.end_date - rec.start_date)/3600 }, :sorting_scope => :sort_by_duration},
|
{ :name => :hours, :getter => lambda { |rec| (rec.end_date - rec.start_date)/3600 }, :sorting_scope => :sort_by_duration},
|
||||||
:description,
|
:description,
|
||||||
{ :name => :bike_action__action},
|
{ :name => :bike_action__action, :text => 'Action'},
|
||||||
{ :name => :created_at, :read_only => true},
|
{ :name => :created_at, :read_only => true},
|
||||||
{ :name => :updated_at, :read_only => true}
|
{ :name => :updated_at, :read_only => true}
|
||||||
]
|
]
|
||||||
@ -25,10 +28,10 @@ class BikeLogs < Netzke::Basepack::Grid
|
|||||||
|
|
||||||
def default_fields_for_forms
|
def default_fields_for_forms
|
||||||
[
|
[
|
||||||
:start_date,
|
{ :name => :start_date},
|
||||||
{ :name => :end_date, :xtype => 'datetime', :value => Time.now.to_s },
|
{ :name => :end_date},
|
||||||
:description,
|
:description,
|
||||||
{ :name => :bike_action__action}
|
{ :name => :bike_action__action, :field_label => 'Action'}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
class UserLogs < Netzke::Basepack::Grid
|
class UserLogs < Netzke::Basepack::Grid
|
||||||
|
|
||||||
def configure(c)
|
def configure(c)
|
||||||
super
|
super
|
||||||
|
|
||||||
@ -12,10 +13,11 @@ class UserLogs < Netzke::Basepack::Grid
|
|||||||
:log_action_type => 'ActsAsLoggable::UserAction'
|
:log_action_type => 'ActsAsLoggable::UserAction'
|
||||||
}
|
}
|
||||||
c.columns = [
|
c.columns = [
|
||||||
{ :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165 },
|
{ :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165, :default_value => Time.now.to_formatted_s(:db) },
|
||||||
|
{ :name => :end_date, :hidden => true, :default_value => Time.now.to_formatted_s(:db) },
|
||||||
{ :name => :hours, :getter => lambda { |rec| (rec.end_date - rec.start_date)/3600 }, :sorting_scope => :sort_by_duration},
|
{ :name => :hours, :getter => lambda { |rec| (rec.end_date - rec.start_date)/3600 }, :sorting_scope => :sort_by_duration},
|
||||||
:description,
|
:description,
|
||||||
{ :name => :user_action__action },
|
{ :name => :user_action__action, :text => 'Action' },
|
||||||
:created_at,
|
:created_at,
|
||||||
:updated_at
|
:updated_at
|
||||||
]
|
]
|
||||||
@ -23,10 +25,10 @@ class UserLogs < Netzke::Basepack::Grid
|
|||||||
|
|
||||||
def default_fields_for_forms
|
def default_fields_for_forms
|
||||||
[
|
[
|
||||||
:start_date,
|
{ :name => :start_date},
|
||||||
:end_date,
|
{ :name => :end_date},
|
||||||
:description,
|
:description,
|
||||||
{ :name => :user_action__action}
|
{ :name => :user_action__action, :field_label => 'Action'}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user