Giter VIP home page Giter VIP logo

metus's Introduction

Metus

Metus is a highly opinionated business application framework, made to create backend applications.

Backend example

Installation

Add this line to your application's Gemfile:

gem 'metus'

And then execute:

$ bundle

Add the following to your config/routes.rb:

mount Metus::Engine, at: '/metus'

Usage

Backend Setup

To redirect to the backend's homepage after login, add the following to your config/routes.rb:

  get :admin_root, to: redirect('/metus/backend/welcome'), status: 302, as: :admin_root

Pages

Public, static pages are served by Metus::PagesController. Create the directory app/views/pages and create HAML templates (.html.haml) or Asciidoctor files (.adoc) there. For example, create app/views/pages/home.html.haml. Metus generates routes for you. To set your homepage to render home.html.haml, use the following route in your config/routes.rb:

root to: 'metus/pages#home'

Pages are meant to be accessed without authentication. If your ApplicationController requires authentication, create a new controller which skips that authentication and tell Metus the name of that controller in config/initializers/metus.rb:

Metus.public_controller_class = 'MyPublicController'

Asciidoctor pages are rendered within a div with the class .asciidoc, so that specific CSS styling can be applied.

Navigation Links

Use the following for navigation links:

nav_link_to 'My link title', blog_index_path, :exact, class: 'nav link'
nav_link_to 'My link title', blog_index_path, :controller, class: 'nav link'

When the current path equals the link, an active class is added to the link. When using :exact as an argument, the full path needs to match. When using :controller, only the controller needs to match, so the navigation link is active for any action within that controller.

Production

Precompile assets using:

RAILS_ENV=production bin/rails metus:webpacker:compile

Contributing

Contributions are welcome. Please open an issue on Github to discuss a contribution or open a pull request if you are feeling lucky.

Development

Run the included test application:

bin/webpack-dev-server &
cd test/dummy
bin/rails s

License

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

metus's People

Contributors

phylor avatar

Watchers

 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.