skinny_admin 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +11 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +36 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/generators/skinny_admin/USAGE +51 -0
- data/lib/generators/skinny_admin/controller_generator.rb +55 -0
- data/lib/generators/skinny_admin/install_generator.rb +51 -0
- data/lib/generators/skinny_admin/templates/controller_templates/skinny_admin_controller.rb.erb +59 -0
- data/lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_edit.html.erb +12 -0
- data/lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_form.html.erb +15 -0
- data/lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_index.html.erb +48 -0
- data/lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_index_partial.html.erb +7 -0
- data/lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_new.html.erb +12 -0
- data/lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_show.html.erb +13 -0
- data/lib/generators/skinny_admin/templates/init/dashboard.html.erb +11 -0
- data/lib/generators/skinny_admin/templates/init/dashboard.rb +9 -0
- data/lib/generators/skinny_admin/templates/init/skinny_admin.css +0 -0
- data/lib/generators/skinny_admin/templates/init/skinny_admin.js +0 -0
- data/lib/generators/skinny_admin/templates/init/skinny_admin_controller.rb +24 -0
- data/lib/generators/skinny_admin/templates/init/skinny_admin_layout.html.erb +37 -0
- data/lib/skinny_admin/railtie.rb +6 -0
- data/lib/skinny_admin/version.rb +3 -0
- data/lib/skinny_admin.rb +6 -0
- data/skinny_admin.gemspec +26 -0
- metadata +119 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: f833b7bf4b8d4cf4cbea525c0072d4108cf84b4f
|
|
4
|
+
data.tar.gz: 9574658701dfc25ca5fdac3dc8fe9e176206792f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 57669e500ef9929732d1e2b8b42eddc36b08af50e1de6b2b4ffd71f62c66b0c6738d65d9019c85138ee743dbabf15b1f4d98747083fd755f4d51257dc13bea66
|
|
7
|
+
data.tar.gz: 4245c03c955404445884d3dd46c3ce7e8078a2d9e90616fd4235829556d9112d991ac286cc93ea6bcca8d745dbe3ba6527f89c48927419c11a142c30313acca4
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
|
7
|
+
|
|
8
|
+
We are committed to making participation in this project a harassment-free
|
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
|
12
|
+
|
|
13
|
+
Examples of unacceptable behavior by participants include:
|
|
14
|
+
|
|
15
|
+
* The use of sexualized language or imagery
|
|
16
|
+
* Personal attacks
|
|
17
|
+
* Trolling or insulting/derogatory comments
|
|
18
|
+
* Public or private harassment
|
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
|
20
|
+
addresses, without explicit permission
|
|
21
|
+
* Other unethical or unprofessional conduct
|
|
22
|
+
|
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
27
|
+
threatening, offensive, or harmful.
|
|
28
|
+
|
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
|
32
|
+
Conduct may be permanently removed from the project team.
|
|
33
|
+
|
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
|
35
|
+
when an individual is representing the project or its community.
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
38
|
+
reported by contacting a project maintainer at bsaterfiel@uchicago.edu. All
|
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
|
42
|
+
incident.
|
|
43
|
+
|
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
45
|
+
version 1.3.0, available at
|
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
|
47
|
+
|
|
48
|
+
[homepage]: http://contributor-covenant.org
|
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 Brad Saterfiel
|
|
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,36 @@
|
|
|
1
|
+
# SkinnyAdmin [](https://travis-ci.org/johnnypaper/skinny_admin)
|
|
2
|
+
|
|
3
|
+
Easily create an admin interface in Rails. Unlike other administrative frameworks, Skinny Admin is meant
|
|
4
|
+
to be a quick way to setup your Administrative needs and allow you to work within Ruby/Rails with
|
|
5
|
+
no strange DSLs. This will allow you to use what you already know and reduce startup time.
|
|
6
|
+
|
|
7
|
+
Please see the Documentation and take the Test Drive at [SkinnyAdmin.org](http://skinnyadmin.orgy)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Add this line to your application's Gemfile:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
gem 'skinny_admin'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
And then execute:
|
|
18
|
+
|
|
19
|
+
$ bundle
|
|
20
|
+
|
|
21
|
+
Or install it yourself as:
|
|
22
|
+
|
|
23
|
+
$ gem install skinny_admin
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Full usage instructions and changes can be found at [SkinnyAdmin.org](http://skinnyadmin.org).
|
|
28
|
+
|
|
29
|
+
## Contributing
|
|
30
|
+
|
|
31
|
+
Bug reports and pull requests are welcome on GitHub.
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
36
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "skinny_admin"
|
|
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,51 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
Generate an admin framework for you to customize.
|
|
3
|
+
|
|
4
|
+
Example:
|
|
5
|
+
rails generate skinny_admin:install
|
|
6
|
+
|
|
7
|
+
This will create:
|
|
8
|
+
# JS FILES
|
|
9
|
+
app/assets/javavscripts/admin/admin_layout.js
|
|
10
|
+
app/assets/javavscripts/admin/dashboard.js
|
|
11
|
+
|
|
12
|
+
# CSS FILES
|
|
13
|
+
app/assets/stylesheets/admin/admin_layout.css
|
|
14
|
+
app/assets/javavscripts/admin/dashboard.css
|
|
15
|
+
|
|
16
|
+
# CONTROLLER FILES
|
|
17
|
+
app/controllers/skinny_admin_controller.rb
|
|
18
|
+
app/controllers/admin/dashboard_controller.rb
|
|
19
|
+
|
|
20
|
+
# VIEWS
|
|
21
|
+
app/views/admin/layouts/admin.html.erb
|
|
22
|
+
app/views/admin/dashboard/index.html.erb
|
|
23
|
+
|
|
24
|
+
# ROUTES NAMESPACE
|
|
25
|
+
namespace :admin do
|
|
26
|
+
get '/' => dashboard#index, as: 'dashboard'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# ------------------------------------------------ #
|
|
30
|
+
|
|
31
|
+
rails generate skinny_admin:controller CONTROLLER_NAME
|
|
32
|
+
|
|
33
|
+
This will create:
|
|
34
|
+
# JS FILE
|
|
35
|
+
app/assets/javavscripts/admin/CONTROLLER_NAME.js
|
|
36
|
+
|
|
37
|
+
# CSS FILE
|
|
38
|
+
app/assets/stylesheets/admin/CONTROLLER_NAME.css
|
|
39
|
+
|
|
40
|
+
# CONTROLLER FILE
|
|
41
|
+
app/controllers/admin/CONTROLLER_NAME.rb
|
|
42
|
+
|
|
43
|
+
# VIEWS
|
|
44
|
+
app/views/admin/CONTROLLER_NAME/_form.html.erb
|
|
45
|
+
app/views/admin/CONTROLLER_NAME/edit.html.erb
|
|
46
|
+
app/views/admin/CONTROLLER_NAME/index.html.erb
|
|
47
|
+
app/views/admin/CONTROLLER_NAME/new.html.erb
|
|
48
|
+
app/views/admin/CONTROLLER_NAME/show.html.erb
|
|
49
|
+
|
|
50
|
+
# ROUTES
|
|
51
|
+
Add resources :CONTROLLER_NAME to admin namespace
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module SkinnyAdmin
|
|
4
|
+
class ControllerGenerator < Rails::Generators::Base
|
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
6
|
+
argument :controller_name, :type => :string
|
|
7
|
+
class_option :stylesheet, :type => :boolean, :default => true, :desc => "Include stylesheet file."
|
|
8
|
+
class_option :javascript, :type => :boolean, :default => true, :desc => "Include javascript file."
|
|
9
|
+
class_option :index_partial, :type => :boolean, :default => false, :desc => "Include an index partial file for your controller."
|
|
10
|
+
|
|
11
|
+
def gen_skinny_admin
|
|
12
|
+
|
|
13
|
+
template 'controller_templates/skinny_admin_controller.rb.erb', "#{Rails.root}/app/controllers/admin/#{option_name}_controller.rb"
|
|
14
|
+
template 'controller_templates/views/skinny_admin_controller_index.html.erb', "#{Rails.root}/app/views/admin/#{option_name}/index.html.erb"
|
|
15
|
+
template 'controller_templates/views/skinny_admin_controller_show.html.erb', "#{Rails.root}/app/views/admin/#{option_name}/show.html.erb"
|
|
16
|
+
template 'controller_templates/views/skinny_admin_controller_new.html.erb', "#{Rails.root}/app/views/admin/#{option_name}/new.html.erb"
|
|
17
|
+
template 'controller_templates/views/skinny_admin_controller_edit.html.erb', "#{Rails.root}/app/views/admin/#{option_name}/edit.html.erb"
|
|
18
|
+
template 'controller_templates/views/skinny_admin_controller_form.html.erb', "#{Rails.root}/app/views/admin/#{option_name}/_form.html.erb"
|
|
19
|
+
|
|
20
|
+
if options.index_partial?
|
|
21
|
+
template 'controller_templates/views/skinny_admin_controller_index_partial.html.erb', "#{Rails.root}/app/views/admin/#{option_name}/_index.html.erb"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
if options.javascript?
|
|
25
|
+
copy_file 'init/skinny_admin.js', "#{Rails.root}/app/assets/javascripts/admin/#{option_name}.js"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if options.stylesheet?
|
|
29
|
+
copy_file 'init/skinny_admin.css', "#{Rails.root}/app/assets/stylesheets/admin/#{option_name}.css"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
inject_into_file "#{Rails.root}/config/routes.rb", :after => "namespace :admin do\n" do
|
|
33
|
+
" resources :#{option_name}\n"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
inject_into_file "#{Rails.root}/app/views/admin/layouts/admin.html.erb", :before => '<div class="row" style="display: none;" id="lastModel"></div>' do
|
|
37
|
+
"<div class=\"col-xs-1\" style=\"text-align: center; font-size: 17px; position: relative; top: 3px; font-family: 'PT Sans Narrow';\">\n\t\t\t\t<div><%= link_to '#{reg_name}', admin_#{option_name}_path, style: ' color: black; background-color: transparent; text-decoration: none;' %></div>\n\t\t\t</div>\n\t\t\t"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def option_name
|
|
46
|
+
controller_name.underscore
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def reg_name
|
|
50
|
+
controller_name
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
|
|
3
|
+
module SkinnyAdmin
|
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
6
|
+
class_option :stylesheet, :type => :boolean, :default => true, :desc => "Include stylesheet file."
|
|
7
|
+
class_option :javascript, :type => :boolean, :default => true, :desc => "Include javascript file."
|
|
8
|
+
|
|
9
|
+
def gen_skinny_admin
|
|
10
|
+
|
|
11
|
+
empty_directory "#{Rails.root}/app/controllers/admin"
|
|
12
|
+
empty_directory "#{Rails.root}/app/views/admin"
|
|
13
|
+
empty_directory "#{Rails.root}/app/views/admin/layouts"
|
|
14
|
+
empty_directory "#{Rails.root}/app/views/admin/dashboard"
|
|
15
|
+
empty_directory "#{Rails.root}/app/assets/stylesheets/admin"
|
|
16
|
+
empty_directory "#{Rails.root}/app/assets/javascripts/admin"
|
|
17
|
+
|
|
18
|
+
copy_file 'init/skinny_admin_controller.rb', "#{Rails.root}/app/controllers/skinny_admin_controller.rb"
|
|
19
|
+
copy_file 'init/skinny_admin_layout.html.erb', "#{Rails.root}/app/views/admin/layouts/admin.html.erb"
|
|
20
|
+
copy_file 'init/dashboard.rb', "#{Rails.root}/app/controllers/admin/dashboard_controller.rb"
|
|
21
|
+
copy_file 'init/dashboard.html.erb', "#{Rails.root}/app/views/admin/dashboard/index.html.erb"
|
|
22
|
+
|
|
23
|
+
if options.javascript?
|
|
24
|
+
copy_file 'init/skinny_admin.js', "#{Rails.root}/app/assets/javascripts/admin/admin_layout.js"
|
|
25
|
+
copy_file 'init/skinny_admin.js', "#{Rails.root}/app/assets/javascripts/admin/dashboard.js"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if options.stylesheet?
|
|
29
|
+
copy_file 'init/skinny_admin.css', "#{Rails.root}/app/assets/stylesheets/admin/admin_layout.css"
|
|
30
|
+
copy_file 'init/skinny_admin.css', "#{Rails.root}/app/assets/stylesheets/admin/dashboard.css"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
inject_into_file "#{Rails.root}/config/initializers/assets.rb", :after => "# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.\n" do
|
|
34
|
+
"Rails.application.config.assets.precompile += %w( admin/*.js admin/*.css )\n"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
inject_into_file "#{Rails.root}/app/assets/stylesheets/application.css", :after => "*= require_self\n" do
|
|
38
|
+
" *= require_tree ./admin\n"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
route "namespace :admin do\n get '/' => 'dashboard#index', as: 'dashboard'\n end\n"
|
|
42
|
+
|
|
43
|
+
inject_into_file "#{Rails.root}/app/views/admin/layouts/admin.html.erb", :before => '<div class="row" style="display: none;" id="lastModel"></div>' do
|
|
44
|
+
"<div class=\"col-xs-1\" style=\"text-align: center; font-size: 17px; position: relative; top: 3px; font-family: 'PT Sans Narrow';\">\n\t\t\t\t<div><%= link_to 'Dashboard', admin_dashboard_path, style: ' color: black; background-color: transparent; text-decoration: none;' %></div>\n\t\t\t</div>\n\t\t\t"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
data/lib/generators/skinny_admin/templates/controller_templates/skinny_admin_controller.rb.erb
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class <%= reg_name %>Controller < SkinnyAdminController
|
|
3
|
+
|
|
4
|
+
def index
|
|
5
|
+
# We've only selected the first 10. It's up to you how you wanna do it.
|
|
6
|
+
# Maybe you wanna sort a different way, or just paginate all of the objects.
|
|
7
|
+
# gem 'will_paginate' https://github.com/mislav/will_paginate is our favorite pagination
|
|
8
|
+
@<%= option_name %> = <%= reg_name.singularize %>.limit(10)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def show
|
|
12
|
+
@<%= option_name.singularize %> = <%= reg_name.singularize %>.find(params[:id])
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def new
|
|
16
|
+
@<%= option_name.singularize %> = <%= reg_name.singularize %>.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def create
|
|
20
|
+
@<%= option_name.singularize %> = <%= reg_name.singularize %>.new(<%= option_name.singularize %>_params)
|
|
21
|
+
if @<%= option_name.singularize %>.save
|
|
22
|
+
redirect_to :action => 'show', :id => @<%= option_name.singularize %>.id
|
|
23
|
+
else
|
|
24
|
+
#HANDLE YOUR OWN ERRORS ;)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def edit
|
|
29
|
+
@<%= option_name.singularize %> = <%= reg_name.singularize %>.find(params[:id])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def update
|
|
33
|
+
@<%= option_name.singularize %> = <%= reg_name.singularize %>.find(params[:id])
|
|
34
|
+
if @<%= option_name.singularize %>.update_attributes(params[:<%= option_name.singularize %>])
|
|
35
|
+
redirect_to :action => 'show', :id => @<%= option_name.singularize %>.id
|
|
36
|
+
else
|
|
37
|
+
#HANDLE YOUR OWN ERRORS ;)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def destroy
|
|
42
|
+
@<%= option_name.singularize %> = <%= reg_name.singularize %>.find(params[:id])
|
|
43
|
+
if @<%= option_name.singularize %>.destroy
|
|
44
|
+
redirect_to admin_<%= option_name %>_path
|
|
45
|
+
else
|
|
46
|
+
#HANDLE YOUR OWN ERRORS ;)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def <%= option_name.singularize %>_params
|
|
54
|
+
#HANDLE YOUR OWN MODEL PARAMS HERE ;)
|
|
55
|
+
#params.require(:<%= option_name.singularize %>).permit(:blah, :blah1, :blah2)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<div class="row" style="height: 300px; text-align: center; margin-top: 30px;">
|
|
2
|
+
<div class="col-xs-12">
|
|
3
|
+
<span style="margin-top: 35px;"><span style="/*noinspection CssNoGenericFontName*/font-family: 'PT Sans Narrow'; font-size: 75px;">Skinny</span><span style="/*noinspection CssNoGenericFontName*/font-family: 'Fjalla One'; font-size: 68px;">Admin</span></span>
|
|
4
|
+
<br><br>
|
|
5
|
+
<span style="font-size: 22px;">This is the Admin <%= reg_name %>#edit Controller | View located in views/admin/<%= option_name %>/edit.</span>
|
|
6
|
+
<br>
|
|
7
|
+
<br> Please review the <%%= link_to 'Docs', 'http://skinnyadmin.org' %> so that you avoid any irritations that otherwise you wouldn't have had the hassle of dealing with.
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<%%= render 'form' %>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<div class="row" style="height: 100px; text-align: center;">
|
|
5
|
+
<div class="col-xs-12">
|
|
6
|
+
<span style="font-size: 22px;">This is the form partial passed to <%= reg_name %>#create or <%= reg_name %>#update <br> View located in views/admin/<%= option_name %>/_form.</span>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="col-xs-12">
|
|
9
|
+
<span style="font-size: 22px;">When using creating your form, dont forget to use the [:admin, @model] in the form_for to have the admin namespace handled correctly.</span>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<%%= form_for([:admin, @<%= option_name.singularize %>]) do |f|%>
|
|
14
|
+
|
|
15
|
+
<%% end %>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
<div class="row" style="height: 100px; text-align: center; margin-top: 30px;">
|
|
3
|
+
<div class="col-xs-12">
|
|
4
|
+
<span style="margin-top: 35px;"><span style="/*noinspection CssNoGenericFontName*/font-family: 'PT Sans Narrow'; font-size: 75px;">Skinny</span><span style="/*noinspection CssNoGenericFontName*/font-family: 'Fjalla One'; font-size: 68px;">Admin</span></span>
|
|
5
|
+
<br><br>
|
|
6
|
+
<span style="font-size: 22px;">This is the Admin <%= reg_name %>#index Controller | View located in views/admin/<%= option_name %>/index.</span>
|
|
7
|
+
<br>
|
|
8
|
+
<br> Please review the <%%= link_to 'Docs', 'http://skinnyadmin.org' %> so that you avoid any irritations that otherwise you wouldn't have had the hassle of dealing with.
|
|
9
|
+
|
|
10
|
+
<br>Do Something Cool Here Maybe. Below is a basic table. Maybe You want to paginate the table, add some charts here, etc. Who knows? <br>
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="row">
|
|
16
|
+
<div class="col-xs-8 col-xs-offset-2" style="text-align: center; padding: 0; margin-top: 15px;"><%%= link_to 'Add a <%= reg_name.singularize %>', new_admin_<%= option_name.singularize %>_path, class: 'btn btn-primary', style: 'width: 100%; color: white;' %></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<% if options.index_partial? %>
|
|
20
|
+
<%% render 'index' %>
|
|
21
|
+
<% else %>
|
|
22
|
+
<%% if @<%= option_name %>.size > 0 %>
|
|
23
|
+
<div class="row">
|
|
24
|
+
<div class="col-xs-12" style="overflow-x: scroll; margin-top: 30px;">
|
|
25
|
+
<table class="table table-striped">
|
|
26
|
+
<thead>
|
|
27
|
+
<tr>
|
|
28
|
+
<th>Actions</th>
|
|
29
|
+
<%% @<%= option_name %>.first.attributes.keys.each do |k| %>
|
|
30
|
+
<th><%%= k.gsub('<%= option_name.singularize %>_', '') %></th>
|
|
31
|
+
<%% end %>
|
|
32
|
+
</tr>
|
|
33
|
+
</thead>
|
|
34
|
+
<tbody>
|
|
35
|
+
<%% @<%= option_name %>.each do |w| %>
|
|
36
|
+
<tr>
|
|
37
|
+
<td><%%= link_to 'View', admin_<%= option_name.singularize %>_path(id: w.id), class: 'btn btn-xs btn-primary', style: 'color: white;' %> <%%= link_to 'Edit', edit_admin_<%= option_name.singularize %>_path(id: w.id), class: 'btn btn-xs btn-warning', style: 'color: white;' %> <%%= link_to 'Delete', admin_<%= option_name.singularize %>_path(id: w.id), class: 'btn btn-xs btn-danger', style: 'color: white;', method: :delete, data: {confirm: 'You are about to delete this object. Are you sure?'} %></td>
|
|
38
|
+
<%% w.attributes.keys.each do |val| %>
|
|
39
|
+
<td><%%= w[val] %></td>
|
|
40
|
+
<%% end %>
|
|
41
|
+
</tr>
|
|
42
|
+
<%% end %>
|
|
43
|
+
</tbody>
|
|
44
|
+
</table>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<%% end %>
|
|
48
|
+
<% end %>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<div class="row" style="height: 300px; text-align: center; margin-top: 30px;">
|
|
2
|
+
<div class="col-xs-12">
|
|
3
|
+
<span style="margin-top: 35px;"><span style="/*noinspection CssNoGenericFontName*/font-family: 'PT Sans Narrow'; font-size: 75px;">Skinny</span><span style="/*noinspection CssNoGenericFontName*/font-family: 'Fjalla One'; font-size: 68px;">Admin</span></span>
|
|
4
|
+
<br><br>
|
|
5
|
+
<span style="font-size: 22px;">This is the Admin <%= reg_name %>#new Controller | View located in views/admin/<%= option_name %>/new.</span>
|
|
6
|
+
<br>
|
|
7
|
+
<br> Please review the <%%= link_to 'Docs', 'http://skinnyadmin.org' %> so that you avoid any irritations that otherwise you wouldn't have had the hassle of dealing with.
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<%%= render 'form' %>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<div class="row" style="height: 100px; text-align: center; margin-top: 30px;">
|
|
2
|
+
<div class="col-xs-12">
|
|
3
|
+
<span style="margin-top: 35px;"><span style="/*noinspection CssNoGenericFontName*/font-family: 'PT Sans Narrow'; font-size: 75px;">Skinny</span><span style="/*noinspection CssNoGenericFontName*/font-family: 'Fjalla One'; font-size: 68px;">Admin</span></span>
|
|
4
|
+
<br><br>
|
|
5
|
+
<span style="font-size: 22px;">This is the Admin <%= reg_name %>#show Controller | View located in views/admin/<%= option_name %>/show.</span>
|
|
6
|
+
<br>
|
|
7
|
+
<br> Please review the <%%= link_to 'Docs', 'http://skinnyadmin.org' %> so that you avoid any irritations that otherwise you wouldn't have had the hassle of dealing with.
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<%%= javascript_include_tag 'admin/<%= option_name %>' %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div class="row" style="height: 100px; text-align: center; margin-top: 30px;">
|
|
2
|
+
<span style="margin-top: 35px;"><span style="font-family: 'PT Sans Narrow'; font-size: 75px;">Skinny</span><span style="font-family: 'Fjalla One'; font-size: 68px;">Admin</span></span>
|
|
3
|
+
<br><br>
|
|
4
|
+
<span style="font-size: 22px;">This is the Dashboard, located in views/admin/dashboard/index.<br>
|
|
5
|
+
You may wanna think about what stats and links would be most useful here.<br>
|
|
6
|
+
<%= link_to 'Chart.js', 'http://www.chartjs.org/' %> and <%= link_to 'Chartist.js', 'https://gionkunz.github.io/chartist-js/' %> ar great basic charting tools. The rest is up to you.</span>
|
|
7
|
+
<br>
|
|
8
|
+
<br> Please review the <%= link_to 'Documentation', 'http://skinnyadmin.org' %> so that you avoid any irritations that otherwise you wouldn't have had the hassle of dealing with.
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# noinspection ALL
|
|
2
|
+
class SkinnyAdminController < ApplicationController
|
|
3
|
+
|
|
4
|
+
before_action :validate_admin_user
|
|
5
|
+
|
|
6
|
+
layout 'admin/layouts/admin'
|
|
7
|
+
|
|
8
|
+
# Configure validate_admin_user to your liking...The method is set upon Devise or a User Class
|
|
9
|
+
# Methods user_signed_in? (Devise) and a Boolean is_admin column to Validate Admin User.
|
|
10
|
+
|
|
11
|
+
# If you need levels of Admin or Restricted Admin Usage, you need another column in your DB
|
|
12
|
+
# simply setting certain levels and testing against those levels in the individual admin controllers
|
|
13
|
+
# located in app/controllers/admin/your_controller.rb
|
|
14
|
+
|
|
15
|
+
# Please see website documentation for more information at http://skinnyadmin.org
|
|
16
|
+
|
|
17
|
+
def validate_admin_user
|
|
18
|
+
if user_signed_in? && current_user.is_admin?
|
|
19
|
+
else
|
|
20
|
+
redirect_to :root
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Skinny Admin</title>
|
|
5
|
+
<%= csrf_meta_tags %>
|
|
6
|
+
|
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
|
8
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
|
9
|
+
|
|
10
|
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
|
11
|
+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
|
12
|
+
<link href="https://fonts.googleapis.com/css?family=Fjalla+One|Open+Sans+Condensed:300|PT+Sans+Narrow" rel="stylesheet">
|
|
13
|
+
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
<div class="container-fluid">
|
|
18
|
+
<div class="row" style="border-bottom: 1px solid grey; height: 50px;">
|
|
19
|
+
<div class="col-xs-2" style="text-align: center;">
|
|
20
|
+
<%= link_to "<span style=\"font-family: 'PT Sans Narrow'; font-size: 35px;\">Skinny</span><span style=\"font-family: 'Fjalla One'; font-size: 30px;\">Admin</span>".html_safe, admin_dashboard_path, style: 'text-decoration: none; background-color: transparent; color: black;' %>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="col-xs-2 col-xs-offset-8" style="text-align: center;">
|
|
23
|
+
<%= link_to '<span class="glyphicon glyphicon-home" aria-hidden="true"></span>'.html_safe , root_path, style: 'position: relative; top: 7px; font-size: 30px; color: black; background: transparent;' %>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="row" style="background-color: lightblue; min-height: 30px;">
|
|
27
|
+
<div class="row" style="display: none;" id="lastModel"></div> <!-- DO NOT DELETE THIS ROW OR MAKE SURE IT IS AT THE END OF WHERE YOU WANT YOUR MODELS ADDED -->
|
|
28
|
+
</div>
|
|
29
|
+
<div class="row">
|
|
30
|
+
<div class="col-xs-12">
|
|
31
|
+
<%= yield %>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
data/lib/skinny_admin.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'skinny_admin/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "skinny_admin"
|
|
8
|
+
spec.version = SkinnyAdmin::VERSION
|
|
9
|
+
spec.authors = ["Brad Saterfiel"]
|
|
10
|
+
spec.email = ["brad.saterfiel@gmail.com"]
|
|
11
|
+
spec.summary = "SkinnyAdmin is an admin template generator that is easy, quick, and painless to get going. No DSL involved."
|
|
12
|
+
spec.description = "Easily customizable admin generator for Rails. SkinnyAdmin is very easy to install and get your customized administrative needs met quickly."
|
|
13
|
+
spec.homepage = "http://skinnyadmin.org"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
spec.platform = Gem::Platform::RUBY
|
|
16
|
+
spec.rubygems_version
|
|
17
|
+
|
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
19
|
+
spec.bindir = "exe"
|
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
21
|
+
spec.require_paths = ["lib"]
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
|
24
|
+
spec.add_development_dependency "rake"
|
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
26
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: skinny_admin
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Brad Saterfiel
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-10-07 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.12'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.12'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
description: Easily customizable admin generator for Rails. SkinnyAdmin is very easy
|
|
56
|
+
to install and get your customized administrative needs met quickly.
|
|
57
|
+
email:
|
|
58
|
+
- brad.saterfiel@gmail.com
|
|
59
|
+
executables: []
|
|
60
|
+
extensions: []
|
|
61
|
+
extra_rdoc_files: []
|
|
62
|
+
files:
|
|
63
|
+
- ".gitignore"
|
|
64
|
+
- ".rspec"
|
|
65
|
+
- ".travis.yml"
|
|
66
|
+
- CHANGELOG.md
|
|
67
|
+
- CODE_OF_CONDUCT.md
|
|
68
|
+
- Gemfile
|
|
69
|
+
- LICENSE.txt
|
|
70
|
+
- README.md
|
|
71
|
+
- Rakefile
|
|
72
|
+
- bin/console
|
|
73
|
+
- bin/setup
|
|
74
|
+
- lib/generators/skinny_admin/USAGE
|
|
75
|
+
- lib/generators/skinny_admin/controller_generator.rb
|
|
76
|
+
- lib/generators/skinny_admin/install_generator.rb
|
|
77
|
+
- lib/generators/skinny_admin/templates/controller_templates/skinny_admin_controller.rb.erb
|
|
78
|
+
- lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_edit.html.erb
|
|
79
|
+
- lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_form.html.erb
|
|
80
|
+
- lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_index.html.erb
|
|
81
|
+
- lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_index_partial.html.erb
|
|
82
|
+
- lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_new.html.erb
|
|
83
|
+
- lib/generators/skinny_admin/templates/controller_templates/views/skinny_admin_controller_show.html.erb
|
|
84
|
+
- lib/generators/skinny_admin/templates/init/dashboard.html.erb
|
|
85
|
+
- lib/generators/skinny_admin/templates/init/dashboard.rb
|
|
86
|
+
- lib/generators/skinny_admin/templates/init/skinny_admin.css
|
|
87
|
+
- lib/generators/skinny_admin/templates/init/skinny_admin.js
|
|
88
|
+
- lib/generators/skinny_admin/templates/init/skinny_admin_controller.rb
|
|
89
|
+
- lib/generators/skinny_admin/templates/init/skinny_admin_layout.html.erb
|
|
90
|
+
- lib/skinny_admin.rb
|
|
91
|
+
- lib/skinny_admin/railtie.rb
|
|
92
|
+
- lib/skinny_admin/version.rb
|
|
93
|
+
- skinny_admin.gemspec
|
|
94
|
+
homepage: http://skinnyadmin.org
|
|
95
|
+
licenses:
|
|
96
|
+
- MIT
|
|
97
|
+
metadata: {}
|
|
98
|
+
post_install_message:
|
|
99
|
+
rdoc_options: []
|
|
100
|
+
require_paths:
|
|
101
|
+
- lib
|
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - ">="
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0'
|
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
112
|
+
requirements: []
|
|
113
|
+
rubyforge_project:
|
|
114
|
+
rubygems_version: 2.6.6
|
|
115
|
+
signing_key:
|
|
116
|
+
specification_version: 4
|
|
117
|
+
summary: SkinnyAdmin is an admin template generator that is easy, quick, and painless
|
|
118
|
+
to get going. No DSL involved.
|
|
119
|
+
test_files: []
|