Sha256: 1060c5d74b62294f0fe15c8ef6ee137ac56d646396d33ea4b67477118d9074d4

Contents?: true

Size: 824 Bytes

Versions: 1

Compression:

Stored size: 824 Bytes

Contents

module Aeternitas
  module WebUi
    module ApplicationHelper
      def rate_ratio(ratio)
        label_type = case ratio
                       when 0.0...0.01
                         "badge badge-success"
                       when 0.01...0.1
                         "badge badge-warning"
                       else
                         "badge badge-danger"
                     end

        content_tag :span, "#{ratio * 100}%", class: label_type
      end

      def pretty_print_attributes(pollable)
        content_tag(:ul, class: "attribute-list") do
          pollable.attributes.map do |key, value|
            content_tag(:li) do
              (content_tag(:strong, "#{key}: ") + content_tag(:em, value)).html_safe
            end
          end.join("\n").html_safe
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aeternitas_web_ui-0.1.0 app/helpers/aeternitas/web_ui/application_helper.rb