Class: ErpApp::Widgets::Base
- Inherits:
-
ActionController::Metal
- Object
- ActionController::Metal
- ErpApp::Widgets::Base
- Includes:
- AbstractController, ActionController::DataStreaming, ActionController::RequestForgeryProtection, ActionController::Streaming, Callbacks, Helpers, Layouts, Logger, Rendering, Translation
- Defined in:
- lib/erp_app/widgets/base.rb
Constant Summary collapse
- IGNORED_PARAMS =
%w{action controller uuid widget_name widget_action dynamic_form_id dynamic_form_model_id model_name use_dynamic_form authenticity_token is_html_form commit utf8}
Instance Attribute Summary collapse
-
#div_id ⇒ Object
Returns the value of attribute div_id.
-
#html ⇒ Object
Returns the value of attribute html.
-
#name ⇒ Object
Returns the value of attribute name.
-
#proxy_controller ⇒ Object
Returns the value of attribute proxy_controller.
-
#state_name ⇒ Object
readonly
Returns the value of attribute state_name.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
-
#view ⇒ Object
Returns the value of attribute view.
-
#widget_params ⇒ Object
Returns the value of attribute widget_params.
Class Method Summary collapse
Instance Method Summary collapse
-
#_prefixes ⇒ Object
override default behavior of nesting views by controller namespace.…
-
#initialize(proxy_controller = nil, name = nil, view = nil, uuid = nil, widget_params = nil) ⇒ Base
constructor
A new instance of Base.
- #render(*args) ⇒ Object
- #widget_result_id ⇒ Object
Constructor Details
#initialize(proxy_controller = nil, name = nil, view = nil, uuid = nil, widget_params = nil) ⇒ Base
Returns a new instance of Base.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/erp_app/widgets/base.rb', line 32 def initialize(proxy_controller=nil, name=nil, view=nil, uuid=nil, =nil) ErpApp::Widgets::Base.view_resolver_cache = [] if ErpApp::Widgets::Base.view_resolver_cache.nil? self.name = name self.proxy_controller = proxy_controller self.view = view self.uuid = uuid self. = add_view_paths merge_params end |
Instance Attribute Details
#div_id ⇒ Object
Returns the value of attribute div_id.
29 30 31 |
# File 'lib/erp_app/widgets/base.rb', line 29 def div_id @div_id end |
#html ⇒ Object
Returns the value of attribute html.
29 30 31 |
# File 'lib/erp_app/widgets/base.rb', line 29 def html @html end |
#name ⇒ Object
Returns the value of attribute name.
29 30 31 |
# File 'lib/erp_app/widgets/base.rb', line 29 def name @name end |
#proxy_controller ⇒ Object
Returns the value of attribute proxy_controller.
29 30 31 |
# File 'lib/erp_app/widgets/base.rb', line 29 def proxy_controller @proxy_controller end |
#state_name ⇒ Object (readonly)
Returns the value of attribute state_name.
28 29 30 |
# File 'lib/erp_app/widgets/base.rb', line 28 def state_name @state_name end |
#uuid ⇒ Object
Returns the value of attribute uuid.
29 30 31 |
# File 'lib/erp_app/widgets/base.rb', line 29 def uuid @uuid end |
#view ⇒ Object
Returns the value of attribute view.
29 30 31 |
# File 'lib/erp_app/widgets/base.rb', line 29 def view @view end |
#widget_params ⇒ Object
Returns the value of attribute widget_params.
29 30 31 |
# File 'lib/erp_app/widgets/base.rb', line 29 def @widget_params end |
Class Method Details
.installed_widgets ⇒ Object
138 139 140 |
# File 'lib/erp_app/widgets/base.rb', line 138 def self. end |
.render_template(view, locals = {}) ⇒ Object
126 127 128 129 130 131 132 |
# File 'lib/erp_app/widgets/base.rb', line 126 def render_template(view, locals={}) = Rails.application.config.erp_app..find{|item| item[:name] == self.} paths = [:view_paths] paths.reverse! ActionView::Base.new(paths).render(:template => view, :locals => locals) end |
.widget_name ⇒ Object
134 135 136 |
# File 'lib/erp_app/widgets/base.rb', line 134 def File.basename(File.dirname(__FILE__)) end |
Instance Method Details
#_prefixes ⇒ Object
override default behavior of nesting views by controller namespace.… The prefixes used in render “foo” shortcuts.
46 47 48 |
# File 'lib/erp_app/widgets/base.rb', line 46 def _prefixes @_prefixes ||= [] end |
#render(*args) ⇒ Object
54 55 56 |
# File 'lib/erp_app/widgets/base.rb', line 54 def render(*args) render_view_for(self.action_name, *args) end |
#widget_result_id ⇒ Object
50 51 52 |
# File 'lib/erp_app/widgets/base.rb', line 50 def "#{self.uuid}_result" end |