admin_generator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +28 -0
- data/Rakefile +6 -0
- data/admin_generator.gemspec +25 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/admin_generator.rb +20 -0
- data/lib/admin_generator/version.rb +3 -0
- data/lib/templates/controllers/admin/base_controller.rb +12 -0
- data/lib/templates/controllers/admin/home_controller.rb +5 -0
- data/lib/templates/controllers/admin/sessios_controller.rb +24 -0
- data/lib/templates/views/admin/home/index.html.slim +3 -0
- data/lib/templates/views/admin/sessions/new.html.erb +18 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 03e88b869b80a4bd750a6e538e3d63f2e505fce4
|
4
|
+
data.tar.gz: 0bdb127e846b766d320dbb52f5bd809d1a2a1213
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2a9c2302d2c6606b22baade89d23964060a130a68357d26229905a1eb77b3ac74a902cedb00b74dc8cdf0584a09f1c610b8c20d5bb8622f38a9d5579a8c01028
|
7
|
+
data.tar.gz: d852363896128483463429e741cb32546cbb90f19479a13b31943f10dd2a596e3caefd30d66d973b0427b5498f208ed157fa9e692f4ab6a15cd36dd26b3ea37d
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 jiikko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# AdminGenerator
|
2
|
+
|
3
|
+
よくある管理画面(sorcery )のベースを作成するgenerator。
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'admin_generator', github: "jiikko/admin_generator"
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
```shell
|
19
|
+
$ bundle exec rails g admin_generator:admin install
|
20
|
+
```
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
1. Fork it ( https://github.com/[my-github-username]/admin_generator/fork )
|
25
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
26
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
27
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
28
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'admin_generator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "admin_generator"
|
8
|
+
spec.version = AdminGenerator::VERSION
|
9
|
+
spec.authors = ["jiikko"]
|
10
|
+
spec.email = ["n905i.1214@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{generate admin page with sorcery}
|
13
|
+
spec.description = %q{generate admin page with sorcery.}
|
14
|
+
spec.homepage = "https://github.com/jiikko/admin_generator"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_dependency "sorcery", "~> 0.9"
|
25
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "admin_generator"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require "admin_generator/version"
|
2
|
+
require 'rails/generators'
|
3
|
+
|
4
|
+
module AdminGenerator
|
5
|
+
class AdminGenerator < Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
def init
|
9
|
+
gem "sorcery"
|
10
|
+
|
11
|
+
directory "controllers", "app/controllers"
|
12
|
+
directory "views", "app/views"
|
13
|
+
|
14
|
+
generate "sorcery:install"
|
15
|
+
generate "sorcery:install", "activity_logging brute_force_protection --only-submodules"
|
16
|
+
|
17
|
+
route "namespace :admin do\n root 'home#index'\n end"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Admin::SettionsController < Admin::BaseController
|
2
|
+
skip_before_filter :login_required, only: %[new, create]
|
3
|
+
before_action :login_required, only: %w[destroy]
|
4
|
+
|
5
|
+
def new
|
6
|
+
cookies.permanent[:admin] = true # analyticsの解析が入らないようにするやつ
|
7
|
+
redirect_to admin_root_path if current_user
|
8
|
+
end
|
9
|
+
|
10
|
+
def create
|
11
|
+
@user = login(params[:username], params[:password], params[:remember_me])
|
12
|
+
if @user
|
13
|
+
redirect_back_or_to admin_root_path, notice: 'ログインしました'
|
14
|
+
else
|
15
|
+
flash.now[:alert] = t('invalid_email_or_password')
|
16
|
+
render :new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy
|
21
|
+
logout
|
22
|
+
redirect_to root_url, notice: t('sign_out')
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<div class="span10">
|
2
|
+
<h1>管理者ログイン</h1>
|
3
|
+
<%= form_tag admin_sessions_path do %>
|
4
|
+
<div class="field">
|
5
|
+
<%= label_tag :username %>
|
6
|
+
<%= text_field_tag :username, params[:username] %>
|
7
|
+
</div>
|
8
|
+
<div class="field">
|
9
|
+
<%= label_tag :password %>
|
10
|
+
<%= password_field_tag :password %>
|
11
|
+
</div>
|
12
|
+
<div class="field">
|
13
|
+
<%= check_box_tag :remember_me, 1, params[:remember_me] %>
|
14
|
+
<%= label_tag :remember_me %>
|
15
|
+
</div>
|
16
|
+
<div class="actions"><%= submit_tag t('sign_in'), class: 'btn btn-large btn-primary' %></div>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: admin_generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jiikko
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sorcery
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.9'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.9'
|
55
|
+
description: generate admin page with sorcery.
|
56
|
+
email:
|
57
|
+
- n905i.1214@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- admin_generator.gemspec
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
73
|
+
- lib/admin_generator.rb
|
74
|
+
- lib/admin_generator/version.rb
|
75
|
+
- lib/templates/controllers/admin/base_controller.rb
|
76
|
+
- lib/templates/controllers/admin/home_controller.rb
|
77
|
+
- lib/templates/controllers/admin/sessios_controller.rb
|
78
|
+
- lib/templates/views/admin/home/index.html.slim
|
79
|
+
- lib/templates/views/admin/sessions/new.html.erb
|
80
|
+
homepage: https://github.com/jiikko/admin_generator
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.6.11
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: generate admin page with sorcery
|
104
|
+
test_files: []
|