Class: Plutonium::Definition::Base Abstract
- Inherits:
-
Object
- Object
- Plutonium::Definition::Base
- Includes:
- Actions, ConfigAttr, DefineableProps, IndexViews, InheritableConfigAttr, Metadata, NestedInputs, Scoping, Search, Sorting, StructuredInputs
- Defined in:
- lib/plutonium/definition/base.rb
Overview
Subclass and override #customize_fields, #customize_inputs, #customize_filters, #customize_scopes, and #customize_sorters to implement custom behavior.
This class is not thread-safe. Ensure proper synchronization if used in a multi-threaded environment.
Base class for Plutonium definitions
Direct Known Subclasses
Defined Under Namespace
Classes: Display, EditPage, Form, Grid, IndexPage, InteractiveActionPage, NewPage, QueryForm, ShowPage, Table, TextFilter
Constant Summary collapse
- VALID_MODAL_MODES =
modals — drive how :new / :edit and interactive actions render. Actions read these lazily at render time, so override order and subclass inheritance both work naturally.
[:centered, :slideover, false].freeze
Constants included from IndexViews
IndexViews::GRID_LAYOUTS, IndexViews::GRID_SLOTS, IndexViews::KNOWN_VIEWS
Class Method Summary collapse
-
.modal(mode, size: :md) ⇒ Object
Sets ‘modal_mode` and `modal_size` together with validation.
Instance Method Summary collapse
- #collection_class ⇒ Object
- #detail_class ⇒ Object
- #edit_page_class ⇒ Object
- #form_class ⇒ Object
- #grid_class ⇒ Object
- #index_page_class ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #interactive_action_page_class ⇒ Object
- #new_page_class ⇒ Object
- #query_form ⇒ Object
- #show_page_class ⇒ Object
Methods included from Metadata
Methods included from IndexViews
#default_index_view, #defined_grid_columns, #defined_grid_fields, #defined_grid_layout, #defined_index_views
Methods included from StructuredInputs
Methods included from Search
Methods included from Scoping
Methods included from Sorting
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
119 120 121 |
# File 'lib/plutonium/definition/base.rb', line 119 def initialize super end |
Class Method Details
.modal(mode, size: :md) ⇒ Object
Sets ‘modal_mode` and `modal_size` together with validation.
-
:slideover (default) — slide-in panel from the right
-
:centered — centered dialog
-
false — no modal; new/edit are full standalone pages
‘size:` see Plutonium::UI::Modal::Base::VALID_SIZES. `:auto` hugs the form’s natural width.
107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/plutonium/definition/base.rb', line 107 def self.modal(mode, size: :md) unless VALID_MODAL_MODES.include?(mode) raise ArgumentError, "modal must be one of #{VALID_MODAL_MODES.inspect}, got #{mode.inspect}" end unless Plutonium::UI::Modal::Base::VALID_SIZES.include?(size) raise ArgumentError, "modal size must be one of #{Plutonium::UI::Modal::Base::VALID_SIZES.inspect}, got #{size.inspect}" end modal_mode mode modal_size size end |
Instance Method Details
#collection_class ⇒ Object
147 148 149 |
# File 'lib/plutonium/definition/base.rb', line 147 def collection_class self.class::Table end |
#detail_class ⇒ Object
155 156 157 |
# File 'lib/plutonium/definition/base.rb', line 155 def detail_class self.class::Display end |
#edit_page_class ⇒ Object
135 136 137 |
# File 'lib/plutonium/definition/base.rb', line 135 def edit_page_class self.class::EditPage end |
#form_class ⇒ Object
143 144 145 |
# File 'lib/plutonium/definition/base.rb', line 143 def form_class self.class::Form end |
#grid_class ⇒ Object
151 152 153 |
# File 'lib/plutonium/definition/base.rb', line 151 def grid_class self.class::Grid end |
#index_page_class ⇒ Object
123 124 125 |
# File 'lib/plutonium/definition/base.rb', line 123 def index_page_class self.class::IndexPage end |
#interactive_action_page_class ⇒ Object
139 140 141 |
# File 'lib/plutonium/definition/base.rb', line 139 def interactive_action_page_class self.class::InteractiveActionPage end |
#new_page_class ⇒ Object
127 128 129 |
# File 'lib/plutonium/definition/base.rb', line 127 def new_page_class self.class::NewPage end |
#query_form ⇒ Object
159 160 161 |
# File 'lib/plutonium/definition/base.rb', line 159 def query_form self.class::QueryForm end |
#show_page_class ⇒ Object
131 132 133 |
# File 'lib/plutonium/definition/base.rb', line 131 def show_page_class self.class::ShowPage end |