Sha256: 3315aa0aa3fa740603ff71488a8a2549331c9cbdf556caeef5dddfdb2d44273d

Contents?: true

Size: 564 Bytes

Versions: 42

Compression:

Stored size: 564 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module PbStarRating
    class StarRating
      include Playbook::Props

      partial "pb_star_rating/star_rating"

      prop :hide_rating, type: Playbook::Props::Boolean,
                         default: false
      prop :rating, type: Playbook::Props::Numeric,
                    default: 0

      def star_count
        [*1..rating.to_f]
      end

      def star_full
        (rating.to_f % 1).zero?
      end

      def classname
        generate_classname("pb_star_rating_kit")
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
playbook_ui-4.15.0 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.14.0 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.15.1.alpha1 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.13.1 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.13.0 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.12.0 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.11.0 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.11.0.pre.alpha3 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.11.0.pre.alpha.pre.2 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.10.0 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.10.0.pre.alpha1 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.9.0.pre.alpha1 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.9.0 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.8.2 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.8.1 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.7.1 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.7.0 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.6.1 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.6.0 app/pb_kits/playbook/pb_star_rating/star_rating.rb
playbook_ui-4.5.2 app/pb_kits/playbook/pb_star_rating/star_rating.rb