Skip to content

empowerunited/manage

Repository files navigation

Manage

Admin backend started from iain.nl/backends-in-rails-3-1

Works with Rails 5

Based on inherit_resources, slim, kaminari

No DSLs, no learning curve, only what you know about Ruby on Rails

<img src=“https://badge.fury.io/rb/manage.svg” alt=“Gem Version” />

Installing

Add the engine

to Gemfile

gem 'manage'

to routes.rb yourapp/config/routes.rb:

mount Manage::Engine, at: "/manage"

if you want to have custom design in your app for the manage engine add in application.rb:

config.assets.precompile += [
  'manage/custom.css'
]

Defining resource for administration

Add the resource to your app routes.rb yourapp/config/routes.rb:

Manage::Engine.routes.draw do
  concern :backend_manageable do
    collection do
      get :show_help
    end
  end

  resources :cities
end

Create controller in your application yourapp/app/controllers/manage/cities_controller.rb

class Manage::CitiesController < Manage::ResourceController
  @@per_page = 10 # optional

  # optional
  def collection_actions collection
    [
      view_context.button_to(t('manage.views.winners.export_as_bank_file'), [:export_as_bank_file, resource_class], method: :post, data: {handler: 'CollectionActions'}, class: 'button')
    ].join('').html_safe
  end

  # optional
  def resource_actions resource
    [
      '',
      view_context.link_to('Login as', login_as_user_path(resource.id)),
    ].join('&nbsp;'.html_safe).html_safe
  end

end

View overriding

You can overrede the views in

app/views/manage/countries

  • _index.html.slim

  • _form.html_slim

  • edit.html.slim

  • new.html.slim

  • show.html.slim

Authorization

In your app do

rails generate devise AdminUser

delete "devise_for :admin_users" from routes.rb

Create an admin user. The users benefit from the devise password validation/generation but doesn’t use the devise controllers.

AdminUser.create(email: 'admin@example.com', password: '11223344', password_confirmation: '11223344')

[ ![Codeship Status for empowerunited/manage](www.codeship.io/projects/1c343f80-3084-0132-3465-0a5d7c3cc23a/status)](https://www.codeship.io/projects/39835)

Graphics and art

Logo designed by Geri dribbble.com/gerystancheva

TODO

  • Make the scopes/filters work

License

This project rocks and uses MIT license

About

Ruby On Rails Backend Engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •