Sha256: 7a080238b41a43f75ebdc760d3c55fb5b72e300784aa4c02e84ecbf9d97c8a0a

Contents?: true

Size: 1.51 KB

Versions: 14

Compression:

Stored size: 1.51 KB

Contents

module Tida
  module Renderers
    module ComponentRenderer
      def render_component(options = {})
        render partial: options[:partial], object: options
      end

      def render_page_title(title)
        toolbar = []
        if block_given?
          yield toolbar
        end
        data = {title: title.html_safe, toolbar: toolbar, partial: 'shared/components/page_title'}
        render_component data
      end

      def render_article_title(title, class_name = nil)
        toolbar = []
        if block_given?
          yield toolbar
        end
        data = {title: title.html_safe, class: class_name, toolbar: toolbar, partial: 'shared/components/article_title'}
        render_component data
      end

      def render_modal_window(name, title, inner_partial)
        data = {name: name, title: title, inner_partial: inner_partial, partial: 'shared/components/modal'}
        render_component data
      end

      def render_icon_and_text_content(icon_name, text)
        content = []
        content << content_tag(:i, nil, class: icon_name)
        content << content_tag(:span, text)
        content.join(" ").html_safe
      end

      def render_icon_content(icon_name)
        content_tag(:i, nil, class: icon_name)
      end

      def render_progress_bar(label)
        label_content = content_tag :span, label
        bar_content = content_tag :div, label_content, class: 'bar', style: 'width: 100%;'
        content_tag :div, bar_content, class: 'progress progress-striped active'
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
tida_template-0.3.2 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.3.1 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.3.0 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.2.9 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.2.8 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.2.7 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.2.6 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.2.5 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.2.2 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.2.0 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.1.9 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.1.7 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.1.5 lib/generators/tida_template/templates/renderers/component_renderer.rb
tida_template-0.1.3 lib/generators/tida_template/templates/renderers/component_renderer.rb