Trestle一个Ruby on Rails的现代响应管理框架

网友投稿 622 2022-10-28

Trestle一个Ruby on Rails的现代响应管理框架

Trestle一个Ruby on Rails的现代响应管理框架

Trestle

Demo Site | Demo Source Code

A modern, responsive admin framework for Ruby on Rails

Getting Started

To start using Trestle, first add it to your application's Gemfile:

gem 'trestle'

Run bundle install, and then run the install generator to create the initial configuration file and customization hooks:

$ rails generate trestle:install

Then create your first admin resource (assuming you have an existing Article model):

$ rails generate trestle:resource Article

After restarting your Rails server, visit http://localhost:3000/admin to view your newly created admin. You will find the admin definition in app/admin/articles_admin.rb ready to customize.

Example

Trestle.resource(:posts) do # Add a link to this admin in the main navigation menu do group :blog_management, priority: :first do item :posts, icon: "fa fa-file-text-o" end end # Define custom scopes for the index view scopes do scope :all, default: true scope :published scope :drafts, -> { Post.unpublished } end # Define the index view table listing table do column :title, link: true column :author, ->(post) { post.author.name } column :published, align: :center do |post| status_tag(icon("fa fa-check"), :success) if post.published? end column :updated_at, header: "Last Updated", align: :center actions end # Define the form structure for the new & edit actions form do # Organize fields into tabs and sidebars tab :post do text_field :title # Define custom form fields for easy re-use editor :body end tab :metadata do # Layout fields based on a 12-column grid row do col(sm: 6) { select :author, User.all } col(sm: 6) { tag_select :tags } end end sidebar do # Render a custom partial: app/views/admin/posts/_sidebar.html.erb render "sidebar" end endend

Plugins

The following plugins are currently available:

NameDescriptionLinks
trestle-authUser authentication pluginGitHub | RubyGems
trestle-searchSearch pluginGitHub | RubyGems
trestle-tinymceTinyMCE (WYSIWYG editor) integrationGitHub | RubyGems
trestle-simplemdeSimpleMDE (Markdown editor) integrationGitHub | RubyGems
trestle-sidekiqSidekiq integrationGitHub | RubyGems
trestle-active_storageActive Storage integrationGitHub | RubyGems
trestle-mobilityMobility integrationGitHub | RubyGems
trestle-omniauthOmniAuth authentication pluginGitHub | RubyGems
trestle-auth-otp2FA/OTP user authenticationGitHub | RubyGems

License

The gem is available as open source under the terms of the LGPLv3 License.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Mybatis 多对一查询的实现方法
下一篇:php加密配置文件
相关文章

 发表评论

暂时没有评论,来抢沙发吧~