mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 08:43:23 -05:00
WIP, got a component enabling/disabling on select.
This commit is contained in:
parent
a3fcdec10c
commit
01d1dcdcf1
@ -30,14 +30,36 @@ class BikeLogs < Netzke::Basepack::Grid
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
=begin
|
||||
#TODO: fix GUI so it actually respects this
|
||||
current_bike = Bike.find_by_id(session[:selected_bike_id])
|
||||
if cannot? :update, current_bike
|
||||
current_bike = Bike.find_by_id(session[:selected_bike_id])
|
||||
if can? :manage, current_bike
|
||||
puts "\n\n\nCAN MANAGE!\n\n\n"
|
||||
c.bbar = default_bbar
|
||||
else
|
||||
puts "\n\n\nCANNNOT MANAGE!\n\n\n"
|
||||
# if you can't update the bike, you can't do anything to the log
|
||||
c.prohibit_update = c.prohibit_create = c.prohibit_delete = true
|
||||
#c.prohibit_update = c.prohibit_create = c.prohibit_delete = true
|
||||
c.bbar = [ :search ]
|
||||
end
|
||||
=end
|
||||
end
|
||||
|
||||
endpoint :set_read_only do |params, this|
|
||||
current_bike = Bike.find_by_id(session[:selected_bike_id])
|
||||
puts "\n\n\nREAD!\n\n\n"
|
||||
if can? :manage, current_bike
|
||||
puts "\n\n\nCAN MANAGE!\n\n\n"
|
||||
#calls this.setDisabled()
|
||||
this.set_disabled(false)
|
||||
#sets the return value of this function
|
||||
#this.netzke_set_result(true)
|
||||
else
|
||||
puts "\n\n\nCANNNOT MANAGE!\n\n\n"
|
||||
#sets the return value of this function
|
||||
#this.netzke_set_result(true)
|
||||
this.set_disabled(true)
|
||||
end
|
||||
end
|
||||
|
||||
def default_fields_for_forms
|
||||
@ -50,13 +72,12 @@ class BikeLogs < Netzke::Basepack::Grid
|
||||
]
|
||||
end
|
||||
|
||||
=begin
|
||||
|
||||
#override with nil to remove actions
|
||||
def default_bbar
|
||||
bbar = [ :search ]
|
||||
bbar.concat [ :apply ] if can? :update, ::ActsAsLoggable::Log
|
||||
bbar.concat [ :add_in_form ] if can? :create, ::ActsAsLoggable::Log
|
||||
bbar.concat [ :apply ] #if can? :update, ::ActsAsLoggable::Log
|
||||
bbar.concat [ :add_in_form ] #if can? :create, ::ActsAsLoggable::Log
|
||||
bbar
|
||||
end
|
||||
=end
|
||||
end
|
||||
|
@ -10,6 +10,11 @@
|
||||
this.selectBike({bike_id: record.get('id')});
|
||||
if( this.queryById('bike_logs') ){
|
||||
this.queryById('bike_logs').getStore().load();
|
||||
this.queryById('bike_logs').setReadOnly({}, function(arg, arg1, arg2){
|
||||
console.log(arg);
|
||||
console.log(this.getDockedItems());
|
||||
});
|
||||
this.queryById('bike_logs').setDisabled(true);
|
||||
}
|
||||
if( this.queryById('tasks') ){
|
||||
this.queryById('tasks').getStore().load();
|
||||
|
@ -21,7 +21,7 @@ class Ability
|
||||
|
||||
def user
|
||||
can :read, :all
|
||||
can :update, Bike, :id => @current_user.bike_id unless @current_user.bike.nil?
|
||||
can :manage, Bike, :id => @current_user.bike_id unless @current_user.bike.nil?
|
||||
can :manage, ::ActsAsLoggable::Log, { :loggable_type => "Bike", :loggable_id => @current_user.bike_id }
|
||||
can :manage, ::ActsAsLoggable::Log, { :loggable_type => "User", :loggable_id => @current_user.id }
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user