-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add the gem * add user and session resources * add authenticated routes * add admin test and update email domain * update dropdown style
- Loading branch information
1 parent
f6f48da
commit 8f71f83
Showing
22 changed files
with
330 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* from https://x.com/souporserious/status/1746311121949356469?s=20 */ | ||
|
||
* { | ||
box-sizing: border-box; | ||
position: relative; | ||
min-width: 0; | ||
} | ||
|
||
body { | ||
min-height: 100dvh; | ||
} | ||
|
||
h1, | ||
h2, | ||
h3, | ||
h4 { | ||
text-wrap: balance; | ||
} | ||
|
||
p { | ||
text-wrap: pretty; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Avo::Resources::Session < Avo::BaseResource | ||
self.includes = [] | ||
# self.search = { | ||
# query: -> { query.ransack(id_eq: params[:q], m: "or").result(distinct: false) } | ||
# } | ||
|
||
def fields | ||
field :id, as: :id | ||
field :user, as: :belongs_to | ||
field :user_id, as: :number | ||
field :user_agent, as: :text, hide_on: [:index] | ||
field :ip_address, as: :text, hide_on: [:index] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Avo::Resources::User < Avo::BaseResource | ||
self.title = :admin_title | ||
self.includes = [] | ||
self.search = { | ||
query: -> { query.ransack(email_cont: params[:q], id_eq: params[:q], m: "or").result(distinct: true) } | ||
} | ||
|
||
def fields | ||
field :id, as: :id, link_to_record: true | ||
field :email, as: :text, link_to_record: true | ||
field :first_name, as: :text | ||
field :last_name, as: :text | ||
field :admin, as: :boolean, link_to_record: true | ||
field :verified, as: :boolean, hide_on: [:index] | ||
field :sessions, as: :has_many | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This controller has been generated to enable Rails' resource routes. | ||
# More information on https://docs.avohq.io/2.0/controllers.html | ||
class Avo::SessionsController < Avo::ResourcesController | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This controller has been generated to enable Rails' resource routes. | ||
# More information on https://docs.avohq.io/2.0/controllers.html | ||
class Avo::UsersController < Avo::ResourcesController | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# For more information regarding these settings check out our docs https://docs.avohq.io | ||
# The values disaplayed here are the default ones. Uncomment and change them to fit your needs. | ||
Avo.configure do |config| | ||
## == Routing == | ||
config.root_path = "/admin" | ||
# used only when you have custom `map` configuration in your config.ru | ||
# config.prefix_path = "/internal" | ||
|
||
# Sometimes you might want to mount Avo's engines yourself. | ||
# https://docs.avohq.io/3.0/routing.html | ||
# config.mount_avo_engines = true | ||
|
||
# Where should the user be redirected when visiting the `/avo` url | ||
config.home_path = "/admin/resources/users" | ||
|
||
## == Licensing == | ||
# config.license_key = ENV['AVO_LICENSE_KEY'] | ||
|
||
## == Set the context == | ||
config.set_context do | ||
# Return a context object that gets evaluated in Avo::ApplicationController | ||
end | ||
|
||
## == Authentication == | ||
config.current_user_method do | ||
Current.user | ||
end | ||
# config.authenticate_with do | ||
# end | ||
|
||
## == Authorization == | ||
# config.authorization_methods = { | ||
# index: 'index?', | ||
# show: 'show?', | ||
# edit: 'edit?', | ||
# new: 'new?', | ||
# update: 'update?', | ||
# create: 'create?', | ||
# destroy: 'destroy?', | ||
# search: 'search?', | ||
# } | ||
# config.raise_error_on_missing_policy = false | ||
# config.authorization_client = :pundit | ||
|
||
## == Localization == | ||
# config.locale = 'en-US' | ||
|
||
## == Resource options == | ||
# config.resource_controls_placement = :right | ||
# config.model_resource_mapping = {} | ||
# config.default_view_type = :table | ||
# config.per_page = 24 | ||
# config.per_page_steps = [12, 24, 48, 72] | ||
# config.via_per_page = 8 | ||
# config.id_links_to_resource = false | ||
|
||
## == Cache options == | ||
## Provide a lambda to customize the cache store used by Avo. | ||
## We compute the cache store by default, this is NOT the default, just an example. | ||
# config.cache_store = -> { | ||
# ActiveSupport::Cache.lookup_store(:solid_cache_store) | ||
# } | ||
# config.cache_resources_on_index_view = true | ||
## permanent enable or disable cache_resource_filters, default value is false | ||
# config.cache_resource_filters = false | ||
## provide a lambda to enable or disable cache_resource_filters per user/resource. | ||
# config.cache_resource_filters = -> { current_user.cache_resource_filters? } | ||
|
||
## == Logger == | ||
# config.logger = -> { | ||
# file_logger = ActiveSupport::Logger.new(Rails.root.join("log", "avo.log")) | ||
# | ||
# file_logger.datetime_format = "%Y-%m-%d %H:%M:%S" | ||
# file_logger.formatter = proc do |severity, time, progname, msg| | ||
# "[Avo] #{time}: #{msg}\n".tap do |i| | ||
# puts i | ||
# end | ||
# end | ||
# | ||
# file_logger | ||
# } | ||
|
||
## == Customization == | ||
# config.app_name = 'Avocadelicious' | ||
# config.timezone = 'UTC' | ||
# config.currency = 'USD' | ||
# config.hide_layout_when_printing = false | ||
# config.full_width_container = false | ||
# config.full_width_index_view = false | ||
# config.search_debounce = 300 | ||
# config.view_component_path = "app/components" | ||
# config.display_license_request_timeout_error = true | ||
# config.disabled_features = [] | ||
# config.buttons_on_form_footers = true | ||
# config.field_wrapper_layout = true | ||
# config.resource_parent_controller = "Avo::ResourcesController" | ||
|
||
## == Branding == | ||
# config.branding = { | ||
# colors: { | ||
# background: "248 246 242", | ||
# 100 => "#CEE7F8", | ||
# 400 => "#399EE5", | ||
# 500 => "#0886DE", | ||
# 600 => "#066BB2", | ||
# }, | ||
# chart_colors: ["#0B8AE2", "#34C683", "#2AB1EE", "#34C6A8"], | ||
# logo: "/avo-assets/logo.png", | ||
# logomark: "/avo-assets/logomark.png", | ||
# placeholder: "/avo-assets/placeholder.svg", | ||
# favicon: "/avo-assets/favicon.ico" | ||
# } | ||
|
||
## == Breadcrumbs == | ||
# config.display_breadcrumbs = true | ||
# config.set_initial_breadcrumbs do | ||
# add_breadcrumb "Home", '/avo' | ||
# end | ||
|
||
## == Menus == | ||
# config.main_menu = -> { | ||
# section "Dashboards", icon: "dashboards" do | ||
# all_dashboards | ||
# end | ||
|
||
# section "Resources", icon: "resources" do | ||
# all_resources | ||
# end | ||
|
||
# section "Tools", icon: "tools" do | ||
# all_tools | ||
# end | ||
# } | ||
# config.profile_menu = -> { | ||
# link "Profile", path: "/avo/profile", icon: "user-circle" | ||
# } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.