Class: Panda::CMS::Admin::UserActivityComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/panda/cms/admin/user_activity_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model: nil, at: nil, user: nil) ⇒ UserActivityComponent

Returns a new instance of UserActivityComponent.

Parameters:

  • model (ActiveRecord::Base) (defaults to: nil)

    Model instance to which the user activity is related

  • at (ActiveSupport::TimeWithZone) (defaults to: nil)

    Time of the activity

  • user (Panda::Core::User) (defaults to: nil)

    User who performed the activity



12
13
14
15
16
# File 'app/components/panda/cms/admin/user_activity_component.rb', line 12

def initialize(model: nil, at: nil, user: nil)
  @model = model
  @user = user if user.is_a?(::Panda::Core::User)
  @time = at if at.is_a?(::ActiveSupport::TimeWithZone)
end

Instance Attribute Details

#modelObject

Returns the value of attribute model.



7
8
9
# File 'app/components/panda/cms/admin/user_activity_component.rb', line 7

def model
  @model
end

#timeObject

Returns the value of attribute time.



7
8
9
# File 'app/components/panda/cms/admin/user_activity_component.rb', line 7

def time
  @time
end

#userObject

Returns the value of attribute user.



7
8
9
# File 'app/components/panda/cms/admin/user_activity_component.rb', line 7

def user
  @user
end