Sha256: 9df0267737bfdcd6914b211332af8888a6c6db4b540b523ef4a5fb67ab0af55b

Contents?: true

Size: 425 Bytes

Versions: 19

Compression:

Stored size: 425 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

19 entries across 19 versions & 2 rubygems

Version Path
kuhsaft-2.6.3 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.6.2 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.6.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.5.2 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.6.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.5.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.5.0 app/models/kuhsaft/brick_type_filter.rb
qbrick-2.5.0.pre app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.4.3 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.4.2 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.4.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.4.0 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.3.6 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.3.5 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.3.4 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.3.3 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.3.2 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.3.1 app/models/kuhsaft/brick_type_filter.rb
kuhsaft-2.3.0 app/models/kuhsaft/brick_type_filter.rb