Sha256: 26721f009a57db3b29e3b4447b8fae2597e76547dec7825bf42ae0bd0b6dbfc5

Contents?: true

Size: 838 Bytes

Versions: 2

Compression:

Stored size: 838 Bytes

Contents

module PowerResource
  module RenderingHelper
    # Renders collection table
    def render_collection_table(custom_attributes = nil)
      render 'collection',
        collection: collection,
        attributes: custom_attributes || resource_human_attributes,
        collection_table_classes: collection_table_classes,
        collection_table_button_classes: collection_table_button_classes
    end

    # Renders form using selected form builder
    def render_form(form_builder = 'form_for')
      fields = resource_human_attributes
      fields.map! do |arg|
        arg.to_s.sub('_id', '').to_sym
      end
      render "power_resource/builders/#{form_builder}", fields: fields
    end

    # Renders actions for a specific resource
    def render_actions_for(resource)
      render 'actions', resource: resource
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
power_resource-0.0.3 app/helpers/power_resource/rendering_helper.rb
power_resource-0.0.2 app/helpers/power_resource/rendering_helper.rb