Skip to content

Instantly share code, notes, and snippets.

View yamaaki's full-sized avatar

Yamaya Akihiro yamaaki

  • Tokyo, Japan
View GitHub Profile
Devise.setup do |config|
require 'devise/orm/active_record'
config.mailer_sender = '[email protected]'
config.case_insensitive_keys = [:email]
config.strip_whitespace_keys = [:email]
config.skip_session_storage = [:http_auth]
config.stretches = Rails.env.test? ? 1 : 10
config.reconfirmable = true
config.expire_all_remember_me_on_sign_out = true
config.password_length = 8..72
#admins-sessions-new
.row
.col.s12.m9
.section
#p-title.col.s12.scrollspy
h2.p-title Sign in
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
.input-field.col.s12.l9
ul.right.hide-on-med-and-down
- unless admin_page?
- if member_signed_in?
li = link_to edit_member_registration_path, class: 'tooltipped', data: { position: 'left', tooltip: 'Edit Profile' } do
i.material-icons account_box
li = link_to destroy_member_session_path, method: :delete, class: 'tooltipped', data: { position: 'left', tooltip: 'Sign out' } do
i.material-icons exit_to_app
- else
- if admin_signed_in?
li = link_to destroy_admin_session_path, method: :delete, class: 'tooltipped', data: { position: 'left', tooltip: 'Sign out' } do
ul#mobile-menu.side-nav.fixed.collapsible data-collapsible="accordion"
li.hide-on-med-and-down.p-logo
= link_to root_path do
img.responsive-img src="http://dummyimage.com/400x300/eee/fff.png&text=Logo"
- unless admin_page?
- if user_signed_in?
li
= nav_header :airbnb
.collapsible-body
class MembersController < ApplicationController
before_filter :authenticate_admin!
before_action :set_member, only: [:show, :edit, :update, :destroy]
# GET /members
# GET /members.json
def index
@members = Member.page(params[:page]).order('created_at DESC')
@page = params[:page] || 1
respond_to do |format|
module ApplicationHelper
def admin_page?
return true if /\A \/ admin \/ /xm === request.fullpath
return false
end
def member_page?
return true if /\A \/ member \/ /xm === request.fullpath
return false
end
Member.create! email: '[email protected]', password: 'hogehoge'
Admin.create! email: '[email protected]', password: 'hogehoge'
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def after_sign_in_path_for(resource)
return members_path if resource.class.name == 'Admin'
return edit_member_registration_path if resource.class.name == 'Member'
root_path
end
def after_sign_out_path_for(resource)
#admin-members-show
.row
.col.s12.m9
.section
#p-title.col.s12.scrollspy
h2.u-title Member Info
.col.s12
table.striped.responsive-table
tr
#members-index
.row
.col.s12.m9
.section
#p-title.col.s12.scrollspy
h2.p-title members
.col.s12
table.striped.responsive-table
thead