Browse Source

Fixed user profiles and added NOTE action to bike_logs

denney-disable-on-select
Jason Denney 12 years ago
parent
commit
c00c8fa3df
  1. 2
      app/components/user_logs.rb
  2. 8
      app/components/user_profiles.rb
  3. 5
      app/components/users_and_profiles_border.rb
  4. 2
      app/models/user.rb
  5. 2
      app/models/user_profile.rb
  6. 13
      db/seed/fixtures/acts_as_loggable/bike_actions.yml

2
app/components/user_logs.rb

@ -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

8
app/components/user_profiles.rb

@ -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,

5
app/components/users_and_profiles_border.rb

@ -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();

2
app/models/user.rb

@ -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

2
app/models/user_profile.rb

@ -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

13
db/seed/fixtures/acts_as_loggable/bike_actions.yml

@ -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…
Cancel
Save