Sha256: 881910ce6171280ca325d97b7a31ffed4c297c21093fe7e5d1195efa8ca3cd38

Contents?: true

Size: 1.28 KB

Versions: 26

Compression:

Stored size: 1.28 KB

Contents

module Cmor
  module Testimonials
    class ApplicationViewHelper < Rao::ViewHelper::Base
      def render_category(category_or_identifier, options = {})
        default_variant_options = Cmor::Testimonials::Configuration.image_variant_options[:category]
        options.reverse_merge!(
          autostart:            true,
          interval:             5.0,
          keyboard:             true,
          pause:                :hover,
          ride:                 false,
          wrap:                 true,
          controls:             true,
          indicators:           false,
          variant_options:      default_variant_options,
          font_awesome:         false,
          show_image:           true,
          control_html:         { class: 'text-dark' },
          image_container_html: { class: 'col-12 text-center'},
          text_container_html:  { class: 'col-12 text-center'},
        )
        category = if category_or_identifier.is_a?(Cmor::Testimonials::Category)
          category_or_identifier
        else
          Cmor::Testimonials::Category.where(identifier: category_or_identifier).first
        end

        if category.present? && category.testimonials.published.any?
          render category: category, options: options
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
cmor_testimonials-0.0.44.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.43.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.42.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.41.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.40.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.39.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.38.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.37.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.36.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.35.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.34.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.33.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.32.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.31.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.30.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.29.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.28.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.27.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.26.pre app/view_helpers/cmor/testimonials/application_view_helper.rb
cmor_testimonials-0.0.25.pre app/view_helpers/cmor/testimonials/application_view_helper.rb