Skip to content

Commit

Permalink
add test page with rbui components
Browse files Browse the repository at this point in the history
  • Loading branch information
SethHorsley committed Oct 16, 2024
1 parent a145b75 commit 9c6475f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/controllers/static_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class StaticController < ApplicationController
def index
render Static::IndexView.new
end
end
47 changes: 47 additions & 0 deletions app/views/static/index_view.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true

class Static::IndexView < ApplicationView
def template
h1 { "Static index" }
p { "Find me in app/views/static/index_view.rb" }
div(class: "w-96") do
Combobox do
ComboboxInput()
ComboboxTrigger do
ComboboxValue(placeholder: "Select event...")
end
ComboboxContent do
ComboboxSearchInput(placeholder: "Search event...")
ComboboxList do
ComboboxEmpty { "No results found." }
ComboboxGroup(heading: "Suggestions") do
ComboboxItem(value: "railsworld") do
span { "Rails World" }
end
ComboboxItem(value: "tropicalrb") do
span { "Tropical.rb" }
end
ComboboxItem(value: "friendly.rb") do
span { "Friendly.rb" }
end
end

ComboboxSeparator()

ComboboxGroup(heading: "Others") do
ComboboxItem(value: "railsconf") do
span { "RailsConf" }
end
ComboboxItem(value: "euruko") do
span { "Euruko" }
end
ComboboxItem(value: "rubykaigi") do
span { "RubyKaigi" }
end
end
end
end
end
end
end
end
3 changes: 2 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Rails.application.routes.draw do
root "static#index"
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get "up" => "rails/health#show", as: :rails_health_check
get "up" => "rails/health#show", :as => :rails_health_check

# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
Expand Down
8 changes: 8 additions & 0 deletions test/controllers/static_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "test_helper"

class StaticControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get static_index_url
assert_response :success
end
end

0 comments on commit 9c6475f

Please sign in to comment.