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, :logger_id => controller.current_user.id,
:copy_type => 'Bike', :copy_type => 'Bike',
:copy_action_type => 'ActsAsLoggable::BikeAction', :copy_action_type => 'ActsAsLoggable::BikeAction',
:copy_action_id => 3 :copy_action_id => 4
} }
#just users #just users

8
app/components/user_profiles.rb

@ -1,19 +1,27 @@
class UserProfiles < Netzke::Basepack::Grid class UserProfiles < Netzke::Basepack::Grid
def configure(c) def configure(c)
super super
if controller.current_user.user? if controller.current_user.user?
user_profiles_scope = lambda { |rel| rel.where(:user_id => controller.current_user.id);} user_profiles_scope = lambda { |rel| rel.where(:user_id => controller.current_user.id);}
user_profiles_data_store = { auto_load: true } user_profiles_data_store = { auto_load: true }
user_profile_strong_default_attrs = {
:user_id => controller.current_user.id
}
else else
user_profiles_scope = lambda { |rel| rel.where(:user_id => session[:selected_user_id]);} user_profiles_scope = lambda { |rel| rel.where(:user_id => session[:selected_user_id]);}
user_profiles_data_store = { auto_load: false} user_profiles_data_store = { auto_load: false}
user_profile_strong_default_attrs = {
:user_id => session[:selected_user_id]
}
end end
c.model = "UserProfile" c.model = "UserProfile"
c.title = "Profile" c.title = "Profile"
c.data_store = user_profiles_data_store c.data_store = user_profiles_data_store
c.scope = user_profiles_scope c.scope = user_profiles_scope
c.strong_default_attrs = user_profile_strong_default_attrs
c.columns = [ c.columns = [
:addrStreet1, :addrStreet1,
:addrStreet2, :addrStreet2,

5
app/components/users_and_profiles_border.rb

@ -24,7 +24,10 @@ class UsersAndProfilesBorder < Netzke::Base
function(){ function(){
// calling superclass's initComponent // calling superclass's initComponent
this.callParent(); this.callParent();
this.getComponent('user_stats').updateStats(); var stats = this.getComponent('user_stats');
if (stats != undefined){
stats.updateStats();
}
// setting the 'rowclick' event // setting the 'rowclick' event
var view = this.getComponent('users').getView(); 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 # Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, 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 has_many :user_profiles
belongs_to :user_role belongs_to :user_role

2
app/models/user_profile.rb

@ -1,6 +1,6 @@
class UserProfile < ActiveRecord::Base class UserProfile < ActiveRecord::Base
# Setup accessible (or protected) attributes for your model # 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 :addrState, :addrZip, :phone
belongs_to :user belongs_to :user

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

@ -1,15 +1,20 @@
acquired: note:
id: 1 id: 1
action: NOTE
created_at: <%= Time.now %>
updated_at: <%= Time.now %>
acquired:
id: 2
action: ACQUIRED action: ACQUIRED
created_at: <%= Time.now %> created_at: <%= Time.now %>
updated_at: <%= Time.now %> updated_at: <%= Time.now %>
scrapped: scrapped:
id: 2 id: 3
action: SCRAPPED action: SCRAPPED
created_at: <%= Time.now %> created_at: <%= Time.now %>
updated_at: <%= Time.now %> updated_at: <%= Time.now %>
worked: worked:
id: 3 id: 4
action: WORKED action: WORKED
created_at: <%= Time.now %> created_at: <%= Time.now %>
updated_at: <%= Time.now %> updated_at: <%= Time.now %>
@ -19,7 +24,7 @@ completed:
created_at: <%= Time.now %> created_at: <%= Time.now %>
updated_at: <%= Time.now %> updated_at: <%= Time.now %>
sold: sold:
id: 5 id: 6
action: SOLD action: SOLD
created_at: <%= Time.now %> created_at: <%= Time.now %>
updated_at: <%= Time.now %> updated_at: <%= Time.now %>

Loading…
Cancel
Save