plutonium 0.15.5 → 0.15.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/plutonium.css +1 -1
- data/app/assets/plutonium.ico +0 -0
- data/app/assets/plutonium.js +25 -11
- data/app/assets/plutonium.js.map +2 -2
- data/app/assets/plutonium.min.js +4 -4
- data/app/assets/plutonium.min.js.map +3 -3
- data/app/assets/plutonium.png +0 -0
- data/app/views/layouts/rodauth.html.erb +2 -2
- data/docs/.vitepress/config.ts +61 -0
- data/docs/.vitepress/theme/custom.css +61 -0
- data/docs/.vitepress/theme/index.ts +4 -0
- data/docs/api-examples.md +49 -0
- data/docs/guide/getting-started/authorization.md +296 -0
- data/docs/guide/getting-started/core-concepts.md +432 -0
- data/docs/guide/getting-started/index.md +18 -0
- data/docs/guide/getting-started/installation.md +270 -0
- data/docs/guide/getting-started/resources.md +250 -0
- data/docs/guide/what-is-plutonium.md +211 -0
- data/docs/index.md +43 -0
- data/docs/markdown-examples.md +85 -0
- data/docs/public/android-chrome-192x192.png +0 -0
- data/docs/public/android-chrome-512x512.png +0 -0
- data/docs/public/apple-touch-icon.png +0 -0
- data/docs/public/favicon-16x16.png +0 -0
- data/docs/public/favicon-32x32.png +0 -0
- data/docs/public/favicon.ico +0 -0
- data/docs/public/plutonium.png +0 -0
- data/docs/public/site.webmanifest +1 -0
- data/docs/public/templates/plutonium.rb +29 -0
- data/lib/generators/pu/core/assets/assets_generator.rb +2 -3
- data/lib/generators/pu/core/assets/templates/tailwind.config.js +2 -2
- data/lib/generators/pu/core/install/install_generator.rb +9 -1
- data/lib/generators/pu/core/install/templates/config/initializers/plutonium.rb +0 -1
- data/lib/generators/pu/eject/layout/layout_generator.rb +3 -3
- data/lib/generators/pu/eject/shell/shell_generator.rb +3 -3
- data/lib/generators/pu/gem/dotenv/dotenv_generator.rb +1 -1
- data/lib/generators/pu/gem/letter_opener/letter_opener_generator.rb +21 -0
- data/lib/generators/pu/gem/redis/redis_generator.rb +0 -2
- data/lib/generators/pu/gem/standard/standard_generator.rb +19 -0
- data/lib/generators/pu/lib/plutonium_generators/generator.rb +1 -1
- data/lib/generators/pu/res/conn/conn_generator.rb +1 -1
- data/lib/plutonium/core/controllers/authorizable.rb +1 -1
- data/lib/plutonium/definition/actions.rb +6 -2
- data/lib/plutonium/definition/base.rb +1 -0
- data/lib/plutonium/definition/nested_inputs.rb +19 -0
- data/lib/plutonium/railtie.rb +0 -10
- data/lib/plutonium/resource/controller.rb +1 -1
- data/lib/plutonium/resource/controllers/crud_actions.rb +1 -1
- data/lib/plutonium/resource/controllers/interactive_actions.rb +1 -1
- data/lib/plutonium/resource/controllers/presentable.rb +1 -5
- data/lib/plutonium/resource/policy.rb +4 -5
- data/lib/plutonium/resource/register.rb +3 -0
- data/lib/plutonium/ui/action_button.rb +34 -19
- data/lib/plutonium/ui/block.rb +13 -0
- data/lib/plutonium/ui/component/kit.rb +10 -0
- data/lib/plutonium/ui/display/resource.rb +29 -11
- data/lib/plutonium/ui/display/theme.rb +1 -1
- data/lib/plutonium/ui/dyna_frame/content.rb +2 -2
- data/lib/plutonium/ui/dyna_frame/host.rb +20 -0
- data/lib/plutonium/ui/form/concerns/renders_nested_resource_fields.rb +282 -0
- data/lib/plutonium/ui/form/resource.rb +40 -29
- data/lib/plutonium/ui/form/theme.rb +1 -1
- data/lib/plutonium/ui/frame_navigator_panel.rb +53 -0
- data/lib/plutonium/ui/panel.rb +63 -0
- data/lib/plutonium/ui/skeleton_table.rb +29 -0
- data/lib/plutonium/ui/table/components/search_bar.rb +1 -1
- data/lib/plutonium/ui/table/resource.rb +1 -1
- data/lib/plutonium/version.rb +1 -1
- data/package-lock.json +5767 -1851
- data/package.json +10 -4
- data/src/js/controllers/frame_navigator_controller.js +25 -8
- data/src/js/controllers/nested_resource_form_fields_controller.js +2 -2
- data/src/js/core.js +0 -1
- data/tailwind.options.js +89 -11
- metadata +36 -12
- data/app/assets/plutonium-original.png +0 -0
- data/app/assets/plutonium-white.png +0 -0
- data/lib/generators/pu/gem/redis/templates/.keep +0 -0
- data/public/plutonium-assets/fonts/bootstrap-icons.woff +0 -0
- data/public/plutonium-assets/fonts/bootstrap-icons.woff2 +0 -0
- /data/{templates → docs/public/templates}/base.rb +0 -0
@@ -0,0 +1,250 @@
|
|
1
|
+
# Working with Resources
|
2
|
+
|
3
|
+
::: tip What you'll learn
|
4
|
+
- How to create and manage resources in Plutonium
|
5
|
+
- Understanding resource definitions and configurations
|
6
|
+
- Working with fields, associations, and nested resources
|
7
|
+
- Implementing resource policies and scoping
|
8
|
+
- Best practices for resource organization
|
9
|
+
:::
|
10
|
+
|
11
|
+
## Introduction
|
12
|
+
|
13
|
+
Resources are the core building blocks of a Plutonium application. A resource represents a model in your application that can be managed through a consistent interface, complete with views, controllers, and policies.
|
14
|
+
|
15
|
+
## Creating a Resource
|
16
|
+
|
17
|
+
The fastest way to create a resource is using the scaffold generator:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
rails generate pu:res:scaffold Blog user:belongs_to \
|
21
|
+
title:string content:text 'published_at:datetime?'
|
22
|
+
```
|
23
|
+
|
24
|
+
This generates several files, including:
|
25
|
+
|
26
|
+
::: code-group
|
27
|
+
```ruby [app/models/blog.rb]
|
28
|
+
class Blog < ResourceRecord
|
29
|
+
belongs_to :user
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
```ruby [app/policies/blog_policy.rb]
|
34
|
+
class BlogPolicy < Plutonium::Resource::Policy
|
35
|
+
def create?
|
36
|
+
true
|
37
|
+
end
|
38
|
+
|
39
|
+
def read?
|
40
|
+
true
|
41
|
+
end
|
42
|
+
|
43
|
+
def permitted_attributes_for_create
|
44
|
+
%i[user title content published_at]
|
45
|
+
end
|
46
|
+
|
47
|
+
def permitted_attributes_for_read
|
48
|
+
%i[user title content published_at]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
```ruby [app/definitions/blog_definition.rb]
|
54
|
+
class BlogDefinition < Plutonium::Resource::Definition
|
55
|
+
end
|
56
|
+
```
|
57
|
+
:::
|
58
|
+
|
59
|
+
## Resource Definitions
|
60
|
+
|
61
|
+
Resource definitions customize how a resource behaves in your application. They define:
|
62
|
+
- Fields and their types
|
63
|
+
- Available actions
|
64
|
+
- Search and filtering capabilities
|
65
|
+
- Sorting options
|
66
|
+
- Display configurations
|
67
|
+
|
68
|
+
### Basic Field Configuration
|
69
|
+
|
70
|
+
::: code-group
|
71
|
+
```ruby [Simple Fields]
|
72
|
+
class BlogDefinition < Plutonium::Resource::Definition
|
73
|
+
# Basic field definitions
|
74
|
+
field :content, as: :text
|
75
|
+
|
76
|
+
# Field with custom display options
|
77
|
+
field :published_at,
|
78
|
+
as: :datetime,
|
79
|
+
hint: "When this post should be published"
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
```ruby [Custom Displays]
|
84
|
+
class BlogDefinition < Plutonium::Resource::Definition
|
85
|
+
# Customize how fields are displayed
|
86
|
+
display :title, class: "col-span-full"
|
87
|
+
display :content, class: "col-span-full" do |f|
|
88
|
+
f.text_tag class: "prose dark:prose-invert"
|
89
|
+
end
|
90
|
+
|
91
|
+
# Custom column display in tables
|
92
|
+
column :published_at, align: :end
|
93
|
+
end
|
94
|
+
```
|
95
|
+
:::
|
96
|
+
|
97
|
+
<!--
|
98
|
+
### Working with Associations
|
99
|
+
|
100
|
+
Plutonium makes it easy to work with Rails associations:
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
class BlogDefinition < Plutonium::Resource::Definition
|
104
|
+
# Define belongs_to association
|
105
|
+
field :user, as: :belongs_to
|
106
|
+
|
107
|
+
# Has-many association with inline creation
|
108
|
+
field :comments do |f|
|
109
|
+
f.has_many_tag nested: true
|
110
|
+
end
|
111
|
+
|
112
|
+
# Configure nested attributes
|
113
|
+
define_nested_input :comments,
|
114
|
+
inputs: %i[content user],
|
115
|
+
limit: 3 do |input|
|
116
|
+
input.define_field_input :content,
|
117
|
+
type: :text,
|
118
|
+
hint: "Keep it constructive"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
```
|
122
|
+
-->
|
123
|
+
|
124
|
+
### Adding Custom Actions
|
125
|
+
|
126
|
+
Beyond CRUD, you can add custom actions to your resources:
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
# app/interactions/blogs/publish.rb
|
130
|
+
module Blogs
|
131
|
+
class Publish < Plutonium::Resource::Interaction
|
132
|
+
# Define what this interaction accepts
|
133
|
+
attribute :resource, class: Blog
|
134
|
+
attribute :publish_date, :date, default: -> { Time.current }
|
135
|
+
|
136
|
+
presents label: "Publish Blog",
|
137
|
+
icon: Phlex::TablerIcons::Send,
|
138
|
+
description: "Make this blog post public"
|
139
|
+
|
140
|
+
private
|
141
|
+
|
142
|
+
def execute
|
143
|
+
if resource.update(
|
144
|
+
published_at: publish_date
|
145
|
+
)
|
146
|
+
succeed(resource)
|
147
|
+
.with_message("Blog post published successfully")
|
148
|
+
.with_redirect_response(resource)
|
149
|
+
else
|
150
|
+
failed(resource.errors)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
# app/definitions/blog_definition.rb
|
157
|
+
class BlogDefinition < Plutonium::Resource::Definition
|
158
|
+
# Register the custom action
|
159
|
+
action :publish,
|
160
|
+
interaction: Blogs::Publish,
|
161
|
+
category: :primary
|
162
|
+
end
|
163
|
+
```
|
164
|
+
|
165
|
+
### Search and Filtering
|
166
|
+
|
167
|
+
Add search and filtering capabilities to your resources:
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
class BlogDefinition < Plutonium::Resource::Definition
|
171
|
+
# Enable full-text search
|
172
|
+
search do |scope, query|
|
173
|
+
scope.where("title ILIKE ? OR content ILIKE ?",
|
174
|
+
"%#{query}%", "%#{query}%")
|
175
|
+
end
|
176
|
+
|
177
|
+
# Add filters
|
178
|
+
filter :published_at,
|
179
|
+
with: DateFilter,
|
180
|
+
predicate: :gteq
|
181
|
+
|
182
|
+
# Add scopes
|
183
|
+
scope :published do |scope|
|
184
|
+
scope.where.not(published_at: nil)
|
185
|
+
end
|
186
|
+
scope :draft do |scope|
|
187
|
+
scope.where(published_at: nil)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Configure sorting
|
191
|
+
sort :title
|
192
|
+
sort :published_at
|
193
|
+
end
|
194
|
+
```
|
195
|
+
|
196
|
+
## Resource Policies
|
197
|
+
|
198
|
+
Policies control access to your resources:
|
199
|
+
|
200
|
+
```ruby
|
201
|
+
class BlogPolicy < Plutonium::Resource::Policy
|
202
|
+
def permitted_attributes_for_create
|
203
|
+
%i[title content state published_at user_id]
|
204
|
+
end
|
205
|
+
|
206
|
+
def permitted_associations
|
207
|
+
%i[comments]
|
208
|
+
end
|
209
|
+
|
210
|
+
def create?
|
211
|
+
# Allow logged in users to create blogs
|
212
|
+
user.present?
|
213
|
+
end
|
214
|
+
|
215
|
+
def update?
|
216
|
+
# Users can only edit their own blogs
|
217
|
+
record.user_id == user.id
|
218
|
+
end
|
219
|
+
|
220
|
+
def publish?
|
221
|
+
# Only editors can publish
|
222
|
+
user.editor? && record.draft?
|
223
|
+
end
|
224
|
+
|
225
|
+
# Scope visible records
|
226
|
+
relation_scope do |relation|
|
227
|
+
relation = super(relation)
|
228
|
+
next relation unless user.admin?
|
229
|
+
|
230
|
+
relation.with_deleted
|
231
|
+
end
|
232
|
+
end
|
233
|
+
```
|
234
|
+
|
235
|
+
## Best Practices
|
236
|
+
|
237
|
+
::: tip Resource Organization
|
238
|
+
1. Keep resource definitions focused and cohesive
|
239
|
+
2. Use packages to organize related resources
|
240
|
+
3. Leverage policy scopes for authorization
|
241
|
+
4. Extract complex logic into interactions
|
242
|
+
5. Use presenters for view-specific logic
|
243
|
+
:::
|
244
|
+
|
245
|
+
::: warning Common Pitfalls
|
246
|
+
- Avoid putting business logic in definitions
|
247
|
+
- Don't bypass policy checks
|
248
|
+
- Remember to scope resources appropriately
|
249
|
+
- Test your interactions and policies
|
250
|
+
:::
|
@@ -0,0 +1,211 @@
|
|
1
|
+
# What is Plutonium?
|
2
|
+
|
3
|
+
Plutonium is a Rapid Application Development (RAD) toolkit that extends Rails with powerful conventions, patterns, and tools to accelerate application development while maintaining flexibility and maintainability.
|
4
|
+
|
5
|
+
It acts as a higher-level abstraction on top of Rails, providing ready-to-use solutions for common application needs while preserving Rails' elegance.
|
6
|
+
|
7
|
+
## Core Architecture
|
8
|
+
|
9
|
+
### Rails-Native Design
|
10
|
+
|
11
|
+
Plutonium integrates seamlessly with Rails, extending its conventions rather than replacing them:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
# Plutonium controllers inherit from your ApplicationController
|
15
|
+
class ResourceController < ApplicationController
|
16
|
+
include Plutonium::Resource::Controller
|
17
|
+
end
|
18
|
+
|
19
|
+
# Plutonium controllers are Rails controllers
|
20
|
+
class ProductsController < ResourceController
|
21
|
+
# Enhanced with resource capabilities
|
22
|
+
def custom_action
|
23
|
+
# Regular Rails code works just fine
|
24
|
+
respond_to do |format|
|
25
|
+
format.html
|
26
|
+
format.json
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
### Resource-Oriented Architecture
|
33
|
+
|
34
|
+
Resources are the building blocks of Plutonium applications:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
class ProductDefinition < ResourceDefinition
|
38
|
+
# Declarative field definitions
|
39
|
+
field :name, as: :string
|
40
|
+
field :description, as: :markdown
|
41
|
+
field :price_cents, as: :money
|
42
|
+
|
43
|
+
# Resource-level search
|
44
|
+
search do |scope, query|
|
45
|
+
scope.where("name LIKE ?", "%#{query}%")
|
46
|
+
end
|
47
|
+
|
48
|
+
# Business actions
|
49
|
+
action :publish, interaction: PublishProduct
|
50
|
+
action :archive, interaction: ArchiveProduct
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
### Modular by Design
|
55
|
+
|
56
|
+
Plutonium's packaging system helps organize code into focused, reusable modules:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
# Generate different types of packages
|
60
|
+
rails generate pu:pkg:portal admin
|
61
|
+
rails generate pu:pkg:package inventory
|
62
|
+
|
63
|
+
# Packages are isolated and focused
|
64
|
+
module AdminPortal
|
65
|
+
class Engine < Rails::Engine
|
66
|
+
include Plutonium::Portal::Engine
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
AdminPortal::Engine.routes.draw do
|
71
|
+
register_resource ::Product
|
72
|
+
end
|
73
|
+
```
|
74
|
+
|
75
|
+
### Progressive Enhancement
|
76
|
+
|
77
|
+
Built on modern web technologies like Hotwire, delivering rich interactivity without sacrificing simplicity:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
class PublishProduct < ResourceInteraction
|
81
|
+
attribute :schedule_for, :datetime
|
82
|
+
attribute :notify_users, :boolean
|
83
|
+
|
84
|
+
def execute
|
85
|
+
resource.publish!(schedule_for:)
|
86
|
+
notify_users! if notify_users
|
87
|
+
|
88
|
+
success(resource)
|
89
|
+
.with_message("Product scheduled for publishing")
|
90
|
+
.with_render_response(NotificationComponent.new)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
95
|
+
## Use Cases
|
96
|
+
|
97
|
+
### Business Applications
|
98
|
+
|
99
|
+
::: details Enterprise Resource Planning (ERP)
|
100
|
+
```ruby
|
101
|
+
class InvoiceDefinition < ResourceDefinition
|
102
|
+
# Rich field handling
|
103
|
+
field :line_items, as: :nested, limit: 20
|
104
|
+
field :attachments, as: :document, multiple: true
|
105
|
+
|
106
|
+
# Business actions
|
107
|
+
action :submit_for_approval, interaction: SubmitForApproval
|
108
|
+
action :approve, interaction: ApproveInvoice
|
109
|
+
action :reject, interaction: RejectInvoice
|
110
|
+
|
111
|
+
# Workflow states
|
112
|
+
scope :draft
|
113
|
+
scope :pending_approval
|
114
|
+
scope :approved
|
115
|
+
end
|
116
|
+
```
|
117
|
+
:::
|
118
|
+
|
119
|
+
::: details Multi-tenant SaaS
|
120
|
+
```ruby
|
121
|
+
module CustomerPortal
|
122
|
+
class Engine < Rails::Engine
|
123
|
+
include Plutonium::Package::Engine
|
124
|
+
# Automatic tenant isolation
|
125
|
+
scope_to_entity Organization
|
126
|
+
end
|
127
|
+
end
|
128
|
+
```
|
129
|
+
:::
|
130
|
+
|
131
|
+
### Administrative Systems
|
132
|
+
|
133
|
+
::: details Back-office Applications
|
134
|
+
```ruby
|
135
|
+
class OrderDefinition < ResourceDefinition
|
136
|
+
# Advanced filtering
|
137
|
+
filter :status, with: SelectFilter, choices: Order.statuses
|
138
|
+
filter :created_at, with: DateRangeFilter
|
139
|
+
|
140
|
+
# Bulk actions
|
141
|
+
action :process_batch, interaction: ProcessPendingOrders
|
142
|
+
action :export_to_csv, interaction: ExportOrders
|
143
|
+
|
144
|
+
# Complex displays
|
145
|
+
display :summary do |field|
|
146
|
+
OrderSummaryComponent.new(field)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
```
|
150
|
+
:::
|
151
|
+
|
152
|
+
::: details Content Management
|
153
|
+
```ruby
|
154
|
+
class ArticleDefinition < ResourceDefinition
|
155
|
+
field :content, as: :markdown
|
156
|
+
field :featured_image, as: :image
|
157
|
+
|
158
|
+
# Publishing workflow
|
159
|
+
action :publish, interaction: PublishArticle
|
160
|
+
action :schedule, interaction: ScheduleArticle
|
161
|
+
|
162
|
+
# Content organization
|
163
|
+
scope :draft
|
164
|
+
scope :published
|
165
|
+
scope :scheduled
|
166
|
+
end
|
167
|
+
```
|
168
|
+
:::
|
169
|
+
|
170
|
+
## Key Benefits
|
171
|
+
|
172
|
+
### Accelerated Development
|
173
|
+
- Pre-built components for common functionality
|
174
|
+
- Smart generators for boilerplate code
|
175
|
+
- Convention-based resource handling
|
176
|
+
- Integrated authentication and authorization
|
177
|
+
|
178
|
+
### Maintainable Architecture
|
179
|
+
- Clear separation of concerns through packages
|
180
|
+
- Consistent patterns across the application
|
181
|
+
- Deep Rails integration
|
182
|
+
- Progressive enhancement
|
183
|
+
|
184
|
+
### Enterprise Ready
|
185
|
+
- Flexible and robust access control
|
186
|
+
- Multi-tenancy support
|
187
|
+
- Extensible component system
|
188
|
+
- Mobile-friendly by default
|
189
|
+
|
190
|
+
## Best For
|
191
|
+
|
192
|
+
::: tip IDEAL USE CASES
|
193
|
+
- Complex business applications
|
194
|
+
- Multi-tenant SaaS platforms
|
195
|
+
- Administrative systems
|
196
|
+
- Content management systems
|
197
|
+
- Resource management systems
|
198
|
+
:::
|
199
|
+
|
200
|
+
::: warning MIGHT NOT BE THE BEST FIT
|
201
|
+
- Simple blogs or brochure sites
|
202
|
+
- Basic CRUD applications
|
203
|
+
- Pure API-only services
|
204
|
+
:::
|
205
|
+
|
206
|
+
## Prerequisites
|
207
|
+
|
208
|
+
- Ruby 3.2.2 or higher
|
209
|
+
- Rails 7.1 or higher
|
210
|
+
- Node.js and Yarn
|
211
|
+
- Basic understanding of Ruby on Rails
|
data/docs/index.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
# https://vitepress.dev/reference/default-theme-home-page
|
3
|
+
layout: home
|
4
|
+
|
5
|
+
hero:
|
6
|
+
name: Plutonium RADKit
|
7
|
+
tagline: The Ultimate Rapid Application Development Toolkit (RADKit) for Rails
|
8
|
+
image:
|
9
|
+
src: /plutonium.png
|
10
|
+
alt: Plutonium
|
11
|
+
actions:
|
12
|
+
- theme: brand
|
13
|
+
text: Get started
|
14
|
+
link: /guide/getting-started/
|
15
|
+
- theme: alt
|
16
|
+
text: Learn more
|
17
|
+
link: /guide/what-is-plutonium
|
18
|
+
|
19
|
+
features:
|
20
|
+
- title: Pro-Grade CRUD UI
|
21
|
+
details: Stunning, modern interface with rich field types to build powerful admin panels in minutes
|
22
|
+
|
23
|
+
- title: Intelligent Fields
|
24
|
+
details: Zero-config field detection that matches your Rails models out of the box
|
25
|
+
|
26
|
+
- title: Seamless Authentication
|
27
|
+
details: Use your existing auth or our Rodauth integration - get setup in seconds
|
28
|
+
|
29
|
+
- title: Enterprise Authorization
|
30
|
+
details: Industrial-strength access control powered by Action Policy's proven framework
|
31
|
+
|
32
|
+
- title: Built-in Multitenancy
|
33
|
+
details: Row-level multitenancy that just works - perfect for SaaS and enterprise apps
|
34
|
+
|
35
|
+
- title: Advanced Nested Resources
|
36
|
+
details: Complex resource relationships made simple with zero extra configuration
|
37
|
+
|
38
|
+
- title: Custom Actions
|
39
|
+
details: Extend your admin panel with incredibly simple custom actions and workflows
|
40
|
+
|
41
|
+
- title: Complete Builder Control
|
42
|
+
details: Total flexibility to customize every aspect of your admin UI with elegant builder APIs
|
43
|
+
---
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# Markdown Extension Examples
|
2
|
+
|
3
|
+
This page demonstrates some of the built-in markdown extensions provided by VitePress.
|
4
|
+
|
5
|
+
## Syntax Highlighting
|
6
|
+
|
7
|
+
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
|
8
|
+
|
9
|
+
**Input**
|
10
|
+
|
11
|
+
````md
|
12
|
+
```js{4}
|
13
|
+
export default {
|
14
|
+
data () {
|
15
|
+
return {
|
16
|
+
msg: 'Highlighted!'
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
```
|
21
|
+
````
|
22
|
+
|
23
|
+
**Output**
|
24
|
+
|
25
|
+
```js{4}
|
26
|
+
export default {
|
27
|
+
data () {
|
28
|
+
return {
|
29
|
+
msg: 'Highlighted!'
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
```
|
34
|
+
|
35
|
+
## Custom Containers
|
36
|
+
|
37
|
+
**Input**
|
38
|
+
|
39
|
+
```md
|
40
|
+
::: info
|
41
|
+
This is an info box.
|
42
|
+
:::
|
43
|
+
|
44
|
+
::: tip
|
45
|
+
This is a tip.
|
46
|
+
:::
|
47
|
+
|
48
|
+
::: warning
|
49
|
+
This is a warning.
|
50
|
+
:::
|
51
|
+
|
52
|
+
::: danger
|
53
|
+
This is a dangerous warning.
|
54
|
+
:::
|
55
|
+
|
56
|
+
::: details
|
57
|
+
This is a details block.
|
58
|
+
:::
|
59
|
+
```
|
60
|
+
|
61
|
+
**Output**
|
62
|
+
|
63
|
+
::: info
|
64
|
+
This is an info box.
|
65
|
+
:::
|
66
|
+
|
67
|
+
::: tip
|
68
|
+
This is a tip.
|
69
|
+
:::
|
70
|
+
|
71
|
+
::: warning
|
72
|
+
This is a warning.
|
73
|
+
:::
|
74
|
+
|
75
|
+
::: danger
|
76
|
+
This is a dangerous warning.
|
77
|
+
:::
|
78
|
+
|
79
|
+
::: details
|
80
|
+
This is a details block.
|
81
|
+
:::
|
82
|
+
|
83
|
+
## More
|
84
|
+
|
85
|
+
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
after_bundle do
|
2
|
+
# We just installed Rails, let's create a commit
|
3
|
+
git add: "."
|
4
|
+
git commit: %( -m 'initial commit' )
|
5
|
+
|
6
|
+
# Run the base install
|
7
|
+
rails_command "app:template LOCATION=https://radioactive-labs.github.io/plutonium-core/templates/base.rb"
|
8
|
+
|
9
|
+
# Add development tools
|
10
|
+
generate "pu:gem:dotenv"
|
11
|
+
git add: "."
|
12
|
+
git commit: %( -m 'add dotenv' )
|
13
|
+
|
14
|
+
generate "pu:gem:annotate"
|
15
|
+
git add: "."
|
16
|
+
git commit: %( -m 'add annotate' )
|
17
|
+
|
18
|
+
generate "pu:gem:standard"
|
19
|
+
git add: "."
|
20
|
+
git commit: %( -m 'add standardrb' )
|
21
|
+
|
22
|
+
generate "pu:gem:letter_opener"
|
23
|
+
git add: "."
|
24
|
+
git commit: %( -m 'add letter_opener' )
|
25
|
+
|
26
|
+
generate "pu:core:assets"
|
27
|
+
git add: "."
|
28
|
+
git commit: %( -m 'integrate assets' )
|
29
|
+
end
|
@@ -22,12 +22,11 @@ module Pu
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def copy_tailwind_config
|
25
|
-
copy_file "tailwind.config.js"
|
25
|
+
copy_file "tailwind.config.js", force: true
|
26
26
|
end
|
27
27
|
|
28
28
|
def install_dependencies
|
29
|
-
|
30
|
-
`yarn add flowbite @tailwindcss/forms`
|
29
|
+
run "yarn add @radioactive-labs/plutonium flowbite @tailwindcss/forms"
|
31
30
|
end
|
32
31
|
|
33
32
|
def configure_application
|
@@ -9,12 +9,12 @@ module.exports = {
|
|
9
9
|
].concat(plutoniumTailwindConfig.plugins.map((plugin) => require(plugin))),
|
10
10
|
theme: plutoniumTailwindConfig.theme,
|
11
11
|
content: [
|
12
|
+
`${__dirname}/app/**/*.rb`,
|
12
13
|
`${__dirname}/app/views/**/*.html.erb`,
|
13
14
|
`${__dirname}/app/helpers/**/*.rb`,
|
14
15
|
`${__dirname}/app/assets/stylesheets/**/*.css`,
|
15
16
|
`${__dirname}/app/javascript/**/*.js`,
|
16
|
-
`${__dirname}/app
|
17
|
-
`${__dirname}/packages/**/app/plutonium/**/*.rb`,
|
17
|
+
`${__dirname}/packages/**/app/**/*.rb`,
|
18
18
|
`${__dirname}/packages/**/app/views/**/*.html.erb`,
|
19
19
|
].concat(plutoniumTailwindConfig.content),
|
20
20
|
}
|
@@ -15,6 +15,7 @@ module Pu
|
|
15
15
|
setup_packages
|
16
16
|
setup_app
|
17
17
|
eject_views
|
18
|
+
setup_active_record
|
18
19
|
rescue => e
|
19
20
|
exception "#{self.class} failed:", e
|
20
21
|
end
|
@@ -25,7 +26,6 @@ module Pu
|
|
25
26
|
copy_file "config/packages.rb"
|
26
27
|
create_file "packages/.keep"
|
27
28
|
insert_into_file "config/application.rb", "\nrequire_relative \"packages\"\n", after: /Bundler\.require.*\n/
|
28
|
-
# insert_into_file "config/application.rb", indent("Plutonium.configure_rails config\n\n", 4), after: /.*< Rails::Application\n/
|
29
29
|
end
|
30
30
|
|
31
31
|
def setup_app
|
@@ -38,6 +38,14 @@ module Pu
|
|
38
38
|
force: options[:force],
|
39
39
|
skip: options[:skip]
|
40
40
|
end
|
41
|
+
|
42
|
+
def setup_active_record
|
43
|
+
inject_into_class(
|
44
|
+
"app/models/application_record.rb",
|
45
|
+
"ApplicationRecord",
|
46
|
+
" include Plutonium::Resource::Record\n"
|
47
|
+
)
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
43
51
|
end
|