Class: SearchResults::SchemaModels
- Inherits:
-
Components::Base
- Object
- Components::Base
- SearchResults::SchemaModels
- Includes:
- Phlex::Rails::Helpers::LinkTo, Phlex::Rails::Helpers::TurboFrameTag
- Defined in:
- app/components/databasium/search_results/schema_models.rb
Instance Method Summary collapse
-
#initialize(models:, pagy:) ⇒ SchemaModels
constructor
A new instance of SchemaModels.
- #view_template ⇒ Object
Constructor Details
#initialize(models:, pagy:) ⇒ SchemaModels
Returns a new instance of SchemaModels.
9 10 11 12 |
# File 'app/components/databasium/search_results/schema_models.rb', line 9 def initialize(models:, pagy:) @models = models @pagy = pagy end |
Instance Method Details
#view_template ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/components/databasium/search_results/schema_models.rb', line 14 def view_template turbo_frame_tag("results") do @models&.each do |model| link_to( databasium.schemas_path(model: model.upcase_first, layers: 0), data: { turbo_frame: "main" }, class: "text-main-text hover:text-hover hover:cursor-pointer flex items-center gap-2 p-1 border-b border-border justify-between" ) do p(class: "max-w-fit overflow-x-auto me-2 scrollbar-thin p-1") do "#{model.upcase_first}" end end end p(class: "text-main-text text-center p-4") { "No models found" } if @models.empty? div(class: "mt-4 flex justify-start") { raw @pagy.series_nav.html_safe } if @pagy end end |