class Pading::Actionview::Tag

Public Class Methods

new(template, params: {}, theme: nil, views_prefix: nil, **options) click to toggle source
# File lib/pading/actionview/tags.rb, line 6
def initialize(template, params: {}, theme: nil, views_prefix: nil, **options)
    @template, @theme, @views_prefix, @options = template, theme, views_prefix, options
    @params = template.params
    # @params in Rails 5 no longer inherits from Hash
    @params = @params.to_unsafe_h if @params.respond_to?(:to_unsafe_h)
    @params = @params.with_indifferent_access
    @params.except!(*PARAM_KEY_BLACKLIST)
    @params.merge! params
end

Public Instance Methods

page_url_for(page) click to toggle source
# File lib/pading/actionview/tags.rb, line 17
def page_url_for(page)
    @template.url_for @params.update(:test_page => page)
end
partial_path() click to toggle source
# File lib/pading/actionview/tags.rb, line 25
def partial_path
    [
        @views_prefix,
        "pading",
        @theme,
        self.class.name.demodulize.underscore
    ].compact.join("/")
end
to_s(locals = {}) click to toggle source
# File lib/pading/actionview/tags.rb, line 21
def to_s(locals = {})
    @template.render partial: partial_path, locals: @options.merge(locals), formats: [:html]
end