Code Monkey home page Code Monkey logo

trestle's Introduction

Trestle Logo

Trestle

RubyGem Travis Coveralls Code Climate

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:

$ 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 :posts, icon: "fa fa-file-text-o", group: :blog_management

  # Define custom scopes for the index view
  scope :all, default: true
  scope :published
  scope :drafts, -> { Post.unpublished }

  # 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
  end
end

Plugins

The following plugins are currently available:

Name Description Links
trestle-auth User authentication plugin GitHub | RubyGems
trestle-search Search plugin GitHub | RubyGems
trestle-tinymce TinyMCE (WYSIWYG editor) integration GitHub | RubyGems
trestle-simplemde SimpleMDE (Markdown editor) integration GitHub | RubyGems
trestle-sidekiq Sidekiq integration GitHub | RubyGems

License

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

trestle's People

Contributors

jeanlazarou avatar leohige avatar martio avatar richardvenneman avatar spohlenz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.