class Matestack::Ui::VueJs::Components::IsolatedComponent
Public Class Methods
new(html_tag = nil, text = nil, options = {}, &block)
click to toggle source
Calls superclass method
Matestack::Ui::VueJs::Vue::new
# File lib/matestack/ui/vue_js/components/isolated.rb, line 10 def initialize(html_tag = nil, text = nil, options = {}, &block) extract_options(text, options) only_public_options! isolated_parent = Matestack::Ui::Core::Context.isolated_parent Matestack::Ui::Core::Context.isolated_parent = self super(html_tag, text, options, &block) Matestack::Ui::Core::Context.isolated_parent = isolated_parent end
Public Instance Methods
create_children()
click to toggle source
# File lib/matestack/ui/vue_js/components/isolated.rb, line 19 def create_children # content only should be rendered if param :component_class is present warn "[WARNING] '#{self.class}' was accessed but not authorized" unless authorized? if params[:component_class].present? self.response if authorized? else self.isolated do self.response if authorized? end end end
isolated() { || ... }
click to toggle source
# File lib/matestack/ui/vue_js/components/isolated.rb, line 31 def isolated Matestack::Ui::Core::Base.new(:component, component_attributes) do div class: 'matestack-isolated-component-container', 'v-bind:class': '{ loading: loading === true }' do if self.respond_to? :loading_state_element div class: 'loading-state-element-wrapper', 'v-bind:class': '{ loading: loading === true }' do loading_state_element end end unless ctx.defer || ctx.init_on div class: 'matestack-isolated-component-wrapper', 'v-if': 'isolatedTemplate == null', 'v-bind:class': '{ loading: loading === true }' do div class: 'matestack-isolated-component-root' do yield end end end div class: 'matestack-isolated-component-wrapper', 'v-if': 'isolatedTemplate != null', 'v-bind:class': '{ loading: loading === true }' do div class: 'matestack-isolated-component-root' do Matestack::Ui::Core::Base.new('v-runtime-template', ':template': 'isolatedTemplate') end end end end end
only_public_options!()
click to toggle source
# File lib/matestack/ui/vue_js/components/isolated.rb, line 74 def only_public_options! if self.options.except(:defer, :init_on, :public_options, :rerender_on, :rerender_delay).keys.any? error_message = "isolated components can only take params in a public_options hash, which will be exposed to the client side in order to perform an async request with these params." error_message << " Check your usages of '#{self.class}' components" raise error_message end end
public_options()
click to toggle source
# File lib/matestack/ui/vue_js/components/isolated.rb, line 66 def public_options ctx.public_options || {} end
vue_props()
click to toggle source
# File lib/matestack/ui/vue_js/components/isolated.rb, line 55 def vue_props { component_class: self.class.name, public_options: ctx.public_options, defer: ctx.defer, rerender_on: ctx.rerender_on, rerender_delay: ctx.rerender_delay, init_on: ctx.init_on, } end