Sha256: bf0cbb804631079490d160ac3f4a04fddd498ba47d599fad856509fa5afeea60

Contents?: true

Size: 427 Bytes

Versions: 44

Compression:

Stored size: 427 Bytes

Contents

module Kuhsaft
  class BrickTypeFilter < SimpleDelegator

    def empty?
      !(respond_to?(:user_can_add_childs?) && user_can_add_childs? && !allowed.empty?)
    end

    def allowed
      if Kuhsaft::BrickType.enabled.count.zero?
        []
      elsif allowed_brick_types.empty?
        Kuhsaft::BrickType.enabled
      else
        Kuhsaft::BrickType.enabled.constrained(allowed_brick_types)
      end
    end

  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
kuhsaft-2.2.6 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.2.5 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.2.4 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.2.3 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.2.2 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.2.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.2.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.1.2 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.1.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.1.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.8.6 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.8.5 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.0.3 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.0.2 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.8.4 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.8.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.0.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.0.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.8.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-1.7.1 app/models/kuhsaft/brick_type_filter.rb