mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 08:43:23 -05:00
Fixed user profiles and added NOTE action to bike_logs
This commit is contained in:
parent
b11d04a397
commit
c00c8fa3df
@ -11,7 +11,7 @@ class UserLogs < Netzke::Basepack::Grid
|
||||
:logger_id => controller.current_user.id,
|
||||
:copy_type => 'Bike',
|
||||
:copy_action_type => 'ActsAsLoggable::BikeAction',
|
||||
:copy_action_id => 3
|
||||
:copy_action_id => 4
|
||||
}
|
||||
|
||||
#just users
|
||||
|
@ -1,19 +1,27 @@
|
||||
class UserProfiles < Netzke::Basepack::Grid
|
||||
|
||||
def configure(c)
|
||||
super
|
||||
|
||||
if controller.current_user.user?
|
||||
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
|
||||
}
|
||||
else
|
||||
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]
|
||||
}
|
||||
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,
|
||||
|
@ -24,7 +24,10 @@ class UsersAndProfilesBorder < Netzke::Base
|
||||
function(){
|
||||
// calling superclass's initComponent
|
||||
this.callParent();
|
||||
this.getComponent('user_stats').updateStats();
|
||||
var stats = this.getComponent('user_stats');
|
||||
if (stats != undefined){
|
||||
stats.updateStats();
|
||||
}
|
||||
|
||||
// setting the 'rowclick' event
|
||||
var view = this.getComponent('users').getView();
|
||||
|
@ -7,7 +7,7 @@ class User < ActiveRecord::Base
|
||||
|
||||
# Setup accessible (or protected) attributes for your model
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me,
|
||||
:first_name, :last_name, :nickname, :user_role_id
|
||||
:first_name, :last_name, :nickname, :user_role_id, :bike_id
|
||||
|
||||
has_many :user_profiles
|
||||
belongs_to :user_role
|
||||
|
@ -1,6 +1,6 @@
|
||||
class UserProfile < ActiveRecord::Base
|
||||
# Setup accessible (or protected) attributes for your model
|
||||
attr_accessible :bike_id, :addrStreet1, :addrStreet2, :addrCity,
|
||||
attr_accessible :user_id, :addrStreet1, :addrStreet2, :addrCity,
|
||||
:addrState, :addrZip, :phone
|
||||
|
||||
belongs_to :user
|
||||
|
@ -1,15 +1,20 @@
|
||||
acquired:
|
||||
note:
|
||||
id: 1
|
||||
action: NOTE
|
||||
created_at: <%= Time.now %>
|
||||
updated_at: <%= Time.now %>
|
||||
acquired:
|
||||
id: 2
|
||||
action: ACQUIRED
|
||||
created_at: <%= Time.now %>
|
||||
updated_at: <%= Time.now %>
|
||||
scrapped:
|
||||
id: 2
|
||||
id: 3
|
||||
action: SCRAPPED
|
||||
created_at: <%= Time.now %>
|
||||
updated_at: <%= Time.now %>
|
||||
worked:
|
||||
id: 3
|
||||
id: 4
|
||||
action: WORKED
|
||||
created_at: <%= Time.now %>
|
||||
updated_at: <%= Time.now %>
|
||||
@ -19,7 +24,7 @@ completed:
|
||||
created_at: <%= Time.now %>
|
||||
updated_at: <%= Time.now %>
|
||||
sold:
|
||||
id: 5
|
||||
id: 6
|
||||
action: SOLD
|
||||
created_at: <%= Time.now %>
|
||||
updated_at: <%= Time.now %>
|
||||
|
Loading…
x
Reference in New Issue
Block a user