Code Monkey home page Code Monkey logo

foxinator-generator's Introduction

foxinator-generator

The foxinator-generator lets you quickly get HitFox projects off the ground. It comes with three installation options: a basic admin controller system, a CMS with roles & permissions, and a CMS with admin comments. Of course, you can install all three too. It also gives you a custom scaffold to generate admin-area models.

Installation

Include the gem in your gemfile:

gem "foxinator-generator", git: "[email protected]:HitFox/foxinator-generator.git"

Then answer y or n to the prompts.

Features

The foxinator-generator uses the Comfortable Mexican Loveseat, Devise, and the inherited_resource and state_machine gems. The basic structure is an Admin namespace, which has a BaseController. All future admin-area controllers will inherit from this BaseController. The BaseController comes with a set of default views which will be automatically inherited by all sub-controllers, making your code more DRY.

There is also a basic tooltip functionality built into the CMS. If you want to add a tool tip to a table head, simply expand the th tag like this:

= th(:some_field, title_suffix: tooltip('MY TOOLTIP TEXT', placement: :right)

By default the placement is :top, but you can overwrite it.

Usage

In your rails app run bundle install then to create your admin namespace:

rails g foxinator:setup

This will install Devise and Comfortable Mexican Sofa and all other required dependencies for your admin area!

It will automatically create an admin account with email “[email protected]” and password “password”.

Then change the config.sign_out_via in devise.rb to :get.

If you want to specify a default site, uncomment line 10 in i18n.rb

Now if you want to create an admin-area controller using the foxinator-generator you can:

rails g foxinator:scaffold MyModel name:string

Which will automatically create the model and controller files (inheriting from BaseController) and some default views.

Last step: Edit the permitted params in your controller file!

That’s it! You should now have a basic app up and running!

The foxinator:scaffold Command

When you create a new admin-area controller and model using the foxinator:scaffold command there are a few additional steps to keep in mind.

To begin with, you need to customize your views and strong params.

If you have Comments in your project, you have to add your model to line 35 in the comments_controller.rb like so:

belongs_to :admin, :role, :my_new_model, polymorphic: true

Then also add this line to your model.rb file: include Commentable

Finally, in routes you need to add concerns: [:commentable] and then click the “Sync Roles & Permissions” button under Admin>Roles in the CMS admin page.

foxinator:scaffold:controller & foxinator:scaffold:model

If you just want to create a controller file and views, use foxinator:scaffold:controller Example. If you just need a model, use foxinator:scaffold:model MyModel.

Please note that both of these commands create admin-namespaced classes.

Changelog

foxinator-generator's People

Contributors

dominicbreuker avatar itschn avatar joanmartinezripoll avatar joemerriweather-webb 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.