1
0
mirror of https://github.com/fspc/BikeShed-1.git synced 2025-04-04 05:33:22 -04:00
BikeShed-1/app/components/user_profiles.rb
2013-04-11 21:14:27 -04:00

40 lines
1.0 KiB
Ruby

class UserProfiles < Netzke::Basepack::Grid
def configure(c)
super
if can? :manage, UserProfile
user_profiles_scope = lambda { |rel| rel.where(:user_id => session[:selected_user_id]);}
user_profiles_data_store = { auto_load: false}
user_profile_strong_default_attrs = {
:user_id => session[:selected_user_id]
}
else
user_profiles_scope = lambda { |rel| rel.where(:user_id => controller.current_user.id);}
user_profiles_data_store = { auto_load: true }
user_profile_strong_default_attrs = {
:user_id => controller.current_user.id
}
end
c.model = "UserProfile"
c.title = "Profile"
c.data_store = user_profiles_data_store
c.scope = user_profiles_scope
c.strong_default_attrs = user_profile_strong_default_attrs
c.columns = [
:addrStreet1,
:addrStreet2,
:addrCity,
:addrState,
:addrZip,
:phone
]
end
#override with nil to remove actions
def default_bbar
[ :apply, :add_in_form ]
end
end