0
0
Fork 0

Redesign admin instances area (#9645)

This commit is contained in:
Eugen Rochko 2019-01-08 13:39:49 +01:00 committed by GitHub
parent 9a38357111
commit 1c6588accc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 159 additions and 531 deletions

View file

@ -3,10 +3,23 @@
class Instance
include ActiveModel::Model
attr_accessor :domain, :accounts_count
attr_accessor :domain, :accounts_count, :domain_block
def initialize(account)
@domain = account.domain
@accounts_count = account.accounts_count
def initialize(resource)
@domain = resource.domain
@accounts_count = resource.accounts_count
@domain_block = resource.is_a?(DomainBlock) ? resource : DomainBlock.find_by(domain: domain)
end
def cached_sample_accounts
Rails.cache.fetch("#{cache_key}/sample_accounts", expires_in: 12.hours) { Account.where(domain: domain).searchable.joins(:account_stat).popular.limit(3) }
end
def to_param
domain
end
def cache_key
domain
end
end