GithubHelp home page GithubHelp logo

akcjademokracja / activate-admin Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.95 MB

A powerful, lightweight admin gem for Padrino/Mongoid with support for a variety of different field types

Ruby 47.52% JavaScript 3.83% CSS 1.55% HTML 47.09%

activate-admin's Introduction

activate-admin

A powerful, lightweight admin gem for Padrino with support for Mongoid and ActiveRecord and a variety of different field types

Setup

In the Gemfile of your application:

gem 'will_paginate', github: 'mislav/will_paginate'
gem 'activerecord_any_of', github: 'oelmekki/activerecord_any_of' # if using ActiveRecord
gem 'activate-tools', github: 'wordsandwriting/activate-tools'
gem 'activate-admin', github: 'wordsandwriting/activate-admin'

In config/apps.rb:

Padrino.mount('ActivateAdmin::App', :app_file => ActivateAdmin.root('app/app.rb')).to('/admin')

Say you have a model User with the fields User#name and User#birthday. Then in the model:

def self.admin_fields
  {
    :name => :text, # same as {:type => :text, :edit => true, :index => true, :new_hint => nil, :edit_hint => nil, :new_tip => nil, :edit_tip => nil, :lookup => true, :full => false}
    :birthday => :date
  }
end

See https://github.com/wordsandwriting/activate-tools/blob/master/lib/form_builder.rb for field types.

Start your app and navigate to /admin. Voila!

filter_options

def self.filter_options
  {
    :q => 'default query', 
    :f => [:field1 => 'default query on field1', :field2 => 'default query on field2'],
    :o => :field1, # default field to order_by
    :d => :asc # default order direction
  }
end

Environment variables

  • Set site name: ENV['ADMIN_SITE_NAME']
  • Include only certain models: ENV['ADMIN_MODELS']
  • Feature certain models: ENV['FEATURED_MODELS']
  • Inline uploads: ENV['INLINE_UPLOAD_MODEL'] and ENV['INLINE_UPLOAD_MODEL_FILE_FIELD']
  • Review and modify configuration variables: ENV['HEROKU_OAUTH_TOKEN'] and ENV['APP_NAME']
  • Permit only certain IPs: ENV['PERMITTED_IPS'] (comma separated)

activate-admin's People

Contributors

marcinkoziej 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.