Giter Site home page Giter Site logo

torreswoo / template-rails-auth Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 5.24 MB

Template Ruby On Rails Project - Login / Authority & Role management

Ruby 18.53% JavaScript 49.64% CSS 21.27% HTML 10.45% CoffeeScript 0.11%
devise rolify authority audited ransack will-paginate

template-rails-auth's Introduction

Torres Template Project - Ruby On Rails

This project is based on Ruby On Rails.

  • Login : LDAP / DB Authenticate & Sign up
  • Role Management & Authority
  • Audit Log
  • Searching & Paging - index & table

feature

Login : LDAP / DB Authenticate & Sign up

rails-intro-login

Role Management & Authority

rails-Role-Management

Audit Log

rails-AuditLog rails-AuditLog

Searching & Paging

library - gem

name version link
devise --- https://github.com/plataformatec/devise
rolify --- https://github.com/RolifyCommunity/rolify
authority --- https://github.com/nathanl/authority
devise_ldap_authenticatable --- ---
net-ldap --- ---
omniauth --- ---
audited --- https://github.com/collectiveidea/audited
--- --- ---
ransack --- https://github.com/activerecord-hackery/ransack
will_paginate --- https://github.com/mislav/will_paginate
--- --- ---
bootstrap-sass --- ---
font-awesome-rails --- ---

How to use gem simply

  • set basic project
$ rails new template-Rails-Auth
$ bundle install
$ rails db:migrate
$ rails db:migrate:status
$ rails db:rollback
$ rails s
$ rails c
$ rails routes

  • devise : set the login & auth
## devise
$ rails g devise:install
$ rails g devise User
$ rails db:migrate 
$ rails g devise:views
$ rails g migration AddColumnUsers username:string

## model
$ rails g scaffold projects  
  • rolify
## role
$ rails g rolify Role

## Auth
$ rails g authority:install 

## usage
$ user = User.find_by(username:'1001')
$ user.roles.pluck(:name, :resource_type, :resource_id)
$ user.add_role :admin
$ user.add_role :owner, Project.find(1)
  • 1:N relation
## model
$ rails g scaffold projects
$ rails g scaffold posts  

## keyword
belongs_to
has_many
  • authorizer
config/initializers/authority.rb
** ProjectAuthorizer, PostAuthorizer
** creatable_by?, updatable_by?, deletable_by?, permissionable_by?
  • audited
## Gemfile
gem "audited", "~> 4.6"

## command
$ rails generate audited:upgrade
$ rake db:migrate

## keyword
audited
has_associated_audits
  • Searching
## Gemfile
gem 'ransack'
config/initializers/ransack.rb

## view helper
<%= search_form_for @q, url: , class:  do |f| %>

## controller
@q = Project.ransack(params[:q])
  • Paging
## Gemfile
gem 'will_paginate'

## view helper
<%= will_paginate @projects, :class , :previous_label, :next_label %>

## keyword
lib/pagination.css
  • use "nested_form"

UI library

  • Bootstrap
Gemfile
  gem 'bootstrap-sass', '3.3.6'
  gem 'font-awesome-rails'
app/assets/javascript/application.js
  //= require bootstrap-sprockets
app/assets/stylesheets/application.css
  *= require font-awesome
  • mustache.js
  • select2.js

template-rails-auth's People

Contributors

torreswoo avatar

Stargazers

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