Merge pull request #15 from spacemunkay/denney-add-users-roles

Changing UserRole to UserRoleJoin
This commit is contained in:
jnm
2013-05-23 18:03:59 -07:00
18 changed files with 124 additions and 53 deletions
+4 -2
View File
@@ -42,7 +42,10 @@ class AppTabPanel < Netzke::Basepack::TabPanel
wrappedComponent: :transactions_border,
title: "Transactions"},
:logs,
:user_roles]
{ layout: :fit,
wrappedComponent: :user_role_joins,
title: "User Roles"}
]
end
@@app_tab_panel_items.each do |item|
@@ -52,7 +55,6 @@ class AppTabPanel < Netzke::Basepack::TabPanel
self.class.component item[:wrappedComponent]
end
end
c.prevent_header = true
c.tbar = [:sign_out, :check_out]
c.items = @@app_tab_panel_items
+2 -3
View File
@@ -37,7 +37,7 @@ class UserLogs < Netzke::Basepack::Grid
{ :name => :end_date, :hidden => true, :default_value => Time.now.to_formatted_s(:db) },
{ :name => :hours, :getter => lambda { |rec| (rec.end_date - rec.start_date)/3600 }, :sorting_scope => :sort_by_duration},
:description,
{ :name => :user_action__action, :text => 'Action' },
{ :name => :user_action__action, :text => 'Action', :default_value => ::ActsAsLoggable::UserAction.all.first.id },
:created_at,
:updated_at,
{ :name => :logged_by, :getter => lambda{ |rec|
@@ -53,13 +53,12 @@ class UserLogs < Netzke::Basepack::Grid
bike_store = Bike.all.map { |b| [b.id, b.shop_id] }
current_user ||= User.find_by_id(session[:selected_user_id]) || controller.current_user
bike_id = current_user.bike.nil? ? nil : current_user.bike.id
action_id = current_user.user_role.id
[
{ :name => :start_date},
{ :name => :end_date},
{ :name => :description},
#had to hack acts_as_loggable/log.rb to get this to work
{ :name => :user_action__action, :field_label => 'Action', :value => action_id},
{ :name => :user_action__action, :field_label => 'Action'},
{ :name => :for_bike, :checkboxName => :copy_log, :inputValue => true, :title => "Copy description to a Bike's History?", :xtype => 'fieldset', :checkboxToggle => true, :collapsed => true, :items => [
{:xtype => 'combo', :no_binding => true, :name => :copy_id, :title => 'Bike', :fieldLabel => 'Bike', :store => bike_store, :value => bike_id}
]
+21
View File
@@ -0,0 +1,21 @@
class UserRoleJoins < Netzke::Basepack::Grid
def configure(c)
super
c.model = "UserRoleJoin"
c.header = false
c.title = "User Roles"
c.columns = [
{ :name => :user__first_name, :text => "First"},
{ :name => :user__last_name, :text => "Last"},
{ :name => :role__role, :text => "Role"},
:created_at,
:updated_at,
:ends ]
end
#override with nil to remove actions
def default_bbar
[ :apply, :add_in_form, :search ]
end
end
-15
View File
@@ -1,15 +0,0 @@
class UserRoles < Netzke::Basepack::Grid
def configure(c)
super
c.model = "UserRole"
c.title = "User Roles"
c.columns = [ :role, :created_at, :updated_at, :ends ]
end
#override with nil to remove actions
def default_bbar
[ :apply, :add_in_form, :search ]
end
end
-1
View File
@@ -9,7 +9,6 @@ class Users < Netzke::Basepack::Grid
:last_name,
:nickname,
:email,
:user_role__role,
:bike__shop_id
]
end